Created
June 28, 2013 12:09
-
-
Save jhoffmann/5884238 to your computer and use it in GitHub Desktop.
For use with transmission-daemon, enable script-torrent-done-enabled and set this script as script-torrent-done-filename. It will scan your TV folders and try to move the completed torrent into the correct one, by turning both the folder name and torrent name to lower case, stripping out all non alpha characters, and looking for the folder name …
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for i in /home/jwh/Downloads/HTPC/TV/* | |
do | |
# Look for the TV folder names inside the torrent name | |
SHOWDIR=`basename "$i" | tr '[A-Z]' '[a-z]' | tr -cd [:alpha:]` | |
SHOW=`echo ${TR_TORRENT_NAME} | tr '[A-Z]' '[a-z]' | tr -cd [:alpha:]` | |
if [[ ${SHOW} =~ ${SHOWDIR} ]] | |
then | |
# Move, stop and remove the torrent | |
CMD="mv $TR_TORRENT_DIR/\"$TR_TORRENT_NAME\" \"$i\"" | |
eval $CMD | |
transmission-remote localhost:9091 --auth=bt:bt -t ${TR_TORRENT_ID} -r | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment