#!/bin/bash
#
#/usr/local/bin/moveAVIs.sh
#
# Jay Holler 09-10-2009
# Find *.avi files in the Downloads directory and move them to
# the appropriate folder on the NFS share
storageDir=/storage/TV
cd /home/jayholler/Downloads
for i in *.avi
do
myFile="$i"
if [[ "$myFile" =~ ([A-Za-z0-9\.]*)\.(S..E..).avi ]] ; then
File=${BASH_REMATCH[2]}.avi
PreShowName=${BASH_REMATCH[1]}
ShowName=$(echo $PreShowName | sed 's/\./ /g')
echo "A new episode of $ShowName is ready for your enjoyment: $File" > /tmp/emailmessage.txt && sleep 2
[ -d "$storageDir/$ShowName" ] || mkdir -v "$storageDir/$ShowName"
mv -v $myFile "$storageDir/$ShowName/$File"
wget http://localhost:49153/web/ushare.cgi?action=refresh -o /dev/null -P /dev/null
/usr/local/bin/email.sh
else
echo "$myFile does not match our TV shows, pushing it to /storage/Movies on lunchbox" > /tmp/emailmessage.txt
mv -v "$myFile" /storage/Movies/$myFile
/usr/local/bin/email.sh
fi
done
exit 0
moveAvis.sh
moveAvis.sh
I built a script to parse the filename SABnzbd pumps out when it's done extracting an avi, checking if it is a TV show, and putting it in the correct directory or making one if it doesn't exist, as well as putting it in Movies if it isn't a TV show. In this way everything is sorted beautifully for me. Let me konw if there are any questions. I keep all my media stored in /storage.
Re: moveAvis.sh
I changed your script to move m2ts files. i was wonder how i could combine it with this http://forums.sabnzbd.org/index.php?topic=2291.0 any ideas?