Board index Episode / Movie Naming Scheme How about sharing our format expressions?

How about sharing our format expressions?

All about user-defined episode / movie naming schemes

rednoah User avatar
The Source

Posts: 2074
Location: 北京

:idea: If you spent time on writing a naming scheme that fits exactly what you want, why don't you share it here?

:arrow: Help create a collection of all kinda naming schemes so new users can just copy & paste what other have already done!

TIP: You can quickly switch to a previously used format expression by hitting DOWN (or right-click) when you're in the editor.
FileBot is free software. Please help support FileBot by writing a review or considering a donation.
Image

Post 09 Dec 2011, 10:23
rednoah User avatar
The Source

Posts: 2074
Location: 北京

TV Shows & Anime
The most simple s00e00 scheme to get you started
{n} - {s00e00} - {t}

A simple "rename & organize into folders" scheme
V:/TV Shows/{n}/Season {s}/{n} - {s00e00} - {t}

Similar to the default s00e00 format, but automatically clean up brackets (e.g. The Office (UK) => The Office), normalize apostrophes, don't allow ALL UPPER CASE WORDS (change to All Upper Case Words), replace part information "Pilot (1..n)" to "Pilot, Part 1..n"
{n.replaceTrailingBrackets()} - {s00e00} - {t.replaceAll(/[!?.]+$/).replaceAll(/[`´‘’ʻ]/, "'").lowerTrail().replacePart(', Part $1')}

Use series name, SxE numbering, codec information and crc32 checksum
{n.space('_')}_-_{sxe}_[{resolution}_{vc}_{ac}][{crc32}]

Date pattern adding the week day localized to your system language:
{n} [{airdate.format("yyyy.MM.dd, EEEE", Locale.getDefault())}] {t}

Basic S00E00 format without spaces. Anime episodes without season will default to season 01. This one is supposed to work very well with XBMC:
{n.space('.')}.S{(episode.season ? s : 1).pad(2)}E{e.pad(2)}.{t.space('.')}

Organize episodes into "Season N" folders with specials being organized into folder "Specials" named as Season 0. Also great for XBMC:
D:/TV Shows/{n}/{episode.special ? 'Special' : 'Season '+s}/{n} - {episode.special ? 'S00E'+special.pad(2) : s00e00} - {t}


Movies & Subtitles
Movie (Year) adding part index (for multi-part movies) and language code (for subtitle files)
{n} ({y}){" CD$pi"}{".$lang"}

Special case to add ".CD1" to .nfo files that belong to a multi-CD set (e.g. movie-cd1.avi, movie-cd1.nfo, movie-cd2.avi, ...) as required by HTPC software like YAMJ/Popcornhours's NMJ.
{n} ({y}){".CD$pi"}{if (ext == 'nfo' && folder.list().find{it =~ /(?i:CD\d+)/}) ".CD1"}

Same as the above replacing the language code with the localized language name
{n} ({y}){" CD$pi"}{"."+lang.getDisplayName(Locale.getDefault()).lower()}

Only organize into folders but do not change filenames.
V:/movies/{n} ({y})/{fn}

Organize movies into folders but keep files on the same drive
{file.path[0]}:/movies/{n} ({y})/{n} ({y}){" CD$pi"}

Movie name/year and genres followed by the first three actors names.
=> Avatar (2009) [Action, Adventure, Fantasy, Science Fiction] - Sam Worthington, Zoe Saldana, Sigourney Weaver
{n} ({y}) {genres} - {actors.take(3).join(', ')}

Organize movies into collections and folders and add resolution and audio codec/channels to the filename. Preserve video source (e.g. BluRay) and 3D labels in the filename.
=> X:/Movies/Avatar Collection/Avatar (2009) [BluRay]/Avatar (2009) [3D, 720p, AAC, 6ch]
X:/Movies/{"$collection/"}{n} ({y}){" [$source]"}/{n} ({y}) [{"${fn.match(/3D/)}, "}{vf}, {ac}, {af}]

Organize and separate Movies and 3D Movies.
=> 3D Movies/Avatar (2009) [3D] [H-SBS]/Avatar (2009) (720p) H-SBS.mp4
{fn =~ /3D/ ? '3D Movies' : 'Movies'}/{n} ({y}){fn =~ /3D/ ? ' [3D] [H-SBS]' : ''}/{n} ({y}) ({vf}){fn =~ /3D/ ? ' H-SBS' : ''}{' CD'+pi}
FileBot is free software. Please help support FileBot by writing a review or considering a donation.
Image


Posts: 1
Spent a bit of time on my format expression (especially since it took me a while to figure out that by putting the brackets INSIDE the {} instead of outside that it would not append empty []'s to my file names if the bindings were undefined XP) so I thought I should share it here so others can see it. Anyways, here you go:

F:/{n}{"/Season $s"}/{n} - {s}{e.pad(2)} - {t}{" [$airdate.year]"}{" [$vf]"}{" [$source]"}{" [$vc]"}{" [$ac]"}{" [$group]"}


This takes my files, organizes them by series and season, then renames them and appends the info tags ONLY if the info exists.

Example 1 (source and group unknown):
American Dad - 101 - Threat Levels.avi
became
F:\American Dad!\Season 1\American Dad! - 101 - Pilot [2005] [384p] [XviD] [MP3].avi

Example 2 (all info known):
american.horror.story.s01e01.720p.hdtv.x264-orenji.mkv
became
F:\American Horror Story\Season 1\American Horror Story - 101 - Pilot [2011] [720p] [HDTV] [x264] [AC3] [ORENJi].mkv

NOTE 1: For the source and group bindings to work the file name must already include them in some form so that FileBot can read and parse the data from it.

NOTE 2: For the video format, video codec, and audio codec bindings to work you need to have MediaInfo installed and working. Reference
Q: Why does MediaInfo not work? I'm running on 64-bit Windows and installed FileBot x64?
A: If you're on 64-bit Windows but are actually running a 32-bit Java runtime, the whole java process will be in 32-bit compability mode, so the mediainfo native library also has to be the 32-bit version. Just install FileBot x86 instead, or replace mediainfo.dll with the 32-bit version.
from the FAQ if you are having trouble.

Hope this helps!

edit: fixed code to use the year the episode aired rather than the series premier year returned by the {y} binding.


Posts: 14
Here's the format expression I use. It's very similar to scene formatting standard but is cleaned up a bit.

{n.upperInitial().space('.').replaceAll(/[,]+/)}.{s00e00}.{t.upperInitial().space('.').replaceAll(/[,]+/)}{'.'+vf.match(/720[pP]|1080[pP]/)}{".$source"}{".$vc"}{'-'+fn.match(/(?:(?<=[-])\w+$)|(?:^\w+(?=[-]))/)}


It does the following:

1. Replaces all spaces in the series name with periods, removes all commas and capitalizes the first letter of every word.
2. Appends season and episode number in format S00E00.
3. Replaces all spaces in the episode name with periods, removes all commas and capitalizes the first letter of every word.
4. Appends video format ONLY if 720p or 1080p.
5. Appends source if available.
6. Appends video codec if available.
7. Appends group if the original file is in the format "blahblah-group.avi" or "group-blahblah.avi". (Change to {"-$group"} to match to filebot group list instead)


Example 1

Before:
chuck.101.dvdrip-rwd.avi

After:
Chuck.S01E01.Chuck.Versus.The.Intersect.DVDRip.XviD-rwd.avi

Example 2

Before:
runner-batman-s01e01.avi

After:
The.Batman.S01E01.The.Bat.In.The.Belfry.XviD-runner.avi

Example 3

Before:
aaf-watxm.s01e01.720p.mkv

After:
Wolverine.And.The.X-Men.S01E01.Hindsight.(1).720p.x264-aaf.mkv

EDIT: Changed season+episode numbering as per suggestion from rednoah to inbuilt expression that handles special cases and multi-episodes.

Post 24 Jan 2013, 04:25
rednoah User avatar
The Source

Posts: 2074
Location: 北京

Here's a format expression that might be useful for people that are using multiple drives:
{["C:", "D:", "E:"].collect{"$it/TV/$n" as File}.sort{ a,b -> a.exists() <=> b.exists() ?: a.diskSpace <=> b.diskSpace }.last()}/{episode}

This format will always evaluate to a path to the drive with the most free space, unless the series folder already exists on one of the drives in which case it'll prefer the existing one.

Note: If you're passing this format in via cmdline you must escape it correctly (e.g. replace all " in the format with \").
FileBot is free software. Please help support FileBot by writing a review or considering a donation.
Image

Post 30 Jan 2013, 19:21

Posts: 1
Quite new to this tool but it is rather awesome so I thought I'd share this after working it out!

It's kind of an 'everyman' code to move and rename files into a fairly simplistic format.
E:\Videos\{def a; new File('E:/Videos/names.csv').splitEachLine(';'){ if (n == it[0]) a = it[1]}; a ?: n.upperInitial().replaceTrailingBrackets()}\Season {s.pad(2)}\{es*.pad(2).join(' & ').replaceAll('null',{episode.special ? 'Special '+special.pad(2):''})} - {t.upperInitial().replaceAll(/[?.:]/).replacePart(' (Part $1)')}


Having shared this with my brother (on mac) we hit some issues with it (to do with file paths and such) and it needs to be done like this to work (basically just exact past no ~ shortcuts and swapped \ for / in the file path.
/Users/Symon/Television/{def a; new File('/Users/Symon/Television/names.csv').splitEachLine(';'){ if (n == it[0]) a = it[1]}; a ?: n.upperInitial().replaceTrailingBrackets()}/Season {s.pad(2)}/{es*.pad(2).join(' & ').replaceAll('null',{episode.special ? 'Special '+special.pad(2):''})} - {t.upperInitial().replaceAll(/[?.:]/).replacePart(' (Part $1)')}


What it does is:
1) Move files into:
E:/Videos/Show Name/Season 00/00 - Title


2) Has an inbuilt force show name directed at
E:/Videos/names.csv
Using the format of:
Actual Show Name;Show name you want


This also proves handy for forcing extra folders in example:
Avatar: The Last Air Bender;Avatar/The Last Air Bender
The Legend of Korra;Avatar/The Legend of Korra

Causes these two shows to be neatly organised into E:/Videos/Avatar/Show Name/Season/Episode

3) Inbuilt multi-part episode handle that outputs format of
01 & 02 - Title


4) Replaces part numbers on episodes with (Part 0)

5) If a special episode is included it is placed within its related Season and formatted as Special 00 - Title

6) General house-keeping. Capitalises first initials for all words on show title and episode titles + knocks out ? . and : from titles (probably could do with a few more knockced out but I just add in illegals as I find em)

rednoah User avatar
The Source

Posts: 2074
Location: 北京

The format engine allows you to fully automatically make any kind of change to show names and episode titles via Groovy expressions.

Q: Some episodes start with '...Name' - Is it possible to ignore the dots when renaming?
A: Sure, just use after(regex) function.
{t.after(/^[.]+/)}
FileBot is free software. Please help support FileBot by writing a review or considering a donation.
Image

Omertron Power User

Posts: 9
This is the format that I use for YAMJ (and should work well with any other media center)

..\{n.replaceFirst(/^(?i)(The|A)\s(.+)/, /$2, $1/)} {'('+y+')'}\{n} {'('+y+')'}{'.'+source}{'.'+vf}{".[CD$pi]"}{fn.match(/[.]fanart|[.]mkv/)}


All my movies are staged into a directory that I rename from and check before moving to my main movie folder.

"..\" moves the movie from it's staging directory to a correctly named folder
{n.replaceFirst(/^(?i)(The|A)\s(.+)/, /$2, $1/)} {'('+y+')'}\

Renames the folder to be "name, the (year)" for better sorting

{n} {'('+y+')'}{'.'+source}{'.'+vf}{".[CD$pi]"}{fn.match(/[.]fanart|[.]mkv/)}

Renames the file to be "the name (year).format.resolution.[cd#]"


Return to Episode / Movie Naming Scheme

cron