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