diff options
author | https://id.koumbit.net/anarcat <https://id.koumbit.net/anarcat@web> | 2014-12-29 23:13:20 +0000 |
---|---|---|
committer | admin <admin@branchable.com> | 2014-12-29 23:13:20 +0000 |
commit | 2f62efb99a1924603845a1c1a14a8c0be67cd958 (patch) | |
tree | 6a2f5a58af590e2e00c83989c16decac42ab888f /doc | |
parent | ed993155bb4944c8a23f407b6080d719b3bdbb52 (diff) |
add script to add transmission files into git-annex
Diffstat (limited to 'doc')
-rw-r--r-- | doc/tips/transmission_integration.sh | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/doc/tips/transmission_integration.sh b/doc/tips/transmission_integration.sh new file mode 100644 index 000000000..aa7561d67 --- /dev/null +++ b/doc/tips/transmission_integration.sh @@ -0,0 +1,44 @@ +#! /bin/sh + +# This simple script will make sure files downloaded by the +# [Transmission BitTorrent client](https://www.transmissionbt.com/) will +# be added into git-annex. +# +# To enable it, install it to /usr/local/bin and add the following to +# your settings.json: +# "script-torrent-done-enabled": true, +# "script-torrent-done-filename": "/usr/local/bin/transmission-git-annex-add", +# -- [[anarcat]] + +set -e + +# environment from transmission: +# TR_APP_VERSION +# TR_TIME_LOCALTIME +# TR_TORRENT_DIR +# TR_TORRENT_HASH +# TR_TORRENT_ID +# TR_TORRENT_NAME +# source: https://trac.transmissionbt.com/wiki/Scripts + +if [ -z "$TR_APP_VERSION" ]; then + echo "missing expected $TR_APP_VERSION from Transmission" + exit 1 +fi + +message="transmission adding torrent '$TR_TORRENT_NAME' + +TR_APP_VERSION: $TR_APP_VERSION +TR_TIME_LOCALTIME: $TR_TIME_LOCALTIME +TR_TORRENT_DIR: $TR_TORRENT_DIR +TR_TORRENT_HASH: $TR_TORRENT_HASH +TR_TORRENT_ID: $TR_TORRENT_ID +TR_TORRENT_NAME: $TR_TORRENT_NAME +" + +echo $message +cd "$TR_TORRENT_DIR" +git annex add "$TR_TORRENT_NAME" && \ +git commit -F- <<EOF +$message +EOF |