initial support for executing postprocessing scripts
Initial support for executing arbitrary postprocessing scripts. The idea is similar to !100 that after the write_delegate finishes, another async task is started to execute a script that is passed the scanned file, its MIME type, whether or not a copy of the original file shall be kept, and some user-defined arguments. The preferences dialog has been extended to also hold all required configuration options.
simple-scan is intended to always dispatch the post-processing script. All logic (checking of MIME type, backup, etc.) is supposed to happen in the script.
Main use use case is #1 (OCR) for which a sample script using ocrmypdf (https://github.com/jbarlow83/OCRmyPDF) is provided.
There are a few tasks open that I will address once I got more familiar with Vala:
- STDOUT and STDERR are somehow not captured
- Error handling needs to be added
- Make the execution cancel-able (and decouple it visually/in the progress bar from the saving operation)
- Documentation for creating such scripts (where should this go? into README.md?)
However, this pull-request on its own already proposes a working solution that could be viable for merging.
Usage is simple:
- Compile as usual
- Navigate to the preferences dialog, enable post-processing, and enter the path to the provided script
- Arguments may include standard ocrmypdf options such as the language ("-l eng")