Lynx44’s Blog

Auto TV Episode Titler

Recently I decided to go through all of the TV programs I have on my computer and rename them to a common format. I wanted every episode to read “[Title of program] – [Season Number]x[Episode Number] – [Name of episode]”. For example, “The Simpsons – 04×03 – Homer the Heretic”. It took me a number of hours, but I manually went through and got them all formatted, the whole time thinking about how much better it would be if I could have a program automatically do that for me. I was bored, so I ended up writing it.

It’s a console project written in C# (there is no GUI interface, and I don’t plan on writing one). It works fine in both Windows (of course) and Linux (by using mono). I have it set up on my Fedora box as a cron job to keep all of my file names up to date as I download them. I’m sure there is some sort of job scheduler that can be used on Windows as well.

It allows a user to define the format that they want their episodes in, and can retrieve the episode names from IMDB.

After taking the time to make this, I finally just googled the right keywords and noticed that there are numerous apps that can do this. I’m not sure if they can run from the command line or are as flexible. This one will allow you to suggest “incorrect” title names so that the application should be able to parse anything (see the app.config file). Anyway, use it if you want, otherwise it looks like there are plenty of alternatives.

From the –help option:
Usage: AutoEpisodeTitler < options > -d [Directory to search] -t [Name of TV Series]


1.) Rename all episodes in “C:\Shows\The Simpsons” to the default format, using the episodes names found at the specified URL:
AutoEpisodeTitler -u -t “The Simpsons” -d “C:\Shows\The Simpsons”

2.) Rename all episodes in the specified directory from multiple formats to a new format:
AutoEpisodeTitler -u -t “The Simpsons” -d “C:\Shows\The Simpsons” -i “%t\.%sx%e,%t_%s_%e” -o “%t S%sE%e %n”

If the directory originally contained these files and the #2 command was ran:

The output would look like:
The Simpsons S05E04 Rosebud.avi
The Simpsons S05E05 Marge on the Lam.avi

Note: It is not always necessary or desirable to specify specific input title hints or output formats from the command line. If you want to change the default output format or add more title hints, they can be added to the app.config file found in the root directory for this application

Format strings can be used to specify both the input and output formats of files. Input format strings are also known as title hints, and are used to figure out how existing files are formatted so that they can be parsed.

%t – Placeholder for the title of the TV series
%s – Placeholder for the season number
%e – Placeholder for the episode number (within the scope of the specified season)
%n – Placeholder for the name of the episode

Example: “%t – %sx%e – %n”
Above is the default output format. It has the TV series title first, separated by a “-“, then the season and episode number, separated by an “x”, then another “-” followed by the name of the episode

d | directory  [Directory to search]
t | title  [Name of TV Series]
u | url  [IMDB Episode Web Page]
a | episodereadattempts  [Number of retries to retrieve episode title]
o | outputformat  [Output format string] – Specifies a custom output format
i | inputhints [Comma separated format strings] – Specifies additional input title hints
r | recursive – Search directories recursively
singledigitseasonnumber – Use single digits for season numbers when possible
singledigitepisodenumber – Use single digits for episode numbers when possible
h | help – Displays this help menu

Download AutoEpisodeTitler 1.0
Download AutoEpisodeTitler Source
Download TVEpisodeLibrary Source (dependency for AutoEpisodeTitler)


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: