Advertisement
BullFrog

Transmission - Remove Completed Torrents

Feb 19th, 2014
482
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.22 KB | None | 0 0
  1. #!/bin/sh
  2. USER=felhasználónév
  3. PASSWD=jelszó
  4. log=removedtorrents.log
  5. MOVEDIR=/DataVolume/shares/Downloads/\!/\!Delete
  6.  
  7. TORRENTLIST=`transmission-remote --auth=$USER:$PASSWD --list | sed -e '1d;$d;s/^ *//' | cut --only-delimited --delimiter=' ' --fields=1`
  8.  
  9. for TORRENTID in $TORRENTLIST
  10.  do
  11.   UP_COMPLETED=`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info | grep "State: Finished"`
  12.   DL_COMPLETED=`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info | grep "Percent Done: 100%"`
  13.   SEED_COMPLETED=`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info | grep "Seeding.*2 days.*hour.*"`
  14.   RATIO_COMPLETED=`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info | grep "Ratio: 1."`
  15.  
  16.   SEED_COMPLETED_BH=`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info | grep "Seeding.*hour"`
  17.   TRACKER_BH=`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info-trackers | grep "trackerneve"`
  18.  
  19.   TRACKER=`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info-trackers | grep "Tracker"`
  20.   RATIO=`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info | grep "Ratio:"`
  21.   SEED=`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info | grep "Seeding Time:"`
  22.   NAME=`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info | grep "Name:"`
  23.  
  24.  
  25.  
  26.  
  27. if [ "$DL_COMPLETED" != "" ]; then
  28.  
  29.  # Seed 48h, 1.0 ratio, finished
  30.  if [ "$UP_COMPLETED" != "" ] || [ "$SEED_COMPLETED" != "" ] || [ "$RATIO_COMPLETED" != "" ]; then
  31.   transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --move $MOVEDIR
  32.   transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --remove
  33.    echo -e "  \e[1;33m#$TORRENTID -\e[0;36m$NAME. \e[00;32mCompleted. Removing torrent.\e[00m"
  34.    echo -e "       \e[1;35m$RATIO\e[00m, $SEED"
  35.  
  36.    date +"%Y/%m/%d %H:%M" >> $log
  37.    echo  " #$TORRENTID$NAME.     Download and Upload completed. Torrent has been moved and removed." >> $log
  38.    echo  "            $RATIO, $SEED" >> $log
  39.    echo >> $log
  40.  
  41.  else
  42.    echo -e "  \e[1;33m#$TORRENTID -\e[0;36m$NAME. \e[00;31mNot completed. Ignoring.\e[00m"
  43.    echo -e "       \e[0;35m$RATIO\e[00m, $SEED"
  44.  fi
  45.  
  46. fi
  47.  
  48.  echo
  49.  echo
  50.  
  51. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement