There's some info here:
http://filebot.sourceforge.net/naming.html
Also here:
http://filebot.sourceforge.net/forums/v ... hp?f=5&t=2
The code for matching patterns, like you find in the .replaceALL() or .match() functions, is called a "Regular Expresson" or "RegEx" and some info about it can be found here:
http://www.regular-expressions.info/tutorial.html
As for my naming scheme I will break it down for you here.
Code: Select all
{n.upperInitial().space('.').replaceAll(/[,()]+/).replaceAll(/\.-\./,'.')}
The
n is the name of the show as retreived by FileBot.
.upperInitial() takes that name and capitalizes the first letter of every word.
.space('.') replaces all spaces in the name with periods.
.replaceALL(/[,()]+/) removes all commas and parentheses.
.replaceAll(/\.-\./,'.') removes dashes in the name.
This adds the season and episode numbers in the format s00e00. This is an inbuilt format that handles many special cases and even single files with multiple episodes, e.g. s01e01-e02.
Code: Select all
.{t.upperInitial().space('.').replaceAll(/[,]+/)replaceAll(/\.-\./,'.').replacePart('Part.$1')}
t is the title of the episode as returned by the FileBot match.
Once again we are capitalizing the first letter of each word, replacing spaces with periods, removing all commas and replacing dashes with periods.
.replacePart('Part.$1') is a built in function that detects if the episode has multiple parts and formats them according to the pattern between the single quotes.
Part.$1 Part. is literally that text, and the $1 is a placeholder for any number.
Code: Select all
{"."+fn.match(/(?i:unrated)/).toLowerCase().upperInitial()}{"."+fn.match(/(?i:uncut)/).toLowerCase().upperInitial()}{"."+fn.match(/(?i:extended)/).toLowerCase ().upperInitial()}
These are all used to detect special types of episodes, unrated, uncut or extended.
fn is the original file name.
.match(/(?i:unrated)/) simply matches the regex pattern, in this case
(?i:unrated), and returns it.
The regex in this case is very simple.
(?i:unrated) the
() group the expression, the
? denotes that the group should not return a backreference (check the regex link above for what that means, and the
i means that the search is case insensitive, and
unrated is literal.
Putting the "." inside the curly braces means that if no match is found by the above nothing is inserted into your filename, no left over period, or space or anything.
.toLowerCase() simply changes the returned match to lower case.
And then as above we capitalize the first letter.
Code: Select all
{"."+fn.match(/(?i:internal)/).toUpperCase()}{"."+fn.match(/(?i:proper)/).toUpperCase()}{"."+fn.match(/(?i:repack)/).toUpperCase()}
Same as above but this time I just capitalize ALL the letters of the returned match. This is just a personal preference of mine.
Code: Select all
{(dim[1]>480 && dim[0]==1280) ? '.720p' : (dim[1]>720 && dim[0]==1920) ? '.1080p' : null}
This is my own code for determining if content is in HD format. There are a couple of inbuilt ways of doing it in FileBot but I found I was getting some false positives.
This basically checks the dimensions of the video. If the height is greater than 480px and the width is equal to 1280px it marks the file as 720p. Or if the height is greater than 720px and the width is equal to 1920px then it marks the file as 1080p. Otherwise it does nothing.
Built in function that returns the source, e.g. DVDRip, HDTV, etc.
Code: Select all
{"."+vc.replaceAll(/AVC/, "H264")}
vc returns the video codec as determined by FileBot.
replaceAll(/AVC/, "H264") is sort of a personal preference of mine. I noticed that many of my HD scene files that were marked as H264 were detected and marked as AVC by FileBot. While that is probably more correct I just wanted to keep the naming the same as the original scene naming so I just change it back to H264 here.
Code: Select all
{'-'+fn.replaceAll(/$n/,n.replaceAll(/ [-]/,'.')).match(/(?:(?<=[-])(?!(cd|CD)[0-9]+)\w+$)|(?:^(?!(cd|CD)[0-9]+)[A-Za-z0-9]+(?=[-]))|(?:(?<=^[\[])[^\]]+(?=[\]]))|(?:(?<=[\[])[^\]]+(?=[\]]$))/)}
This last one is a more complicated regex for matching group names. It matches groups in the format filename-
group.ext,
group-filename.ext, [
group]filename.ext, filename[
group].ext.
It includes a fix for false positives from shows/movies with titles that are hyphenated, e.g. "X-Men" would lead to: filename-X.ext.
It also no longer gives false positives for multi-part files in the format cd1-filename.ext or filename-cd1.ext.
I hope this helps. If you have any questions feel free to reply back here or even PM me.
Also let me know if you come up with anything new.