From 2c523ef1eb51ab9e0e9b1ba6bc30c117396bb331 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Sun, 8 Dec 2019 14:46:45 +0300 Subject: Work auto spliff --- bin/watch_incoming.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 bin/watch_incoming.sh (limited to 'bin') diff --git a/bin/watch_incoming.sh b/bin/watch_incoming.sh new file mode 100755 index 0000000..b031461 --- /dev/null +++ b/bin/watch_incoming.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +TARGET=$HOME/Downloads/toPrint/toPrint_staging +PROCESSED=$HOME/Downloads/toPrint/toPrint_ready +SPLIFF=$HOME/bin/spliff + +inotifywait -m -e create -e moved_to --format "%f" "${TARGET}" \ + | while read FILENAME +do + THUMB=$(mktemp /tmp/pdf_thumbnail_XXXXXXXXX.png) + evince-thumbnailer -s 1024 -l "${TARGET}/${FILENAME}" "${THUMB}" + mv "${TARGET}/${FILENAME}" "${PROCESSED}/${FILENAME}" + $SPLIFF "${PROCESSED}/${FILENAME}" + rm -f "${PROCESSED}/${FILENAME}" + dunstify -a "spliff" -I "${THUMB}" "$FILENAME" +done -- cgit v1.2.3-70-g09d2 From 22f4404592585368ad250cdbead655c498c10509 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Mon, 30 Dec 2019 15:31:57 +0300 Subject: Track new spliff --- bin/spliff | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100755 bin/spliff (limited to 'bin') diff --git a/bin/spliff b/bin/spliff new file mode 100755 index 0000000..3767bac --- /dev/null +++ b/bin/spliff @@ -0,0 +1,6 @@ +#!/usr/bin/env zsh + +PDF=$1 +OUTPUT="${PDF:r}_spliff.pdf" +N=`qpdf --show-npages $1` +qpdf --collate --empty --pages $1 1-$(((N+1)/2)) $1 $(((N+1)/2 + 1))-$N -- $OUTPUT -- cgit v1.2.3-70-g09d2 From 29e0f13632f2f0af0fcdcbab48e502bdeeb91cde Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Mon, 30 Dec 2019 15:35:50 +0300 Subject: Add safety flag --- bin/watch_incoming.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin') 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 SPLIFF=$HOME/bin/spliff inotifywait -m -e create -e moved_to --format "%f" "${TARGET}" \ - | while read FILENAME + | while read -r FILENAME do THUMB=$(mktemp /tmp/pdf_thumbnail_XXXXXXXXX.png) evince-thumbnailer -s 1024 -l "${TARGET}/${FILENAME}" "${THUMB}" -- cgit v1.2.3-70-g09d2