]> Cypherpunks.ru repositories - nncp.git/blobdiff - doc/aria2-downloaded.sh
Example downloading scripts
[nncp.git] / doc / aria2-downloaded.sh
diff --git a/doc/aria2-downloaded.sh b/doc/aria2-downloaded.sh
new file mode 100755 (executable)
index 0000000..0a1c776
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+TORRENTS_DIR=/storage/torrents
+REMOTE=stargrave.org
+
+if [ "$2" -eq 0 ]; then
+    # downloaded .torrent/.metalink
+    exit 0
+fi
+
+if [ "$2" -gt 1 ]; then
+    cd "$3"
+    while [ "$(pwd)" != $TORRENTS_DIR ]; do
+        name="$(basename "$(pwd)")"
+        cd ..
+    done
+    tartmp=$(mktemp ./finished.XXXXXX)
+    tar cf $tartmp "$name"
+    nncp-file $tartmp $REMOTE:"$name".tar
+    rm $tartmp
+else
+    nncp-file "$3" $REMOTE:
+fi