This is something I've been working on tonight. I hope to have it operational soon. It will eventually rename episodes to Showname-SxxExx-(show title).XXX with only the showname and episode name from MythTv.
Usage: /user/home/Desktop/tv.sh "showname"
currently it will generate a file called "show name".txt which is the entire TVDB on the show and "show name".reduced.txt which contains only the pertinant information
#usage is as follows- tv.sh "show name" "episode name" eg. tv.sh "family guy"
#make series name friendly for URL usage
showname=`echo $1|replace " " "%20"`
#note the show for the log
echo "checking for show named" $1 "on TVDB.com" > output.log
echo "the episode name is" $2 >> output.log
#get seriesid from showname from TVDB
seriesid=`curl www.thetvdb.com/api/GetSeries.php?seriesname=$showname|grep "<seriesid>"`
#I was parsing the XML, i realized I didn't need to save the file.
#seriesid=`echo $seriesid|replace "> <" ">Ḃ<"`
#seriesid=`echo $seriesid|tr -s "Ḃ" "\n"|grep "<seriesid>"`
#remove XML tags
seriesid=`echo $seriesid|tr -d "<seriesid>"|tr -d "</seriesid>"`
echo "got series ID for $1 it is $seriesid" >>output.log
echo "now downloading show information for $1" >>output.log
#download series info for show
curl http://www.thetvdb.com/api/$apikey/series/$seriesid/all/en.xml > $showname.txt
cat $showname.txt|egrep "<EpisodeName>|<SeasonNumber>|<EpisodeNumber>">>$showname.reduced.txt
would anyone like to give me input? I'm learning bash