Guest User

Untitled

a guest
Aug 31st, 2018
937
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. #!/bin/bash
  2. torrentid=$1
  3. torrentname=$2
  4. torrentpath=$3
  5.  
  6. ip=deluge-ip
  7. port="deluge-port deluge-username deluge-password"
  8.  
  9. x=1
  10. while [ $x -le 1000 ]
  11. do
  12. sleep 3
  13. echo "Running $x times" >> ~/script.log
  14. echo "TorrentID: $torrentid" >> ~/script.log
  15. line=$(deluge-console "connect $ip:$port; info" $1 | grep "Tracker status")
  16. echo $line >> ~/script.log
  17. case $line in
  18. *unregistered*|*Sent*|*End*of*file*|*Bad*Gateway*|*Error*)
  19. deluge-console "connect $ip:$port; pause $torrentid" >> ~/deluge.output 2>&1
  20. deluge-console "connect $ip:$port; resume $torrentid" >> ~/deluge.output 2>&1
  21. ;;
  22. *)
  23. case $line in
  24. *torrentleech*|*empirehost*|*iptorrents*|*stackoverflow*|*animebytes*)
  25. total_seeds=$(deluge-console "connect $ip:$port; info" $1 | grep "Seeds" | awk '{print $3}' | sed -r 's/\(|\)//g')
  26. connected_seeds=$(deluge-console "connect $ip:$port; info" $1 | grep "Seeds" | awk '{print $2}')
  27. echo "Seeds: $connected_seeds ($total_seeds)" >> ~/script.log
  28. if (( $connected_seeds > 0 )) || (( $total_seeds > 0 )); then
  29. echo "Found working torrent: $torrentname $torrentpath $torrentid" >> ~/script.log
  30. exit 1
  31. else
  32. deluge-console "connect $ip:$port; pause $torrentid" >> ~/deluge.output 2>&1
  33. deluge-console "connect $ip:$port; resume $torrentid" >> ~/deluge.output 2>&1
  34. fi
  35. ;;
  36. *)
  37. echo "Found working torrent: $torrentname $torrentpath $torrentid" >> ~/script.log
  38. exit 1
  39. ;;
  40. esac
  41. ;;
  42. esac
  43. x=$(( $x + 1 ))
  44. done
Advertisement
Add Comment
Please, Sign In to add comment