XBMC naming schemes

All about user-defined episode / movie format expressions
Post Reply
zorofroozo
Power User
Posts: 3
Joined: 18 Mar 2013, 10:17

XBMC naming schemes

Post by zorofroozo » 18 Mar 2013, 10:45

Work in progress

All contributions are welcome!

Getting your media library in to shape is a hassle to say the least.
Renaming you files one by one is almost impossible if you have a load of files.
This can be automated but even then most of us need some help.
XBMC is a wonderfull program but she can be a extremely picky sometimes.
Lets help her out and whipp our media library in to shape!

As thus:

The XBMC naming scheme topic!

Made for XBMC-12 Eden.

Movie naming sheme

Movies are seldomly scanned incorrect by XBMC but to make sure they are all scanned in to your library, use following script:

Code: Select all

{n} ({y})
Do know that when you have multiple subtitles, it will only rename the first. Other subs would have the same name and thus cause a conflict.

As you might or might not know, XBMC needs a certain folder structure to succesfully scan your library:

Code: Select all

Movies                  <<Source folder, Content: Movies>>
   |----Aliens (1986)
   |       |----Aliens (1986).mkv
   |       |----Aliens (1986).English.srt
   |----Alien³ (1992)
   |       |----Alien³ (1992).mp4
   |       |----Alien³ (1992).English.sub
   |----Alien Resurrection (1997)
   |       |----Alien Resurrection (1997).avi
   |       |----Alien Resurrection (1997).idx
XBMC should display the language of your subtitle, but till today I have not been able to get this to work. If you guys did, let me know. This is also the reason I did not add any language detection part. Let's say you want your media on drive G, your naming scheme would look like this:

Code: Select all

g:/Movies/{n} ({y})/{n} ({y})
Tv show naming sheme

Your tv show will look like this "The A-Team.s01e01-02.Mexican Slayride":

Code: Select all

{n}.{s00e00}.{t}
The correct folder structure for tv shows is:

Code: Select all

TV Shows                  <<Source folder, Content: TV shows>>
   |----Battlestar Galactica (2003)
   |       |----Season 0
   |            |-- ... specials ...
   |       |----Season 1
   |            |--The A-Team.s01e01-02.Mexican Slayride
   |            |--The A-Team.s01e03.Children of Jamestown
   |            |-- ...
   |       |----Season 2
   |            |-- ...
The script to make this happen:

Code: Select all

g:/TV Shows/{n} ({y})/{episode.special ? 'Season 0' : 'Season '+s}/{n}.{episode.special ? 'S00E'+special.pad(2) : s00e00}.{t}
This will check for specials, name them s00e01 (and so on) and copy them to the "Season 0" folder. This way XBMC correctly scans your folder.

Your tv show or movie is not recognised? Be sure the name it exactly the same as stated in your scrapers database. For example, I could not scan my Battlestar Galactica collection. Why, I forgot to check the folder name. Tvdb sees the new battlestar galactica series as "Battlestar Galactica (2003)".

Anime show naming sheme

If you thought XBMC had its quirks scanning tv shows, just try getting it to recognise your anime. Its like explaining the way to a blind man who speaks an other language ^^

Here we go, first the folder structure:

Code: Select all

Anime                  <<Source folder, Content: TV shows, Scraper: Anidb>>
   |----Tenjho Tenge
   |       |----Tenjho Tenge.S01E01.Sanctuary
   |----Black Lagoon Collection
   |       |----Black Lagoon
   |            |--Black Lagoon.S01E01.The Black Lagoon
   |       |----Black Lagoon The Second Barrage
   |            |--Black Lagoon The Second Barrage.S01E01.The Vampire Twins Comen
Because anidb sees each season as it's own show you'll have to put them together manually after renaming them. Apart from that specials need to be named manually as s00e01. If the special has its own page then it probably won't work in xbmc. You'll need to add them manually by creating a nfo file. The special will be in an other folder then when viewed by xbmc. If you guys now a solution, let me know.

Second, the scraper, you'll have to use the anidb scraper. I did not get the anime news network scraper to work. Ideas are welcome.
Leave all settings as is on first advanced settings page. When I changed them to any other setting, no files would be scraped.

Code: Select all

G:/Anime/{n}/{n}.S{(episode.season ? s : 1).pad(2)}E{e.pad(2)}.{t}
Do remember to move specials manually.

Thanks for your help:
Alan Henry from http://lifehacker.com/5990500/filebot-g ... dia-center
The xbmc wiki: http://wiki.xbmc.org/
Rednoah: for filebot, his watchfull eye and helpfull additions

Work in progress

