Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a watcher based on shell script #486

Closed
wants to merge 5 commits into from
Closed

Create a watcher based on shell script #486

wants to merge 5 commits into from

Conversation

svenihoney
Copy link

To overcome some shortcomings as discussed in pull request #479, I created a minimal shell script based on inotifywait tool. The advantage is the inotify event CLOSE_WRITE, which is exactly the event OCRmyPDF should run after IMHO. Also, it is easy to include all command line options for OCRmyPDF, since it is called directly from the shell script.

Improve handling of files due to inotifywait having an event CLOSE_WRITE
after a file has been written.
Was only reacting on a single change, if another change occurred during
the conversion the event was missed.
@jbarlow83
Copy link
Collaborator

Sorry... no, I'm not going to add a shell script because I don't want to commit to maintaining one.

It seems like watchdog just doesn't solve this yet since it seems soluble only in Windows and Linux.
gorakhargosh/watchdog#217

There are some packages that wrap inotify, like this one...
https://pypi.org/project/inotify-simple/

I toyed with the clunky but portable idea of using watchdog to watch for created/modified, and using pikepdf.open with a few retries to see if the file is a complete PDF.

@jbarlow83 jbarlow83 closed this Apr 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants