add trans-ctl functions

This commit is contained in:
poka 2020-03-20 08:15:19 +01:00
parent 26d2596cda
commit 5d90a60e1a
2 changed files with 17 additions and 2 deletions

View File

@ -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")

View File

@ -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