EDITS
18/03/2013: Some remakes have the same name wich causes mismatches. This can be fixed by addin {y} in your script.
20/03/2013: I discovered XBMC sometimes refuses to scan a folder containing a wrongly named subfolder. In my case I had a folder named "specials" and several other correctly named folders. No files were visible in the library. Changed the folder name to "Season 0" in the script written by [email protected]"How about sharing our format expressions? ".;
Added the part to name your movies. As of today I am unsure about adding code for music because I like to use other programs for that purpose ...

21/03/2013: Added the part to correctly name your anime. Xbmc demands you format it {s00e00}, otherwise it won't work. The anidbplugin is picky also:p
Last edited by zorofroozo on 21 Mar 2013, 12:47, edited 8 times in total.

User avatar
rednoah
The Source
Posts: 16812
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: XBMC naming schemes

Post by rednoah » 18 Mar 2013, 12:09

If you want dots instead of space in name and title also you can use n.space('.') and t.space('.') to accomplish that.

Also you may have misunderstood replacePart(...) since it'll only provide you capturing group $1. All it's doing is match patterns like Part 1, (1), [1] and allow you to replace that where $1 is the number. There is no $2 capturing group. It's just regex on the episode title really.
:idea: Please read the FAQ and How to Request Help.

zorofroozo
Power User
Posts: 3
Joined: 18 Mar 2013, 10:17

Re: XBMC naming schemes

Post by zorofroozo » 18 Mar 2013, 13:18

rednoah wrote:If you want dots instead of space in name and title also you can use n.space('.') and t.space('.') to accomplish that.
Okay, thx for the tip. I do believe that would make the filename less readable for the human eye. XBMC does not seem to mind...

rednoah wrote:Also you may have misunderstood replacePart(...) since it'll only provide you capturing group $1. All it's doing is match patterns like Part 1, (1), [1] and allow you to replace that where $1 is the number. There is no $2 capturing group. It's just regex on the episode title really.
Well I was looking for a way to get my filename look like name.s01e01-02-03.ext . Seems I've got that one totally wrong ^^. I'll get my library organised and add to the naming shemes when needed.

User avatar
rednoah
The Source
Posts: 16812
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: XBMC naming schemes

Post by rednoah » 18 Mar 2013, 16:02

Multi-Episode formatting is different, there's the {es} binding but actually no need since {sxe} and {s00e00} bindings format multi-episodes properly by default.

The replacePart(...) function is just for converting titles like "Double Pilot (1)" to "Double Pilot, Part 1".
:idea: Please read the FAQ and How to Request Help.

zorofroozo
Power User
Posts: 3
Joined: 18 Mar 2013, 10:17

Re: XBMC naming schemes

Post by zorofroozo » 20 Mar 2013, 19:06

rednoah wrote:Multi-Episode formatting is different, there's the {es} binding but actually no need since {sxe} and {s00e00} bindings format multi-episodes properly by default.

The replacePart(...) function is just for converting titles like "Double Pilot (1)" to "Double Pilot, Part 1".
I thought as much, after experimenting a bit, using {s00e00} with multi-episodes made XBMC scan the files correctly ^^

User avatar
bonelifer
Power User
Posts: 78
Joined: 23 Mar 2013, 18:27

Re: XBMC naming schemes

Post by bonelifer » 25 Mar 2013, 15:01

zorofroozo could I get some assistance from you? I'd like to add in specials support in my line below but in the format I use for my files. I'm using XBMC Frodo.

Example of a British show I have "Waiting for God": http://thetvdb.com/?tab=series&id=77998&lid=7

Y:/Videos/TV/Waiting for God/Season 00/Waiting for God - [00x01] - Christmas at Bayview.mkv

Just using that as an example of the structure.

Here's my line as it is right now:

Code: Select all

Y:/Videos/TV/{def a; new File('Y:/incoming/scripts/names.csv').splitEachLine(';'){ if (n == it[0]) a = it[1]}; a ?: n.upperInitial().replaceTrailingBrackets()}/{"Season"} {s.pad(2)}/{def a; new File('Y:/incoming/scripts/names.csv').splitEachLine(';'){ if (n == it[0]) a = it[1]}; a ?: n.upperInitial().replaceTrailingBrackets()} - [{s.pad(2)}x{e.pad(2)}] - {t}

Note: Also above you say XMBC 12 Eden, but 11 is eden and 12 is Frodo.

User avatar
bonelifer
Power User
Posts: 78
Joined: 23 Mar 2013, 18:27

Re: XBMC naming schemes

Post by bonelifer » 25 Mar 2013, 21:45

Wish I had a current better example, as the S00E01 and S00E02 are also listed in the regular seasons for some reason. But S00E03 is definitely a special all by itself.

From this:
Waiting For God--Stephanie Cole Funny Women.mkv

