4 if [ "$(basename "$0")" == "dropbox_to_read" ]; then
6 PDF_FILE=$(bibtex_to_paper --only-print "$1")
9 cp -l "$PDF_FILE" "$TMPDIR/a/file.pdf";
10 if [ -e "${PDF_FILE}.annot" ]; then
11 cp "$PDF_FILE" "$TMPDIR/b/file.pdf";
12 chmod u+w "$TMPDIR/b/file.pdf"
13 qprint -d "${PDF_FILE}.annot" | patch -d "$TMPDIR/b" --binary;
15 cp "$PDF_FILE" "$TMPDIR/b/file.pdf";
16 chmod u+w "$TMPDIR/b/file.pdf"
18 cp "$TMPDIR/b/file.pdf" ~/Dropbox/research_papers/to_read/"$(basename "$PDF_FILE")";
19 rm -f "$TMPDIR/a/file.pdf"
20 rm -f "$TMPDIR/b/file.pdf"
21 rmdir "$TMPDIR/a" "$TMPDIR/b" "$TMPDIR"
24 if [ "$(basename "$0")" == "dropbox_read" ]; then
25 #echo "Currently not implemented";
27 while IFS= read -r -d '' file; do
29 PDF_FILE="$(bibtex_to_paper --only-print --search-by-file "$(basename "$file")")"
30 if [ -n "$PDF_FILE" ]; then
35 cp -l "${PDF_FILE}" "$TMPDIR/a/file.pdf";
36 chmod u+w "$TMPDIR/a/file.pdf"
37 cp -l "$file" "$TMPDIR/b/file.pdf";
38 echo "${PDF_FILE}.annot";
40 diff -Nura a b ) | qprint --encode --binary > "${PDF_FILE}.annot"
41 # delete the annot file if it has size 0
42 if ! [ -s "${PDF_FILE}.annot" ]; then
43 rm -f "${PDF_FILE}.annot"
45 rm -f "$TMPDIR/a/file.pdf"
46 rm -f "$TMPDIR/b/file.pdf"
47 rmdir "$TMPDIR/a" "$TMPDIR/b" "$TMPDIR"
48 mv "$file" ~/Dropbox/research_papers/annotations_recorded
51 done < <(find ~/Dropbox/research_papers/read/ -type f -print0)