A little script that i made (rename tv-shows) - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33) +--- Forum: Add-on Support (https://forum.kodi.tv/forumdisplay.php?fid=27) +--- Thread: A little script that i made (rename tv-shows) (/showthread.php?tid=35224) |
A little script that i made (rename tv-shows) - ztripez - 2008-07-26 I got fed up with most of my tv-episodes hade the wrong episodenumber in there names (ppl seams to improvise pretty much on what number should be using) and the library in XBMC gets realy messy. I tossed together my first pythonscript ever (not pretty but it works ;P) What it does is that it scans a dir and checks the Episodename on tvdb, creates a Seriename/Season #/ in the destinationdir and renames the file to correct naming (in my case: S#E#.Episode.Name). No errorhandling at all and the code is abit messy (was reading alot of tutorials and api-docs while writing this). Well well.. hope anyone got some use for it. http://www.otherland.nu/projects/fixmeseries/fixmeseries.py (Dunno if this is the correct forum to put it in) - blittan - 2008-07-26 Please consider using os.path.join to create dir/file names instead of "dir/" + "anotherdir" also use os.sep to get the separator (if you need to), it will get the path separator for the os running on. This way you ensure it's runnable on both linux, windows and xbox. - ztripez - 2008-07-26 ah nice, thanks for the tip, still learning - ztripez - 2008-07-26 updated - ztripez - 2008-07-27 Updated to 0.02. Changelog: ** Made it class-based. ** Added Copyright info ** Fixed some minor buggs ** Made a better usage display ** Added operator -v: Will do a detailed ouput ** Added operator -m: User kan make their own rename masks. ** Added operator -n: Don't create season directorys in target ** Added operator -c: Will only do a checkup, will not rename or move files. Code: fixmeseries.py 0.02 - Simple-to-use batch renamer of tv-series. Checks for episodenames in filenames and tries to do a lookp agains tvtdb-database (www.tvdb.com) for information and move/rename the file to correct season- and episode-number http://www.otherland.nu/projects/fixmeseries/fixmeseries.py - ondre - 2008-08-09 can you provide a working example? i don't quite get what to put in the working dir and the target dir - ztripez - 2008-08-10 Oh of cause Lets use Futurama as an example. 1. Make a dir called Futurama somewhere (ex /home/ztripez/Futurama) 2. Copy/move all episodes you whant to fix into that dir (the script dosen't look in subdirs atm). 3. Run some kind of batch rename to make all filenames lowercases. 4. Create a target dir somewhere (but you don't need to create a Futurama dir, the script makes that for you) 5. Run the script (i suggest you run it with the -c and v flag first so you don't mess things up on the first run) ex. ./fixmeseries -cv /home/ztripez/series/Futurama /home/series/fixed 5. If you are happy with the result; Run the script again without the -c flag. The script will use the Workingsdir as name of the serie in the Lookup. It will also create a Futurama dir in the target dir. If you use the -v flag the script will output what it does and you can se if you get any matches. Rember that the script only checks for Serie/Episode-name with a 100% match. As you can se the script is lacking some abilites and i'll be happy to get suggestions on improvment. Hope this made things abit clearer (if not i'll try to explain again later, i'm in middle of a hangover atm) - sho - 2008-08-15 So what does this error message mean? "media was not found, creating" c:\Python25>fixmeseries.py -v "C:\media\road runner" "C:\media\road runner\fixed " Trying to get ID for media Fetching: http://www.thetvdb.com/api/GetSeries.php?seriesname=media ID: 82616 Fetching: http://www.thetvdb.com/api/ADA280576227FE1B/series/82616/all/en.xml Parsing episodes Does the script use the top level folder for showname matching? This is not matching for me, what am I doing wrong? Filename: road runner - beep beep - 1952.mpg Input: c:\Media>fixmeseries.py -v "road runner" "road runner\fixed" Output: Trying to get ID for road+runner Fetching: http://www.thetvdb.com/api/GetSeries.php?seriesname=road+runner ID: 77600 Fetching: http://www.thetvdb.com/api/ADA280576227FE1B/series/77600/all/en.xml Parsing episodes Looking for episode: Beep Beep road runner*Beep?Beep*.* road runner*beep?beep*.* - jabbas - 2010-10-12 Heh Nice job :-) I've done almost exactly same script by myself but in perl Anyway, there is an another tool for that on pypi: http://pypi.python.org/pypi?:action=search&term=tvnamer&submit=search - jabbas - 2010-10-12 Nice job :-) I've done almost exactly same script by myself but in perl Anyway, there is an another tool for that on pypi: http://pypi.python.org/pypi?:action=search&term=tvnamer&submit=search |