Good Afternoon All,
I am using kmttg to automatically pull all recorded shows off of a TiVo Premier, and wanted to have a way to automatically rename the files for tv shows with something similiar to "tv show name - S01E01 - episode title.mpg" so that they could be brought into Plex media server for distribution through my house.
The biggest problem that I had was determining what the show actually was to rename it. I found a program called tvdb-renamer which does this by attempting to match the name to thetvdb.com's databases. This didnt completely work for me so I decided to write a program that would do if for me, and thought I would share it in case anyone is interested in doing the same.
I use kmttg and plex media server on ubuntu, and have only tried my script on linux and mac. The only requirement is to install the levenshtien distance code from google (I used this to determine the "distance" between two strings as a way to best guess the correct title)
The script takes into account show name, air date, and episode title. It will output a filename similiar to tvdb-renamer unless told otherwise and uses the same basic inputs.
I use it with a command similiar to:
./kmttg-renamer.py "kmttg showname - kmttg tittle (MM_DD_YY).mpg" /nas/TiVo -n
so that it will rename the file, and move it to a directory of /nas/TiVo/showname/showname - SYYE## - title.mpg"
Below are the options.
Usage: ./kmttg-renamer.py [options] KMTTG_FILE.EXT OUTPUT_DIRECTORY(optional)
-i this will place program in interactive mode
-d do NOT create directories
-t test only, do not run commands
-l value change default Levenshtein value (default=0.5)
-X value change default Levenshtein value if dates match (default=0.1)
-tvdb run against a tvdb-renamer format named file
-f do NOT include original file name in output
-n save in new format "Show - S01E01 - FileInfo.ext" vice tvdb format
-o ss,## override season name (ex -o key+and+peele,255325)
-p pause on fail, good for testing with scripts
-s show all in a series to pick from, if nothing found
-h show these help options
KMTTG_FILE.EXT must be in the format of either:
Phineas and Ferb - What a Croc (06_13_2012).mpg [kmttg format]
Phineas and Ferb.S03E48.What a Croc (06_13_2012).mpg [tvdb-renamer]
* Note you must used -tvdb flag for this format!
Again, just thought I would throw this out there in case anyone is interested.