Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- chmod -R 2777 /DataVolume/shares/Downloads/\!/
- USER=username
- PASSWD=password
- log=/root/.scripts/removedtorrents.log
- MOVEDIR=/DataVolume/shares/Downloads/\!/\!Delete
- TORRENTLIST=`transmission-remote --auth=$USER:$PASSWD --list | sed -e '1d;$d;s/^ *//' | cut --only-delimited --delimiter=' ' --fields=1`
- for TORRENTID in $TORRENTLIST
- do
- UP_COMPLETED=`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info | grep "State: Finished"`
- DL_COMPLETED=`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info | grep "Percent Done: 100%"`
- SEED_COMPLETED=`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info | grep "Seeding.*2 days.*hours.*"`
- RATIO_COMPLETED=`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info | grep "Ratio: 1."`
- SEED_COMPLETED_BH=`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info | grep "Seeding.10 days.*hours.*"`
- TRACKER_BH=`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info-trackers | grep "bithumen"`
- TRACKER_NC=`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info-trackers | grep "ncore"`
- TRACKER=`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info-trackers | grep "Tracker 0"`
- RATIO=`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info | grep "Ratio:"`
- SEED=`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info | grep "Seeding Time:"`
- NAME=`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info | grep "Name:"`
- MORNING_SHOW=`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info | grep "Morning.*Show"`
- FAIRY_TAIL`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info | grep "Fairy.*Tail"`
- NARUTO`transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --info | grep "Naruto"`
- # Download completed 100%
- if [ "$DL_COMPLETED" != "" ]; then
- # Tracker is Ncore
- if [ "$TRACKER_NC" != "" ]; then
- # Seed 48h, 1.0 ratio
- if [ "$UP_COMPLETED" != "" ] || [ "$SEED_COMPLETED" != "" ] || [ "$RATIO_COMPLETED" != "" ]; then
- if [ "$MORNING_SHOW" = "" ] || [ "$FAIRY_TAIL" = "" ] || [ "$NARUTO" = "" ]; then
- transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --move $MOVEDIR
- fi
- transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --remove
- echo -e " \e[1;33m#$TORRENTID -\e[0;36m$NAME. \e[00;32mNcore Completed. Removing torrent.\e[00m"
- echo -e " \e[1;35m$RATIO\e[00m, $SEED"
- echo -e " $TRACKER"
- date +"%Y/%m/%d %H:%M - Ncore" >> $log
- echo " #$TORRENTID$NAME. Seed completed. Torrent has been moved and removed after 2 days 2 hours." >> $log
- echo " $RATIO, $SEED" >> $log
- echo " $TRACKER" >> $log
- echo >> $log
- else
- echo -e " \e[1;33m#$TORRENTID -\e[0;36m$NAME. \e[00;31mNot completed. Ignoring.\e[00m"
- echo -e " \e[0;35m$RATIO\e[00m, $SEED"
- echo -e " $TRACKER"
- fi
- else
- # Bithumen or any tracker 10dh seed
- if [ "$UP_COMPLETED" != "" ] || [ "$SEED_COMPLETED_BH" != "" ] || [ "$RATIO_COMPLETED" != "" ]; then
- transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --move $MOVEDIR
- transmission-remote --auth=$USER:$PASSWD --torrent $TORRENTID --remove
- date +"%Y/%m/%d %H:%M" >> $log
- echo " #$TORRENTID$NAME. Completed. Torrent has been moved and removed after 10 days." >> $log
- echo " $RATIO, $SEED" >> $log
- echo " $TRACKER" >> $log
- echo >> $log
- else
- echo -e " \e[1;33m#$TORRENTID -\e[0;36m$NAME. \e[00;31mNot completed. Ignoring.\e[00m"
- echo -e " \e[0;35m$RATIO\e[00m, $SEED"
- echo -e " $TRACKER"
- fi
- fi
- fi
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement