Adopt nix modules to new config

This commit is contained in:
Eike Kettner
2020-02-22 12:40:56 +01:00
parent 74a037887d
commit ec419c7bfd
11 changed files with 378 additions and 122 deletions

View File

@ -17,11 +17,11 @@ object Tesseract {
blocker: Blocker,
logger: Logger[F]
)(in: Stream[F, Byte], handler: Handler[F, A]): F[A] = {
val outBase = cfg.cmd.args.tail.headOption.getOrElse("out")
val outBase = cfg.command.args.tail.headOption.getOrElse("out")
val reader: (Path, SystemCommand.Result) => F[ConversionResult[F]] =
ExternConv.readResultTesseract[F](outBase, blocker, chunkSize, logger)
ExternConv.toPDF[F, A]("tesseract", cfg.cmd.replace(Map("{{lang}}" -> lang.iso3)), cfg.workingDir, false, blocker, logger, reader)(in, handler)
ExternConv.toPDF[F, A]("tesseract", cfg.command.replace(Map("{{lang}}" -> lang.iso3)), cfg.workingDir, false, blocker, logger, reader)(in, handler)
}
}

View File

@ -4,4 +4,4 @@ import java.nio.file.Path
import docspell.common.SystemCommand
case class TesseractConfig (cmd: SystemCommand.Config, workingDir: Path)
case class TesseractConfig (command: SystemCommand.Config, workingDir: Path)

View File

@ -19,7 +19,7 @@ object Unoconv {
val reader: (Path, SystemCommand.Result) => F[ConversionResult[F]] =
ExternConv.readResult[F](blocker, chunkSize, logger)
ExternConv.toPDF[F, A]("unoconv", cfg.cmd, cfg.workingDir, false, blocker, logger, reader)(in, handler)
ExternConv.toPDF[F, A]("unoconv", cfg.command, cfg.workingDir, false, blocker, logger, reader)(in, handler)
}
}

View File

@ -4,4 +4,4 @@ import java.nio.file.Path
import docspell.common.SystemCommand
case class UnoconvConfig (cmd: SystemCommand.Config, workingDir: Path)
case class UnoconvConfig (command: SystemCommand.Config, workingDir: Path)

View File

@ -19,7 +19,7 @@ object WkHtmlPdf {
val reader: (Path, SystemCommand.Result) => F[ConversionResult[F]] =
ExternConv.readResult[F](blocker, chunkSize, logger)
ExternConv.toPDF[F, A]("wkhtmltopdf", cfg.cmd, cfg.workingDir, true, blocker, logger, reader)(in, handler)
ExternConv.toPDF[F, A]("wkhtmltopdf", cfg.command, cfg.workingDir, true, blocker, logger, reader)(in, handler)
}
}

View File

@ -4,4 +4,4 @@ import java.nio.file.Path
import docspell.common.SystemCommand
case class WkHtmlPdfConfig (cmd: SystemCommand.Config, workingDir: Path)
case class WkHtmlPdfConfig (command: SystemCommand.Config, workingDir: Path)

View File

@ -154,7 +154,7 @@ object ConversionTest extends SimpleTestSuite with FileChecks {
})
def commandsExist: Boolean =
commandExists(convertConfig.unoconv.cmd.program) &&
commandExists(convertConfig.wkhtmlpdf.cmd.program) &&
commandExists(convertConfig.tesseract.cmd.program)
commandExists(convertConfig.unoconv.command.program) &&
commandExists(convertConfig.wkhtmlpdf.command.program) &&
commandExists(convertConfig.tesseract.command.program)
}

View File

@ -173,7 +173,7 @@ docspell.joex {
# To convert HTML files into PDF files, the external tool
# wkhtmltopdf is used.
wkhtmlpdf {
cmd = {
command = {
program = "wkhtmltopdf"
args = [
"-s",
@ -191,7 +191,7 @@ docspell.joex {
# To convert image files to PDF files, tesseract is used. This
# also extracts the text in one go.
tesseract = {
cmd = {
command = {
program = "tesseract"
args = [
"{{infile}}",
@ -215,7 +215,7 @@ docspell.joex {
# a libreoffice listener by running `unoconv -l` in a separate
# process.
unoconv = {
cmd = {
command = {
program = "unoconv"
args = [
"-f",

View File

@ -72,7 +72,7 @@ multiple files, which are called **attachments**. And an item has
- a **direction**: one of "incoming" or "outgoing"
- a **name**: some item name, defaults to the file name of the
attachments
- some **notes**: arbitraty descriptive text. You can use markdown
- some **notes**: arbitrary descriptive text. You can use markdown
here, which is appropriately formatted in the web application.
### Collective