Guest User

Untitled

a guest
Apr 8th, 2020
206
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. torrentid=$1
  3. torrentname=$2
  4. torrentpath=$3
  5.  
  6. #Change ip, port, username and password to reflect your specific instance.
  7. #Afterwards run 'chmod +x deluge-autoresume.sh' and add it to your execute in Deluge.
  8. ip=127.0.0.1
  9. port=58846
  10. username=localclient
  11. password=password
  12.  
  13. x=1
  14. while [ $x -le 100 ]
  15. do
  16.   sleep 2
  17.   echo "Running $x times" >> /scripts/torrent/deluge_autoresume.log
  18.   echo "TorrentID: $torrentid" >> /scripts/torrent/deluge_autoresume.log
  19.   line=$(deluge-console "connect '$ip':'$port' '$username' '$password'; info -v $1" | grep "Tracker status")
  20.   echo $line >> /scripts/torrent/deluge_autoresume.log
  21.   case "$line" in
  22.     *error*|*Error*|*Sent*|*End*of*file*|*Bad*Gateway*)
  23.       deluge-console "connect '$ip':'$port' '$username' '$password'; pause '$torrentid'"
  24.       sleep 5
  25.       deluge-console "connect '$ip':'$port' '$username' '$password'; resume '$torrentid'"
  26.       ;;
  27.     *)
  28.       echo "Found working torrent: $torrentname $torrentpath $torrentid" >> /scripts/torrent/deluge_autoresume.log
  29.       exit 1;;
  30.   esac
  31.   x=$(( $x + 1 ))
  32. done
RAW Paste Data