Skip to content

Commit

Permalink
Remove now unused SystemCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
eikek committed Mar 8, 2024
1 parent 7aa00f5 commit a227c17
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 339 deletions.
212 changes: 0 additions & 212 deletions modules/common/src/main/scala/docspell/common/SystemCommand.scala

This file was deleted.

This file was deleted.

29 changes: 1 addition & 28 deletions modules/extract/src/main/scala/docspell/extract/ocr/Ocr.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import fs2.Stream
import fs2.io.file.{Files, Path}

import docspell.common.exec.ExternalCommand
import docspell.common.exec.SysExec
import docspell.common.util.File
import docspell.logging.Logger
import docspell.common.exec.SysExec

object Ocr {

Expand Down Expand Up @@ -90,12 +90,6 @@ object Ocr {
.resource(SysExec(cmd, logger, Some(wd), Some(pdf)))
.evalMap(_.runToSuccess(logger))
.flatMap(_ => File.listFiles(pathEndsWith(".tif"), wd))

// println(x)

// SystemCommand
// .execSuccess(cmd, logger, wd = Some(wd), stdin = pdf)
// .flatMap(_ => File.listFiles(pathEndsWith(".tif"), wd))
}

/** Run ghostscript to extract all pdf pages into tiff files. The files are stored to a
Expand All @@ -120,10 +114,6 @@ object Ocr {
.resource(SysExec(cmd, logger, Some(wd)))
.evalMap(_.runToSuccess(logger))
.flatMap(_ => File.listFiles(pathEndsWith(".tif"), wd))

// SystemCommand
// .execSuccess[F](cmd, logger, wd = Some(wd))
// .flatMap(_ => File.listFiles(pathEndsWith(".tif"), wd))
}

private def pathEndsWith(ext: String): Path => Boolean =
Expand Down Expand Up @@ -159,17 +149,6 @@ object Ocr {
)
Stream.emit(img)
}

// SystemCommand
// .execSuccess[F](cmd, logger, wd = wd)
// .map(_ => targetFile)
// .handleErrorWith { th =>
// logger
// .warn(
// s"Unpaper command failed: ${th.getMessage}. Using input file for text extraction."
// )
// Stream.emit(img)
// }
}

/** Run tesseract on the given image file and return the extracted text. */
Expand All @@ -191,10 +170,6 @@ object Ocr {
Stream
.resource(SysExec(cmd, logger, uimg.parent))
.evalMap(_.runToSuccessStdout(logger))

// SystemCommand
// .execSuccess[F](cmd, logger, wd = uimg.parent)
// .map(_.stdout)
}

/** Run tesseract on the given image file and return the extracted text. */
Expand All @@ -211,8 +186,6 @@ object Ocr {
Stream
.resource(SysExec(cmd, logger, None, Some(img)))
.evalMap(_.runToSuccessStdout(logger))

// SystemCommand.execSuccess(cmd, logger, stdin = img).map(_.stdout)
}

private def fixLanguage(lang: String): String =
Expand Down
Loading

0 comments on commit a227c17

Please sign in to comment.