]> git.donarmstrong.com Git - bin.git/commitdiff
I'm using syncthing now
authorDon Armstrong <don@donarmstrong.com>
Tue, 30 May 2017 00:02:07 +0000 (17:02 -0700)
committerDon Armstrong <don@donarmstrong.com>
Tue, 30 May 2017 00:03:41 +0000 (17:03 -0700)
dropbox_read [deleted symlink]
dropbox_to_read [deleted file]
syncthing_read [new symlink]
syncthing_to_read [new file with mode: 0755]

diff --git a/dropbox_read b/dropbox_read
deleted file mode 120000 (symlink)
index ae20568..0000000
+++ /dev/null
@@ -1 +0,0 @@
-dropbox_to_read
\ No newline at end of file
diff --git a/dropbox_to_read b/dropbox_to_read
deleted file mode 100755 (executable)
index a6ed7c9..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/bash
-
-
-if [ "$(basename "$0")" == "dropbox_to_read" ]; then
-    for a in "$@"; do
-        LOCTMPDIR="$(mktemp -d)"
-        PDF_FILE=$(bibtex_to_paper --only-print "$a")
-        mkdir -p "$LOCTMPDIR/a"
-        mkdir -p "$LOCTMPDIR/b"
-        cp -l "$PDF_FILE" "$LOCTMPDIR/a/file.pdf";
-        if [ -e "${PDF_FILE}.annot" ]; then
-            cp "$PDF_FILE" "$LOCTMPDIR/b/file.pdf";
-            chmod u+w "$LOCTMPDIR/b/file.pdf"
-            qprint -d "${PDF_FILE}.annot" | patch -d "$LOCTMPDIR/b" --binary;
-        else
-            cp "$PDF_FILE" "$LOCTMPDIR/b/file.pdf";
-            chmod u+w "$LOCTMPDIR/b/file.pdf"
-        fi;
-        cp "$LOCTMPDIR/b/file.pdf" ~/Dropbox/research_papers/to_read/"$(basename "$PDF_FILE")";
-        rm -f "$LOCTMPDIR/a/file.pdf"
-        rm -f "$LOCTMPDIR/b/file.pdf"
-        rmdir "$LOCTMPDIR/a" "$LOCTMPDIR/b" "$LOCTMPDIR"
-    done;
-fi;
-
-if [ "$(basename "$0")" == "dropbox_read" ]; then
-    #echo "Currently not implemented";
-    # exit 1;
-    while IFS= read -r -d '' file; do
-        unset IFS
-        PDF_FILE="$(bibtex_to_paper --only-print --search-by-file "$(basename "$file")")"
-        if [ -n "$PDF_FILE" ]; then
-            ( set -e
-              LOCTMPDIR="$(mktemp -d)"
-              mkdir -p "$LOCTMPDIR/a";
-              mkdir -p "$LOCTMPDIR/b";
-              cp -l "${PDF_FILE}" "$LOCTMPDIR/a/file.pdf";
-              chmod u+w "$LOCTMPDIR/a/file.pdf"
-              cp -l "$file" "$LOCTMPDIR/b/file.pdf";
-              echo "${PDF_FILE}.annot";
-              (cd "$LOCTMPDIR";
-               diff -Nura a b ) | qprint --encode --binary > "${PDF_FILE}.annot"
-              # delete the annot file if it has size 0
-              if ! [ -s "${PDF_FILE}.annot" ]; then
-                  rm -f "${PDF_FILE}.annot"
-              fi;
-              rm -f "$LOCTMPDIR/a/file.pdf"
-              rm -f "$LOCTMPDIR/b/file.pdf"
-              rmdir "$LOCTMPDIR/a" "$LOCTMPDIR/b" "$LOCTMPDIR"
-              mv "$file" ~/Dropbox/research_papers/annotations_recorded
-            );
-        fi;
-    done < <(find ~/Dropbox/research_papers/read/ -type f -print0)
-fi;
diff --git a/syncthing_read b/syncthing_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/syncthing_to_read b/syncthing_to_read
new file mode 100755 (executable)
index 0000000..cba8181
--- /dev/null
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+
+if [ "$(basename "$0")" == "syncthing_to_read" ]; then
+    for a in "$@"; do
+        LOCTMPDIR="$(mktemp -d)"
+        PDF_FILE=$(bibtex_to_paper --only-print "$a")
+        mkdir -p "$LOCTMPDIR/a"
+        mkdir -p "$LOCTMPDIR/b"
+        cp -l "$PDF_FILE" "$LOCTMPDIR/a/file.pdf";
+        if [ -e "${PDF_FILE}.annot" ]; then
+            cp "$PDF_FILE" "$LOCTMPDIR/b/file.pdf";
+            chmod u+w "$LOCTMPDIR/b/file.pdf"
+            qprint -d "${PDF_FILE}.annot" | patch -d "$LOCTMPDIR/b" --binary;
+        else
+            cp "$PDF_FILE" "$LOCTMPDIR/b/file.pdf";
+            chmod u+w "$LOCTMPDIR/b/file.pdf"
+        fi;
+        cp "$LOCTMPDIR/b/file.pdf" ~/Sync/research_papers/to_read/"$(basename "$PDF_FILE")";
+        rm -f "$LOCTMPDIR/a/file.pdf"
+        rm -f "$LOCTMPDIR/b/file.pdf"
+        rmdir "$LOCTMPDIR/a" "$LOCTMPDIR/b" "$LOCTMPDIR"
+    done;
+fi;
+
+if [ "$(basename "$0")" == "dropbox_read" ]; then
+    #echo "Currently not implemented";
+    # exit 1;
+    while IFS= read -r -d '' file; do
+        unset IFS
+        PDF_FILE="$(bibtex_to_paper --only-print --search-by-file "$(basename "$file")")"
+        if [ -n "$PDF_FILE" ]; then
+            ( set -e
+              LOCTMPDIR="$(mktemp -d)"
+              mkdir -p "$LOCTMPDIR/a";
+              mkdir -p "$LOCTMPDIR/b";
+              cp -l "${PDF_FILE}" "$LOCTMPDIR/a/file.pdf";
+              chmod u+w "$LOCTMPDIR/a/file.pdf"
+              cp -l "$file" "$LOCTMPDIR/b/file.pdf";
+              echo "${PDF_FILE}.annot";
+              (cd "$LOCTMPDIR";
+               diff -Nura a b ) | qprint --encode --binary > "${PDF_FILE}.annot"
+              # delete the annot file if it has size 0
+              if ! [ -s "${PDF_FILE}.annot" ]; then
+                  rm -f "${PDF_FILE}.annot"
+              fi;
+              rm -f "$LOCTMPDIR/a/file.pdf"
+              rm -f "$LOCTMPDIR/b/file.pdf"
+              rmdir "$LOCTMPDIR/a" "$LOCTMPDIR/b" "$LOCTMPDIR"
+              mv "$file" ~/Sync/research_papers/annotations_recorded
+            );
+        fi;
+    done < <(find ~/Sync/research_papers/read/ -type f -print0)
+fi;