diff options
| -rwxr-xr-x | bin/spliff | 6 | ||||
| -rwxr-xr-x | bin/watch_incoming.sh | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/bin/spliff b/bin/spliff new file mode 100755 index 0000000..3767bac --- /dev/null +++ b/bin/spliff | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | #!/usr/bin/env zsh | ||
| 2 | |||
| 3 | PDF=$1 | ||
| 4 | OUTPUT="${PDF:r}_spliff.pdf" | ||
| 5 | N=`qpdf --show-npages $1` | ||
| 6 | qpdf --collate --empty --pages $1 1-$(((N+1)/2)) $1 $(((N+1)/2 + 1))-$N -- $OUTPUT | ||
diff --git a/bin/watch_incoming.sh b/bin/watch_incoming.sh index b031461..eed1da0 100755 --- a/bin/watch_incoming.sh +++ b/bin/watch_incoming.sh | |||
| @@ -5,7 +5,7 @@ PROCESSED=$HOME/Downloads/toPrint/toPrint_ready | |||
| 5 | SPLIFF=$HOME/bin/spliff | 5 | SPLIFF=$HOME/bin/spliff |
| 6 | 6 | ||
| 7 | inotifywait -m -e create -e moved_to --format "%f" "${TARGET}" \ | 7 | inotifywait -m -e create -e moved_to --format "%f" "${TARGET}" \ |
| 8 | | while read FILENAME | 8 | | while read -r FILENAME |
| 9 | do | 9 | do |
| 10 | THUMB=$(mktemp /tmp/pdf_thumbnail_XXXXXXXXX.png) | 10 | THUMB=$(mktemp /tmp/pdf_thumbnail_XXXXXXXXX.png) |
| 11 | evince-thumbnailer -s 1024 -l "${TARGET}/${FILENAME}" "${THUMB}" | 11 | evince-thumbnailer -s 1024 -l "${TARGET}/${FILENAME}" "${THUMB}" |
