]> git.donarmstrong.com Git - bin.git/blob - dropbox_to_read
add code to deal with dropbox annotation files
[bin.git] / dropbox_to_read
1 #!/bin/bash
2
3
4 set -x 
5 TMPDIR="$(mktemp -d)"
6
7
8
9 if [ "$0" == "dropbox_to_read" ]; then
10     PDF_FILE=$(bibtex_to_paper --only-print "$1")
11     mkdir -p "$TMPDIR/a"
12     mkdir -p "$TMPDIR/b"
13     cp -l "$PDF_FILE" "$TMPDIR/a/file.pdf";
14     if [ -e "${PDF_FILE}.annot" ]; then
15         cp "$PDF_FILE" "$TMPDIR/b/file.pdf";
16         chmod u+w "$TMPDIR/b/file.pdf"
17         qprint -d "${PDF_FILE}.annot" | patch -d "$TMPDIR/b" --binary;
18     else
19         chmod u+w "$TMPDIR/b/file.pdf"
20         cp "$PDF_FILE" "$TMPDIR/b/file.pdf";
21     fi;
22     cp "$TMPDIR/b/file.pdf" ~/Dropbox/research_papers/to_read/"$(basename "$PDF_FILE")";
23     rm -f "$TMPDIR/a/file.pdf"
24     rm -f "$TMPDIR/b/file.pdf"
25     rmdir "$TMPDIR/a" "$TMPDIR/b" "$TMPDIR"
26 fi;
27
28 if [ "$0" == "dropbox_read" ]; then
29     echo "Currently not implemented";
30     exit 1;
31 fi;