diff options
author | Yigit Sever | 2020-01-04 16:21:34 +0300 |
---|---|---|
committer | Yigit Sever | 2020-01-04 16:21:34 +0300 |
commit | ec041431da07ece93a258674191ee8b16befcca6 (patch) | |
tree | a9a1de2111f3aef153c84cb0cdd161b3f8530218 /bin | |
parent | 3cd07e80c97a6c9f9a7283b384da52d681824ec3 (diff) | |
parent | b7382c651d7246c1e0f17c42434ee30dd72ec017 (diff) | |
download | dotfiles-ec041431da07ece93a258674191ee8b16befcca6.tar.gz dotfiles-ec041431da07ece93a258674191ee8b16befcca6.tar.bz2 dotfiles-ec041431da07ece93a258674191ee8b16befcca6.zip |
Merge branch 'master' of 207.154.210.186:/home/yigit/dots
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/spliff | 6 | ||||
-rwxr-xr-x | bin/watch_incoming.sh | 16 |
2 files changed, 22 insertions, 0 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 new file mode 100755 index 0000000..eed1da0 --- /dev/null +++ b/bin/watch_incoming.sh | |||
@@ -0,0 +1,16 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | |||
3 | TARGET=$HOME/Downloads/toPrint/toPrint_staging | ||
4 | PROCESSED=$HOME/Downloads/toPrint/toPrint_ready | ||
5 | SPLIFF=$HOME/bin/spliff | ||
6 | |||
7 | inotifywait -m -e create -e moved_to --format "%f" "${TARGET}" \ | ||
8 | | while read -r FILENAME | ||
9 | do | ||
10 | THUMB=$(mktemp /tmp/pdf_thumbnail_XXXXXXXXX.png) | ||
11 | evince-thumbnailer -s 1024 -l "${TARGET}/${FILENAME}" "${THUMB}" | ||
12 | mv "${TARGET}/${FILENAME}" "${PROCESSED}/${FILENAME}" | ||
13 | $SPLIFF "${PROCESSED}/${FILENAME}" | ||
14 | rm -f "${PROCESSED}/${FILENAME}" | ||
15 | dunstify -a "spliff" -I "${THUMB}" "$FILENAME" | ||
16 | done | ||