Episode Format Expressions User defined episode naming scheme

About

You can easily define your own episode naming scheme. It uses Groovy expressions, which means that you can do pretty much anything, especially if you know a little bit about programming. You even get media info bindings.

Examples

{n} - {s}.{e} - {t} Dark Angel - 3.1 - Labyrinth

{n} - {'S'+s.pad(2)}E{e.pad(2)} - {t}Dark Angel - S03E01 - Labyrinth

{n} - {s+'x'}{e.pad(2)}Dark Angel - 3x01 - Labyrinth

{n.space('.').lower()}.{s}{e.pad(2)}dark.angel.301

Advanced Examples

{n.space('_')}_-_{e.pad(2)}_[{resolution}_{vc}_{ac}][{crc32}]Juuni_Kokuki_-_01_[1280x720_XviD_MP3][3E16AF40]

{n.space('.')}.{'s'+s.pad(2)}e{e.pad(2)}.{t.space('.')}.{vf}.{vc.lower()}.{ac.lower()}Firefly.s01e01.Serenity.720p.x264.ac3

{n} [{airdate.format('yyyy.MM.dd')}] {t}The Daily Show [2010.01.05] George Lucas

E:/Complete/{n}{'/Season '+s}/{s+'x'}{e.pad(2)} - {t}Rename and move. The directory structure is completely up to you.

{n.replaceTrailingBraces()} - {s+'x'}{e.pad(2)} - {t.replaceAll(/[!?.]+$/).replaceAll(/[`´]/, "'").lowerTrail().replacePart(', Part $1')}My personal favorite. Pretty much 1x01, but with lots of cleanup operations.

Binding Reference source

Name Description Example
n series name Dark Angel
s season number 3
e episode number 1
t episode title Labyrinth
airdate episode airdate 2009-06-01
absolute absolute episode number 42
special special epsiode number 1
vc video codec x264
ac audio codec ac3
cf container format mkv
vf video format 720p
resolution video size 1280x720
crc32 crc32 checksum 3E16AF40
fn file name Serenity
ext file extension mkv
episode episode object <default name>
file file object <file path>
media general media info object <any general media parameter>
video video object [stream 0] <any video parameter>
audio audio object [stream 0] <any audio parameter>
text subtitle object [stream 0] <any subtitle parameter>

Function Reference source

pad(length, padding = "0")Pad strings or numbers with given characters ('0' by default).

replaceAll(pattern, replacement = "")Replace or remove all occurrences of the pattern.

space(replacement)Replace all spaces (e.g. "Doctor Who" -> "Doctor_Who").

upperInitial()Upper-case all initials (e.g. "The Day a new Demon was born" -> "The Day A New Demon Was Born").

lowerTrail()Lower-case all letters that are not initials (e.g. "Gundam SEED" -> "Gundam Seed").

match(pattern)Get a substring matching the given pattern or nothing at all.

before(pattern)Get the substring before the given pattern or the original value.

after(pattern)Get the substring after the given pattern or the original value.

replaceTrailingBraces(replacement = "")Replace trailing parenthesis including any leading whitespace (e.g. "The IT Crowd (UK)" -> "The IT Crowd").

replacePart(replacement = "")Replace part identifier (e.g. "Today Is the Day (1)" -> "Today Is the Day, Part 1").