From 5d90a60e1a5313b851c5c63f6f88d7ccbb805e3c Mon Sep 17 00:00:00 2001 From: poka Date: Fri, 20 Mar 2020 08:15:19 +0100 Subject: [PATCH] add trans-ctl functions --- crawl.py | 2 +- trans-ctl.sh | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/crawl.py b/crawl.py index 7ef8d76..ff89e8c 100755 --- a/crawl.py +++ b/crawl.py @@ -56,5 +56,5 @@ time.sleep(1) ID = subprocess.Popen(["./trans-ctl.sh -l | grep -vE 'Sum:|ID Done' | tail -n1 | awk '{ print $1 }'"], shell=True, executable="/bin/bash", stdout=subprocess.PIPE).communicate()[0].strip().decode('ascii') print("Wait 10 seconds to get peers before remove tracker...") time.sleep(10) -subprocess.call(["./trans-ctl.sh", "-t", ID, "--tracker-remove", "http://ygg.peer2peer.cc:8080"]) +subprocess.call(["./trans-ctl.sh", "rmtracker", ID]) print("Done") diff --git a/trans-ctl.sh b/trans-ctl.sh index 2dc037c..dd5201d 100755 --- a/trans-ctl.sh +++ b/trans-ctl.sh @@ -3,4 +3,19 @@ [[ -z $transPwd ]] && transPwd=$(grep "transPwd" login.py | awk -F '=' '{ print $2 }' | tr -d '"' | tr -d ' ') #transmission-remote -t all --auth $transUser:$transPwd "$@" -transmission-remote --auth $transUser:$transPwd "$@" + +case "$1" in + rmtracker) + transmission-remote --auth $transUser:$transPwd -t $2 --tracker-remove http://ygg.peer2peer.cc:8080 + ;; + list) + transmission-remote --auth $transUser:$transPwd --list + ;; + getid) + transmission-remote --auth $transUser:$transPwd --list | grep -vE 'Sum:|ID Done' | grep -i "${@:2}" | awk '{ print $1 }' + ;; + *) + cmd="$@" + transmission-remote --auth $transUser:$transPwd "$cmd" + ;; +esac