]> git.donarmstrong.com Git - bin.git/commitdiff
add code to deal with dropbox annotation files
authorDon Armstrong <don@donarmstrong.com>
Thu, 8 Dec 2016 23:45:57 +0000 (17:45 -0600)
committerDon Armstrong <don@donarmstrong.com>
Thu, 8 Dec 2016 23:45:57 +0000 (17:45 -0600)
dropbox_read [new symlink]
dropbox_to_read [new file with mode: 0755]

diff --git a/dropbox_read b/dropbox_read
new file mode 120000 (symlink)
index 0000000..ae20568
--- /dev/null
@@ -0,0 +1 @@
+dropbox_to_read
\ No newline at end of file
diff --git a/dropbox_to_read b/dropbox_to_read
new file mode 100755 (executable)
index 0000000..9ca753c
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+
+set -x 
+TMPDIR="$(mktemp -d)"
+
+
+
+if [ "$0" == "dropbox_to_read" ]; then
+    PDF_FILE=$(bibtex_to_paper --only-print "$1")
+    mkdir -p "$TMPDIR/a"
+    mkdir -p "$TMPDIR/b"
+    cp -l "$PDF_FILE" "$TMPDIR/a/file.pdf";
+    if [ -e "${PDF_FILE}.annot" ]; then
+        cp "$PDF_FILE" "$TMPDIR/b/file.pdf";
+        chmod u+w "$TMPDIR/b/file.pdf"
+        qprint -d "${PDF_FILE}.annot" | patch -d "$TMPDIR/b" --binary;
+    else
+        chmod u+w "$TMPDIR/b/file.pdf"
+        cp "$PDF_FILE" "$TMPDIR/b/file.pdf";
+    fi;
+    cp "$TMPDIR/b/file.pdf" ~/Dropbox/research_papers/to_read/"$(basename "$PDF_FILE")";
+    rm -f "$TMPDIR/a/file.pdf"
+    rm -f "$TMPDIR/b/file.pdf"
+    rmdir "$TMPDIR/a" "$TMPDIR/b" "$TMPDIR"
+fi;
+
+if [ "$0" == "dropbox_read" ]; then
+    echo "Currently not implemented";
+    exit 1;
+fi;