Advertisement
BullFrog

Transmission Remove Completed torrents

Dec 4th, 2014
562
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.80 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. chmod -R 2777 /DataVolume/shares/Downloads/\!/
  4.  
  5. USER=username
  6. PASSWD=password
  7. log=/root/.scripts/removedtorrents.log
  8. MOVEDIR=/DataVolume/shares/Downloads/\!/\!Delete
  9. TORRENTLIST=`transmission-remote --auth=$USER:$PASSWD --list | sed -e '1d;$d;s/^ *//' | cut --only-delimited --delimiter=' ' --fields=1`
  10.  
  11. for TORRENTID in $TORRENTLIST
  12.  do
  13.   UP_COMPLETED=`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info | grep "State: Finished"`
  14.   DL_COMPLETED=`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info | grep "Percent Done: 100%"`
  15.   SEED_COMPLETED=`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info | grep "Seeding.*2 days.*hours.*"`
  16.   RATIO_COMPLETED=`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info | grep "Ratio: 1."`
  17.  
  18.   SEED_COMPLETED_BH=`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info | grep "Seeding.10 days.*hours.*"`
  19.   TRACKER_BH=`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info-trackers | grep "bithumen"`
  20.   TRACKER_NC=`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info-trackers | grep "ncore"`
  21.  
  22.   TRACKER=`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info-trackers | grep "Tracker 0"`
  23.   RATIO=`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info | grep "Ratio:"`
  24.   SEED=`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info | grep "Seeding Time:"`
  25.   NAME=`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info | grep "Name:"`
  26.   MORNING_SHOW=`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info | grep "Morning.*Show"`
  27.   FAIRY_TAIL`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info | grep "Fairy.*Tail"`
  28.   NARUTO`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info | grep "Naruto"`
  29.  
  30.  
  31. # Download completed 100%
  32. if [ "$DL_COMPLETED" != "" ]; then
  33.  
  34. # Tracker is Ncore
  35.   if [ "$TRACKER_NC" != "" ]; then
  36.  
  37.     # Seed 48h, 1.0 ratio
  38.     if [ "$UP_COMPLETED" != "" ] || [ "$SEED_COMPLETED" != "" ] || [ "$RATIO_COMPLETED" != "" ]; then
  39.      if [ "$MORNING_SHOW" = "" ] || [ "$FAIRY_TAIL" = "" ] || [ "$NARUTO" = "" ]; then
  40.       transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --move $MOVEDIR
  41.      fi
  42.       transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --remove
  43.        echo -e "  \e[1;33m#$TORRENTID -\e[0;36m$NAME. \e[00;32mNcore Completed. Removing torrent.\e[00m"
  44.        echo -e "       \e[1;35m$RATIO\e[00m, $SEED"
  45.        echo -e "       $TRACKER"
  46.  
  47.        date +"%Y/%m/%d %H:%M - Ncore" >> $log
  48.        echo  " #$TORRENTID$NAME.     Seed completed. Torrent has been moved and removed after 2 days 2 hours." >> $log
  49.        echo  "            $RATIO, $SEED" >> $log
  50.        echo  "            $TRACKER" >> $log
  51.        echo >> $log
  52.  
  53.     else
  54.        echo -e "  \e[1;33m#$TORRENTID -\e[0;36m$NAME. \e[00;31mNot completed. Ignoring.\e[00m"
  55.        echo -e "       \e[0;35m$RATIO\e[00m, $SEED"
  56.        echo -e "       $TRACKER"
  57.     fi
  58.  
  59.  
  60.  
  61.   else
  62.     # Bithumen or any tracker 10dh seed
  63.     if [ "$UP_COMPLETED" != "" ] || [ "$SEED_COMPLETED_BH" != "" ] || [ "$RATIO_COMPLETED" != "" ]; then
  64.       transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --move $MOVEDIR
  65.       transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --remove
  66.        date +"%Y/%m/%d %H:%M" >> $log
  67.        echo  " #$TORRENTID$NAME.     Completed. Torrent has been moved and removed after 10 days." >> $log
  68.        echo  "            $RATIO, $SEED" >> $log
  69.        echo  "            $TRACKER" >> $log
  70.        echo >> $log
  71.     else
  72.        echo -e "  \e[1;33m#$TORRENTID -\e[0;36m$NAME. \e[00;31mNot completed. Ignoring.\e[00m"
  73.        echo -e "       \e[0;35m$RATIO\e[00m, $SEED"
  74.        echo -e "       $TRACKER"
  75.     fi
  76.   fi
  77. fi
  78.  
  79. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement