Naming video files/TV shows: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
>UNiversal
>UNiversal
Line 7: Line 7:
Each TV show needs to be in its own folder for XBMC to be able to scan it into the library.
Each TV show needs to be in its own folder for XBMC to be able to scan it into the library.
The file names for TV shows have to be matched by the regular expressions set in [[advancedsettings.xml#.3Ctvshowmatching.3E|tvshowmatching]]. It is important to note that the name of the Series is scraped from the series root folder, while individual episodes are populated by scraping the individual filenames to retrieve the season and episode number.
The file names for TV shows have to be matched by the regular expressions set in [[advancedsettings.xml#.3Ctvshowmatching.3E|tvshowmatching]]. It is important to note that the name of the Series is scraped from the series root folder, while individual episodes are populated by scraping the individual filenames to retrieve the season and episode number.
 
{{Note|The same goes for some TV Shows such as "Battlestar Galactica", "Doctor Who" and "Knight Rider" which can yield multiple results.}}
'''Directory layout example:'''
'''Directory layout example:'''
[[File:Library.videos.tvshowsfanart.WSCR.jpg|right|400px]]
[[File:Library.videos.tvshowsfanart.WSCR.jpg|right|400px]]
Line 47: Line 47:
:showname.1x01.1x02.1x03.1x04.*
:showname.1x01.1x02.1x03.1x04.*


Where '''showname''' can be any TV show name (including nothing).
Where '''<big>showname</big>''' can be any TV show name (including nothing).
{{-}}
{{-}}



Revision as of 15:00, 5 January 2013

Adding videos to the library/Contents Adding videos to the library/Naming files

The TV Show lookup scraper relies on the following naming conventions in order to work as intended.

Directory structure and file names

Each TV show needs to be in its own folder for XBMC to be able to scan it into the library. The file names for TV shows have to be matched by the regular expressions set in tvshowmatching. It is important to note that the name of the Series is scraped from the series root folder, while individual episodes are populated by scraping the individual filenames to retrieve the season and episode number. Note: The same goes for some TV Shows such as "Battlestar Galactica", "Doctor Who" and "Knight Rider" which can yield multiple results. Directory layout example:

Library.videos.tvshowsfanart.WSCR.jpg
TV Shows
   |----TV Show 1
   |       |----Season #
   |            |--Files
   |----TV Show 2
   |       |----Season #
   |            |--Files
   |----TV Show 3
   |       |----Season #
   |            |--Files

Where content is set on the top level "TV Shows" folder. You can have different seasons in different season subfolders under the individual TV Show folders if it suits you. XBMC does not use them, but they do not cause issues either, useful to have TV Shows that contain special episodes.

The defaults will match the following structures/file name formats
Library.videos.tvshowinfo.WSCR.jpg
showname.s01e01.*
showname.s01.e01.*
showname.s01_e01.*
showname_[s01]_[e01]_.*
showname.1x01.*
showname.101.*
Defaults for two-part TV Show Episode will match
showname.s01e01-02.*
showname_[s01]_[e01-02]_.*
showname.1x01.1x02.*
Same with three- or four-part TV Show Episode
showname.s01e01-02-03-04.*
showname_[s01]_[e01-02-03-04]_.*
showname.1x01.1x02.1x03.1x04.*

Where showname can be any TV show name (including nothing).

Multi-part episodes

Handling of multi-part episodes (two part episodes in one file, multiple episodes in DVD images, etc.) is supported. The first matched tvshowmatching regexp and "[-EeXx]+([0-9]+)" will be repeatedly applied against a file name until no more seasons or episodes are found.

This allows for file names such as
showname_s01e01e02e03_s02e01e02
showname.104-05-06-201-02
showname.1x07x08x09

To break the file up in episodes that XBMC can work with you will have to create an nfo file with <epbookmark> tags. More information can be found on the Import - Export Library page.

Note that when using a custom RegExp to match a custom file naming convention, add (.*) to the end of the RegExp so that the 3rd RegExp capture is found for the second episode.

Multi-file episodes

This feature has been temporarily disabled, the plan is to implement it in a better fashion at a future date.
You can stack multiple files into one episode. For that to be available the Stack Duplicate TV Shows Video Library setting needs to be enabled. All the files must have the same season and episode number and they all have to be in the same folder. (This is to prevent unwanted stacking of true duplicates in different folders). The items will be automatically stacked in sequential order based off the filenames being sorted in a "natural" order (like this: -part1.avi, -part2.avi, ..., -part10.avi.)

TV Show specials

Special episodes are currently supported with TheTVDB.com scraper. In order for the XBMC scraper regular expressions to recognize them, they should be part of season 0. (Specials naming order can be observed in the Specials Season of the relevant TV show at TheTVDB.com).

Example
Black Adder's Christmas Carol should have a file name that matches season 0 episode 3 (e.g. contain s00e03).
TV Shows
   |----BlackAdder
   |       |----Season 0
   |            |--filename.s00e01.tittle.*
   |            |--BlackAdder.s00e03.Blackadder's Christmas Carol.*
   |            |--etc...

TV Shows with a single season (Absolute numbering)

Some scrapers, such as the TVDB.com scraper support absolute numbering via scraper settings. That allows you to add shows to the library that have no season enumeration in the filename. This is especially useful for anime. In order for this to work you will have to add special Regexp settings via advancedsettings to catch these files

Editor note: Make this more stand-alone/step-by-step, including advancedsettings.xml file creation

Full instructions at: advancedsettings.xml - <tvshowmatching>

There are two methods to add episodes without a season in their file path. Both ways will force the season to '1' by default, so that you can use the 'Use Absolute Ordering (Single Season)' setting from the TheTvDb.com scraper.

Simple Method (XBMC v9.11 onwards and Kodi)
Use only one pair of parentheses
<regexp>[/\._ \-]([0-9]+)</regexp>
Advanced Method (XBMC v10.05 onwards and Kodi)
Supports multi-episode files without season
Use an empty pair of parentheses for the season
<regexp>[/\._ \-]()([0-9]+)(-[0-9]+)?</regexp>
Specifying Default Season (XBMC v12.0 onwards and Kodi)

It is possible to set the default season for specific regular expressions by setting the 'defaultseason' attribute.

Works with both the simple method and advanced method
If not used, the season will be set to '1'
Useful for setting specials to season '0'
<regexp defaultseason="0">[/\._ \-]X()([0-9]+)(-[0-9]+)?</regexp>
<regexp defaultseason="1">[/\._ \-]E()([0-9]+)(-[0-9]+)?</regexp>


Note: In TV Shows with series like Firefly you can set for instance the main TV Shows and set content to TVDB with regular scraper settings, say No to scrapping content at this time, then navigate your way to the Firefly folder and set sub-content setting TVDB and changing scraper settings to

  1. Folder contains a single TV show
  2. Either to absolute ordering single season or DVD order
  3. Scan everything by saying yes when you get prompted by XBMC at this time.

e.g. This will set main source with normal content and sub-folder with specific settings.

TV Shows                   <<TVDB normal Settings all seasons>>
   |----TV Show 1
   |       |----Season 0
   |            |--Files
   |----TV Show 2
   |       |----Season #
   |            |--Files
   |----Firefly            <<TVDB Settings altered for single season and DVD order or absolute ordering>>
   |       |----Files

Examples

  • Doctor Who (1963) - Season 1 Episode 12: The Edge of Destruction

Tweaking matches

You can also use Add-on:XWMM to edit library entires from a web browser.

The scraper picks the wrong TV Show

You can influence the search by having nfo files alongside your media

You can also try appending the year to the TV Show folder-name. (Note the showname on the selected site to be scraped must then include the year). This might be needed for some TV Shows such as "Battlestar Galactica", "Doctor Who", "Jericho", and "Knight Rider" which will have multiple entries on a given TV metadata database because of remakes of the original show.

See the examples below:

\TV Shows\Battlestar Galactica\Season 1\Battlestar Galactica - S01E01.avi (TheTVDB omits the year from the original shows)
\TV Shows\Battlestar Galactica 2003\Season 1\Battlestar Galactica - S01E01.avi (Remakes will include year at theTVDB.com)
\TV Shows\Cupid 1998\Season 1\Cupid - S01E01.avi
\TV Shows\Cupid 2003\Season 1\Cupid - S01E01.avi
\TV Shows\Cupid 2009\Season 1\Cupid - S01E01.avi
\TV Shows\Doctor Who\Season 1\Doctor Who - S01E01.avi
\TV Shows\Doctor Who 2005\Season 1\Doctor Who - S01E01.avi
\TV Shows\Jericho 1995\Season 1\Jericho - S01E01.avi
\TV Shows\Jericho 2006\Season 1\Jericho - S01E01.avi
\TV Shows\Knight Rider 1982\Season 1\Knight Rider - S01E01.avi
\TV Shows\Knight Rider 2008\Season 1\Knight Rider - S01E01.avi

Note! "AVI" is just an example, as this applies to all video formats that XBMC supports.

Another good example is Merlin (which gets picked up as Mr Merlin series from 70's)and Merlin 2008 (which gets picked up as the current Merlin Series. A directory structure should look something like.

TV Shows
   |----Merlin 2008
   |       |----Season #
   |            |--Files
Settings can be changed to use s01e01 or 1x01 or 101 capitalizing the S or E depending on how you like it.

To further simplify scraping you can cleanup the files before adding them to XBMC with Supplemental tools An example of the settings for a popular tool Therenamer which should conform with the above naming conventions.


Custom directory structure and file names

You can make your own naming conventions / rules by adding or editing regular expressions in the advancedsettings.xml file, with the tvshowmatching tag. When enumerating episodes for a series, XBMC only cares about the season and episode, so when designing regexps you should only be concerned with these things.

Here are several common naming schemes and corresponding regexps and examples.

\Season #\## (Season# is at very end of directory name, and filename starts with episode name, neither have to be a specific number of digits) :

 <tvshowmatching>
     <regexp>Season[\._ ]([0-9]+)[\\/]([0-9]+)[^\\/]*</regexp>
 </tvshowmatching>

Example : \Battlestar Galactica\Season 3\01 - Occupation.avi (Season 3, Episode 1)


### ([season#][episode#] with nothing in between all in filename, assumes episode number is always 2 digits) :

 
 <tvshowmatching>
     <regexp>([0-9]+)([0-9][0-9])[^\\/]*</regexp>
 </tvshowmatching>

Example : \24\Season 6\601 - 6:00am to 7:00am.avi (Season 6, Episode 1)
Example 2 : \Lost\Season 1\Lost - 101.avi (Season 1, Episode 1)
Example 3 : \24\601 - 6:00am to 7:00am.avi (Season 6, Episode 1)


##x## ([season#]x[episode#] all in filename :

 <tvshowmatching>
 <regexp>([0-9]+)x([0-9]+)[^\\/]*</regexp>
 </tvshowmatching>

Example : \Scrubs\Season 1\1x01.Pilot.avi (Season 1, Episode 1)

If you use leading 0's (for example, \Scrubs\01x01 - Pilot.avi instead of 1x1), and are having difficulty getting the TV Show scraper to work, try

##x## ([season#]x[episode#] all in filename :

 <tvshowmatching>
 <regexp>[0]*([0-9]+)x[0]*([0-9]+)[^\\/]*</regexp>
 </tvshowmatching>

Example : \Scrubs\Season 1\01x01.Pilot.avi (Season 1, Episode 1) which simply strips leading 0's from the result.

s##e## (s[season#]e[episode#] at beginning of filename)

 <tvshowmatching>
 <regexp>[\\/]s([0-9]+)e([0-9]+)</regexp>
 </tvshowmatching>

Example : videos\mytv-comedy\Scrubs\season 1\s01e01 - Pilot (hdtv.xvid).avi

Season ## - Episode ## (Season [season#] - Episode [episode#] in the beginning or middle of filename)

 <tvshowmatching>
 <regexp>Season ([0-9]+) - Episode ([0-9]+)[^\\/]*</regexp>
 </tvshowmatching>

Example : TV Shows\Scrubs\Season 1\Scrubs - Season 1 - Episode 01 - Pilot.avi

TV Shows in DVD Folders Using the same directory structures as above, you can name DVD folders by adding the following xml to advancedsettings.xml. This information was gleaned from forum thread http://www.xbmc.org/forum/showthread.php?t=55497.

 <tvshowmatching append="no">
     <regexp>\[[Ss]([0-9]+)\]_\[[Ee]([0-9]+)\]?([^\\/]*)(?:(?:[\\/]video_ts)[\\/]video_ts.ifo)?</regexp>
     <regexp>[\._ \[\-\\/]([0-9]+)x([0-9]+)([^\\/]*)(?:(?:[\\/]video_ts)[\\/]video_ts.ifo)?</regexp>
     <regexp>[Ss]([0-9]+)[\.\-]?[Ee]([0-9]+)([^\\/]*)(?:(?:[\\/]video_ts)[\\/]video_ts.ifo)?</regexp>
     <regexp>[\._ \-\\/]([0-9]+)([0-9][0-9])([\._ \-][^\\/]*)(?:(?:[\\/]video_ts)[\\/]video_ts.ifo)?</regexp>
   </tvshowmatching>