From 534035c52f2390c393176db8d5162cb4efab0f37 Mon Sep 17 00:00:00 2001 From: Jonny007-MKD Date: Thu, 12 Mar 2015 21:20:59 +0100 Subject: [PATCH] Adding script for adding torrents in DelugeD --- delugeAddTorrent.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 delugeAddTorrent.sh diff --git a/delugeAddTorrent.sh b/delugeAddTorrent.sh new file mode 100755 index 0000000..4efab98 --- /dev/null +++ b/delugeAddTorrent.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# This script shall be called by DelugeD in the "On torrent added" action + +PwD=$(readlink -e $0) # Get the path to this script +PwD=$(dirname "$PwD") +db="$PwD/labelsOfTorrents.db" + +# get arguments from DelugeD +torrentid=$1 +torrentname=$2 +torrentpath=$3 + +#echo "Date: `date`" >> "$PwD/log" +#echo "TorrentID: $torrentid" >> "$PwD/log" +#echo "TorrentName: $torrentname" >> "$PwD/log" +#echo "TorrentPath: $torrentpath" >> "$PwD/log" +#echo "I am: `whoami`" >> "$PwD/log" +#echo "" >> "$PwD/log" + +if (( $# == 0 )); then # no arguments!? + exit 1; +fi + +if [ -n "$(grep $torrentid $db)" ]; then # torrent already exists + exit; +fi + +echo "$(date +%s) deluge $torrentid $torrentname " >> $db +