I get(with my code):
Y:/Videos/TV/Waiting For God/Season 00/Waiting For God - [00x] - Stephanie Cole Funny Women.mkv


What I'd like is(according to thetvdb[ theTVDB ]):
Y:/Videos/TV/Waiting For God/Season 00/Waiting For God - [00x03] - Stephanie Cole Funny Women.mkv

User avatar
bonelifer
Power User
Posts: 78
Joined: 23 Mar 2013, 18:27

Re: XBMC naming schemes

Post by bonelifer » 10 Jun 2013, 05:23

For anyone wanting to add specials support for their TV series that work with Frodo, I've found and applied an example from another post that now works:

Code: Select all

{["T:", "Y:"].collect{ drive -> def a=n; new File('Y:/incoming/scripts/names.csv').splitEachLine(';'){if (n==it[0]) a=it[1]}; return new File(drive+"/Videos/TV/", a)}.sort{ a,b -> a.exists() <=> b.exists() ?: a.diskSpace <=> b.diskSpace }.last()}/{episode.special ? "Season "+s.pad(2) : "Season "+s.pad(2)}/{def a; new File('Y:/incoming/scripts/names.csv').splitEachLine(';'){ if (n == it[0]) a = it[1]}; a ?: n.upperInitial().replaceTrailingBrackets()} - [{episode.special ? "00x"+special.pad(2) : s.pad(2) + "x" + e.pad(2)}] - {t}
Things to be aware is that this code also takes into account which drive you defined has more space and puts new series on the drive with the largest available space. If another drive has more space but the series already exist then it goes to the current drive. Change out "T:" and "Y:" for your drive letters or for linux "/media/DRIVENAME/", "/media/DRIVETWO/". To add more drives add a comma and put the new drive in double quotes like above. Then the folders are "/Videos/TV/" change that section to the initial folder structure. In my case

Code: Select all

T:/Videos/TV/
The next thing to be aware of is I also have Show names remapped using the code with "Y:/incoming/scripts/names.csv'". The CSV is just a plain text file with the remapping of show names to what I want in my library. Examples:

Code: Select all

CSI: Miami;CSI- MIAMI
CSI: NY;CSI- NY
NCIS: Los Angeles;NCIS- LA
CSI: Crime Scene Investigation;Crime Scene Investigation
The Looney Tunes Show;The Looney Tunes Show (2011)
Remember the intial name is the actual name of the show as it is on theTVDB database and the second name is what you want it changed to. No space between the ";" and the end of the first name or the beginning of the changed name. One line per show.

Lastly you'll notice this code:

Code: Select all

{episode.special ? "Season "+s.pad(2) : "Season "+s.pad(2)}
I format my Specials folder as "Season 00", some may want to have it as "Specials". Just change the first instance of

Code: Select all

"Season "+s.pad(2)
to

Code: Select all

"Specials"

The results:
For regular Episodes it would be:

Code: Select all

T:\Vidoes\TV\TVSERIESNAME\Season 01\TVSERIESNAME - [01x01] - Episode Name.mkv
For specials it would be:

Code: Select all

T:\Vidoes\TV\TVSERIESNAME\Season 00\TVSERIESNAME - [00x01] - Specials Episode Name.mkv


special thanks to
rednoah for Filebot and his initial help with the code to format my TV series the way I wanted.

danielsokolowski for this post that I got the specials code from: LINKS

zorofroozo for this topic.

User avatar
mihawk90
Power User
Posts: 50
Joined: 18 Mar 2014, 00:41

Re: XBMC naming schemes

Post by mihawk90 » 14 Jul 2014, 14:13

For Animes, I'm using a single-directory layout for now. I might be switching that in the future for season-fanarts or something, but that would be easy to do.
Note that I'm using TheTVDB-Scraper for my animes, not AniDB :)

Anyway, the format I'm using currently is this:

Code: Select all

SSxEE [Group] ABS [Hash].format
The formating in Filebot would be this (thanks to rednoah for this :) ):

Code: Select all

{es.collect{ s.pad(2)+'x'+e.pad(2)}.join('-')} [{group}] {episodes*.absolute*.pad(3).join('-')} [{crc32}]
It's been pretty bulletproof for now, and it works with multi-episode files as well.
The reason behind this is pretty easy, most of the animes I'm still seeding back to whereever I got it and since the torrents are pretty much always Absolute-Numbered I got confused every time on which file was the correct file to go.
Also I believe you can switch between Absolute and Season sorting in Scraper Settings at any time you want without having to rename anything. XBMC *should* be able to scrape both ways with this format (did not test this though).

/edit
I just realised that the formating string above doesn't seem to work with the abs2sxe-script (or the console in general), multi-eps are only given one of the episodes as name (string works fine in GUI though)

Post Reply