GP SoftwareTwitter
Opus FAQsManualCommandsObjects

TV Episode Renaming Script

vbscript
scripting

#1

This script is useful for renaming large numbers of TV episode files from the "S01E05" or "1x05" format to a more useable "1.05 - Episode Title" format.
eg. Lost.S04E06.HDTV.XViD-DOT.avi becomes 4.06 - The Other Woman.avi

Instructions:

  1. Create a file called eps.txt and place it in the same directory as the files being renamed.

  2. Go to tv.com, locate the episode lists for the show you wish to rename and copy the table into the eps.txt file for all the seasons you require. You should end up with each line being formatted somewhat similar to this:

    1    Pilot (1)     9/22/2004    100     Reviews     available    9.45
    
  3. As tv.com sequentially numbers the episode lists (eg the first episode of season 2 might be #25) you will need to indicate (within the eps.txt file) where a new season begins.
    Do this by placing a hash (#) on a line by itself before the line containing the first episode of the new season:

    24    Exodus (2)     5/25/2005    123     Reviews     available    9.55
    #
    25    Man of Science, Man of Faith     9/21/2005    201     Reviews     available    9.38
    26    Adrift     9/28/2005    202     Reviews     available    8.76
    
  4. Save the eps.txt file.

  5. You should now be able to select the files to be renamed, go to the renaming dialog, and choose this script!

Download:

See Also:


TV Episode XBMC Renamer
Miran's TheTVDB Renamer
Renaming directory from mp3 metadata
#2

A quick re-read of what I posted suggests some clarification is in order. Getting the date from tv.com isn't as tricky as it sounds - here's a visual example.

Find the TV series you wish to rename. On its main page look for the "Episode List" link:

At this point you can merely copy the season you are interested in or you can swap to the 'All Seasons' list if you have episodes from multiple seasons. Here I'm just after season 4:

Paste this directly into the eps.txt document. If you only did a single season (as in this example) simply add a hash (#) for every season you are missing:

Now simply select the files you wish to rename, choose the TV Rename script (assuming you've imported it!) and voila! :slight_smile:

Note: You don't have to have every episode to rename eg you could have files 1x06, 1x07, 1x10 and 2x03 and as long as you've copied all of season 1 and 2 from tv.com into the eps.txt file you'll be okay.


#3

works good Thanks, i needed something like this.

Great Post


#4

I'm the author of this tool, that does exactly what you want, but way more comfortable and automatic :wink:
seriesrenamer.wordpress.com/

It recognizes the Episode and Season numbers, and most of the time the showname by itsself, and has a list of supported websites that can be queued to extract the episode names. After that, filenames are generated automatically by a pattern you can specify (+lots of options).

I suggest integrating it by adding a button (or so) that runs the program with the path containing the files as argument for quick access.


#5

Isn't it a bit rude to hijack the "competition's" thread just to pimp your own tool? :laughing:


#6

What competition?
I just saw this thread and thought that people might be interested.


#7

Nah, it's all good. The code I posted above has fallen into 'disrepair' since tv.com changed their episode listing layout a while back.

While I haven't used the SeriesRenamer tool I'm sure it does a far better job than my little hack! :slight_smile:

Anyway, I suspect my original post and code are now only of value as 'interesting sample code' for anyone messing about with DOpus rename scripting...


#8

[quote="BrokenNails"]Nah, it's all good. The code I posted above has fallen into 'disrepair' since tv.com changed their episode listing layout a while back.

While I haven't used the SeriesRenamer tool I'm sure it does a far better job than my little hack! :slight_smile:

Anyway, I suspect my original post and code are now only of value as 'interesting sample code' for anyone messing about with DOpus rename scripting...[/quote]

i still use it weekly! it works just fine really even with the changes...
but will look at the script added


#9

After tweaking it a bit, the Series Renamer seems to get job done nicely.

If only I could give over the Path (or even selected Filenames) from DO to the Series Renamer to create a button for Renaming. The usual commands do not seem to work here and I did not find any Documentation for the Renamer.

Help would be greatly appreciated.

Chris


#10

You can. Just run it with "Seriesrenamer.exe FolderPath" like I said in my earlier post. In Directory Opus that results in ""C:\Path\To\Series Renamer.exe" {sourcepath}" (minus the outer quotes).

What exactly did you tweak? Just curious.


#11

Thanks a lot. I tried that originally, but must have messed up somewhere.

Would there be any chance - maybe in a later Version - to feed it single Files?

Well, the Presets for the Target Filename are a bit exotic for my taste. Now I use "%T.S0%sE%E.%N". Oh - and I like to rename directly, not to another Directory Structure.

Keep up the good work. Especially now with "DO integration", the Series Renamer is a very helpful Tool.

Chris


#12

Processing single files might be added in a later version, I'll have to think about processing a list though.

As for the default settings, I ship the program with the settings I use. I realise that the notation using dots and season name is quite common, but I don't really like it, since the show name is in the folder name if you use a showname\season x\ directory structure, and the dots could only be useful when it comes to avoiding url escape sequences, which aren't needed for local storage.


#13

Okay, but just consider it might not be the best way to name the files if they end up on DVD or Flashdrive for Playback on an external Player.

Also I heard somewhere older DVD-Players can have an issue with the Spaces in the Filenames. Never experienced it myself, though.


#15

Since we're on the episode renaming topic:
not a script, but I have this regex as a preset to rename files following a s01e09 pattern to a 1x09 pattern.

Old name: (.*?)s0?(\d)e(\d+)(.*)(\.[^.]+)
New name: \2x\3\5

Group 1 can usually be discarded as it's the junk that comes before the S02E19 stuff.
Group 4, I usually discard too because I don't need the name of the series, it's in the folder. But sometimes group 4 is the name of the episode and needs to stay.

So this is just the basic preset, to be tweaked on a case-by-case basis. For instance:

  • I often need the fourth capture group: New name: \2x\3\4\5
  • If you want to keep the zero in s01, you could modify Old name to (.*?)s(\d+)e(\d+)(.*)(\.[^.]+)
    Etc.

I find it brilliant that Opus lets us store basic patterns for rename operations that seem to recur, but never quite in the same way. It makes fast work of jobs that most people with a collection of unwieldy files (and no Opus) would find daunting.

Any questions, please let me know. :slight_smile: