Naming video files/TV shows: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
>ScudLee
(Complete rewrite/reorganization (revert if overstepping))
Line 1: Line 1:
{{frodo updated}}{{:Adding videos to the library/Contents}}
{{frodo updated}}{{:Adding videos to the library/Contents}}
{{#lst:Adding videos to the library/Naming files|naming files}}
{{#lst:Adding videos to the library/Naming files|naming files}}
==Naming==
[[File:Library.videos.tvshowsfanart.WSCR.jpg|right|400px]]
XBMC will use the folder name to determine the name of the show being scanned, and will only use the file name to determine the season and episode number.


The TV Show lookup scraper relies on the following naming conventions in order to work as intended.
The folder name will be [[Userdata/advancedsettings.xml#.3Ccleanstrings.3E|cleaned]] of commonly used strings, such as DVDRip, 1080p, x264, etc. before being passed to the scraper.  If the year of release is included, this will be [[advancedsettings.xml#.3Ccleandatetime.3E|extracted]] and used by the scraper to assist in making a match.


== Directory structure and file names ==
Spaces, periods, or underscores may be used to separate words in the folder and file names, but shouldn't be mixed in the same folder name. Note also the caution [[#Split-episode|below]] regarding file names with periods.
[[File:Library.videos.tvshowsfanart.WSCR.jpg|right|400px]]
 
XBMC needs a TV show folder with just the TV show name and then it needs file names that contain both episode numbers and season numbers (optional, see below). There can be season/year/whatever folders between the TV show folder and the episode files, but XBMC will not use these to figure out what the seasons are. While XBMC and scrapers can sometimes be forgiving of extra data in the file name, it's best to keep it simple and avoid extra text outside of the examples below (such as group names, resolution, etc). Advanced users can tweak the matching patterns that XBMC uses for this with regex and [[advancedsettings.xml#.3Ctvshowmatching.3E|these advancedsettings.xml settings]].
{{Note|Flat structures with files for different shows in a single directory are ''not'' supported.}}
===Directories===
[[File:Library.videos.tvshowinfo.WSCR.jpg|right|400px]]
You must set the content to TV Shows on the directory directly above the individual show folders.
To ensure accurate matches for your TV shows, the folder names should match the title displayed on the site being scraped.
For the default TVDB scraper this may mean including the year of release, e.g. [http://www.thetvdb.com/?tab=series&id=83462 Castle (2009)] (in cases of duplicate titles), or the country of origin, e.g. [http://www.thetvdb.com/?tab=series&id=196921 Being Human (US)] (in cases of foreign remakes).


;Directory layout example
Below the show folder, the files may be organized how you wish, e.g. into separate season folders, or by year.  These folders will be ignored.
====Simple====
Typically, you will add the top-level directory as a source and set the content to TV shows when you add it.
;Example
:{|
:{|
|
|
<pre>
<pre>
TV Shows
TV Shows                 <<Source folder, Content: TV shows>>
   |----TV Show 1
   |----TV Show 1
   |      |----Season #
   |      |----Season #
Line 23: Line 34:
</pre>
</pre>
|}
|}
[[File:Library.videos.tvshowinfo.WSCR.jpg|right|400px]]
====Complex====
;Default TV show folder naming conventions
In more complex situations where your top-level directory is further sub-divided before the show folders, you can add the top-level as source but not set the content, and then set the content to TV shows on each sub-folder.
*'''(year)''' - can be helpful for some TV Shows such as "Battlestar Galactica", "Doctor Who" and "Knight Rider" which can yield multiple results.
;Example
:Name
:{|
:Name (year)
|
 
<pre>
===Shows with seasons===
TV Shows                  <<Source folder, Content: None>>
;Default episode file naming conventions
  |----A-M              <<Content: TV shows>>
*'''name''' - can be the TV show name, episode name, something else, or you can exclude the name and only have the season and episode numbers. You can also place the name after the season and episode numbers.
  |      |----TV Show 1
*'''ext''' - The file extension, such as .mkv, .avi, .iso, etc.
  |              |--Files
*'''Spaces''' and underscores are interchangeable in the examples below.
  |----N-Z              <<Content: TV shows>>
*'''Periods''' can be used to break up text, but '''they cannot be used''' in between '''episode-number''' and '''episode-names''' that start with a '''number'''. For e.g. name.s01e01.1.0.ext (episode name is one poin zero} so must become name.s01e01_1.0.ext
  |      |----TV Show 2
:''name''.s01e01.''ext''
  |              |--Files
:''name''.s01.e01.''ext''
</pre>
:''name''.s01_e01.''ext''
|}
:''name'' [s01] [e01].''ext''
It's also possible to have a sub-folder group multiple shows together in an otherwise normal directory structure.  Just change the content on the sub-folder and de-select the "Selected folder contains a single TV show" setting.
:''name''.1x01.''ext''
;Example
:''name''.101.''ext''
:{|
 
|
;Defaults for two-part TV Show Episode will match:
<pre>
:''name''.s01e01-02.''ext''
TV Shows                  <<Source folder, Content: TV shows>>
:''name''_[s01]_[e01-02]_.''ext''
  |----TV Show 1
:''name''.1x01.1x02.''ext''
  |      |----Season #
  |            |--Files
  |----Star Trek Series  <<Content:TV shows>>
  |      |----Star Trek
  |      |      |--Files
  |      |----Star Trek The Next Generation
  |              |--Files
</pre>
|}
In these cases, it's best to refrain from scanning the files into the library until the content is set correctly for all folders, to avoid incorrect results and the need to rescan.
===Files===
XBMC uses a series of regular expressions to determine the season and episode numbers from the file name.
These are checked in order with the first match being the one used. Anything else included in the file name is ignored.
====Single episode====
In the examples we will use the format ''name''.'''<<pattern>>'''.ext, where ''name'' is the title of the show, and .ext is a [[advancedsettings.xml#.3Cvideoextensions.3E|recognized video file extension]], but only the pattern is important.
There are '''7''' default patterns, the order in which they are checked for by XBMC is included in brackets after each example below (most patterns allow some variation, hence the duplicate numbers).  Use of any other numbering scheme will require you to edit your [[advancedsettings.xml]] (see [[#Using custom file names|below]]).


;Same with three- or four-part TV Show Episode:
All the examples will be read as season 1, episode 2.
:''name''.s01e01-02-03-04.''ext''
;With season
:''name''_[s01]_[e01-02-03-04]_.''ext''
:The most common scenario.
:''name''.1x01.1x02.1x03.1x04.''ext''
:''name''.'''s01e02'''.ext (1)
:''name''.'''s1e2'''.ext (1)
:''name''.'''s01.e02'''.ext (1)
:''name''.'''s01_e02'''.ext (1)
:''name''.'''1x02'''.ext (5)
:''name''.'''102'''.ext (6)
;Without season
:In cases where you only have one season (or are using absolute order in the TVDB scraper), you may want to forego the inclusion of the season number.
:''name''.'''ep02'''.ext (2)
:''name''.'''ep_02'''.ext (2)
:You may also use Roman numerals (I, IV, XI, etc.), often used for mini-series or short documentary series.
:''name''.'''part.II'''.ext (7)
:''name''.'''pt.II'''.ext (7)
:''name''.'''pt_II'''.ext (7)
;By date
:Common for long-running daily shows, you can also use the date the episode aired.
:''name''.'''1996.11.14'''.ext (3)
:''name''.'''1996-11-14'''.ext (3)
:''name''.'''14.11.1996'''.ext (4)
====Multi-episode====
In cases where your file contains more than one episode, you can specify all the episodes included.  Everything after the first found pattern match will be checked for further matches to the same pattern.
;Examples
:''name''.'''s01e01'''.'''s01e02'''.ext
:''name''.'''s01e01'''.''episode1.title''.'''s01e02'''.''episode2.title''.ext
:''name''.'''s01e01'''.'''s01e02'''.'''s01e03'''.ext
:''name''.'''1x01'''_'''1x02'''.ext
:''name''.'''s01e01''' 1x02.ext (mixed patterns do not work)
:''name''.'''ep01'''.'''ep02'''.ext
The remainder will also be checked against a shorter form [[Userdata/advancedsettings.xml#.3Ctvmultipartmatching.3E|multi-episode pattern]].
;Examples
:''name''.'''s01e01e02'''.ext
:''name''.'''s01e01-02-03'''.ext
:''name''.'''1x01x02'''.ext
:''name''.'''ep01_02'''.ext
The '''ex-_''' are fully interchangeable and stackable, e.g. ''name''.'''1x01e02_03-x-04'''.ext is perfectly valid (if somewhat odd). 


;No name
{{Note|Only the episodes in the file name will be added, e.g. ''name''.'''s01e01-03'''.ext will not include episode 2.}}
To emphasize, you can also use any of the above examples with just the season/episode numbers:
====Split-episode====
:101.''ext''
Typical for childrens cartoons, files which only contain a distinct part of an episode may be named as to which part, if the scraper supports it (currently only TVDB using DVD order).
:s01e01.''ext''
;Examples
:01x01.''ext''
:''name''.'''s01e01.1'''.ext
:etc
:''name''.'''s01e01a'''.ext
:''name''.'''1x01.1'''.ext
:''name''.'''1x01a'''.ext
:''name''.'''ep01.1'''.ext
:''name''.'''101.1'''.ext
Up to 9 sub-parts are allowed (using either .1-.9 or a-i).


===Shows without seasons or only one season===
These can also be combined with the multi-episode pattern, if your file contains all parts joined as a single episode.
Single or no season shows, such as anime or many types of one-off series (including miniseries) will not have a season number. To scan in shows like this we use scrapers that support "absolute ordering", such as the [[TheTVDB.com (Video Library)|TVDB.com]] scraper. '''To use this you must change the [[Video_library/Setting_content_and_scanning#TV_show_content_options|scraper settings]] to use the absolute ordering option.''' This setting can be set on individual TV show folders, so that your default settings for all TV shows can support TV show seasons, or vice versa. See [[#DVD order]] for an example of how that would be set up. Absolute ordering can also simply be the default setting for an entire source if all TV shows within that source only have one/no season.
;Examples
:''name''.'''s01e01.1.s01e01.2'''.ext
:''name''.'''1x01.1x01.2'''.ext (note this is (1x01.1)x(01.2) not (1x01).(1x01.2))
:''name''.'''ep01a_01b'''.ext


Naming conventions for absolute order follow similar conventions to normal episodes, but require "ep" rather than just "e" for the episode, and (obviously) do not have a season number.
Each part will be added to the library just with it's full episode number, the sub-part will not be displayed.


;Default episode file naming conventions
{{Note|If you use periods in your file names and include material after the episode number (such as the episode title), you may get a false match to a split-episode pattern if that material begins with a number below 10, e.g.
* '''name -''' As mentioned above, ''name'' is optional and can be after or before the episode number.
:''Nikita''.'''S01E02.2'''.0.mkv
:''name'' ep01.''ext''
:''24''.'''1x02.1'''.00.am-2.00.am.avi
:''name''.ep01.''ext''
:''name''.'''1x01.1'''x'''02'''.ext  (i.e. (1x01.1) x (02) )
:''name'' ep 01.''ext''
This will likely lead to the episode not being added to the library.  The recommendation is to use a space or underscore instead to separate the numbers for those files, e.g.
:''Nikita''.'''S01E02'''_2.0.mkv
:''24''.'''1x02'''_1.00.am-2.00.am.avi
:''name''.'''1x01''' '''1x02'''.ext (i.e. (1x01) (1x02) )
}}
====Special episodes====
Special episodes, if supported by your scraper, should be marked as being season 0.  You should check the site being scraped to see what episode number to use, as they can be fairly arbitrary.  For example, [http://thetvdb.com/?tab=season&seriesid=76736&seasonid=24194&lid=7 BlackAdder's Christmas Carol] should have a file name that matches season 0 episode 3, e.g.:
:''BlackAdder''.'''s00e03'''.BlackAdder's Christmas Carol.mkv
==The TVDB scraper==
The default TV show scraper uses [http://thetvdb.com The TVDB] to scan your TV shows into the library.  You should search on the site before adding a new show to ensure you're using the right title.  Caution should be taken over using aliases or alternative titles, although these will work in a website search, they don't work in the API the scraper uses.


The TVDB scraper has three possible settings for determining episode order: Aired order, DVD order, and Absolute order.  These will affect how you name your files, or vice versa, how you name your files will affect which setting you should use.
;Aired order
:The default, episodes are ordered by season and numbered as they were originally broadcast.  For split-episodes, each part is given it's own distinct episode number.
:Visible when you click on any season link on the show page.
;DVD order
:Episodes are ordered by season and numbered as they appeared on DVD release.  Split-episodes are numbered by episode and sub-part.
:Visible when you click the DVD order link on any season page for the show.
;Absolute order
:Episodes are ordered as a single season and numbered sequentially from start to finish. Split episodes have distinct episode numbers.  Commonly used for anime.
:Visible when you click the Absolute order link on the All seasons page for the show.
For a list of all available settings and their meaning, see [[Add-on:The TVDB]].
==Advanced usage==
===Supplemental tools===
[[File:Therenamer.JPG|right|thumb|500px|theRenamer (available for Windows) allows you to customize the file names in it's settings]]
A variety of [[supplemental tools]] exist to automatically rename files and folders into XBMC compatible formats.
*[[Supplemental tools/Linux#Rename tools|Renaming tools for Linux]]
*[[Supplemental tools/Mac OS X#Rename tools|Renaming tools for Mac OS X]]
*[[Supplemental tools/Windows#Rename tools|Renaming tools for Windows]]
{{-}}
{{-}}
===Changing scraper settings for one show===
A very common situation, when you have one or more shows that require different scraper settings (particularly episode order) to the other shows in your folder, it is possible to change the settings for individual shows.  Just navigate to the show's folder in file view and select Change content from the context menu and then alter the settings from there.  If the files have already been incorrectly added to the library, you will need to refresh the folder (e.g. from the info screen).


==DVD order==
The classic example is Firefly, whose aired order differs greatly from it's DVD order:
In TV Shows with series like '''Firefly''' you can set for instance the main TV Shows and set content to [[TheTVDB.com (Video Library)|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.
# Folder contains a single TV show
# Either to absolute ordering single season or DVD order
# 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.
<pre>
<pre>
TV Shows                   <<TVDB normal Settings all seasons>>
TV Shows                         <<Source folder, Content: TV shows, Scraper: TVDB - default settings>>
   |----TV Show 1
   |----TV Show 1
   |      |----Season 0
   |      |----Season 1
   |            |--Files
   |            |--Files
   |----TV Show 2
   |----TV Show 2
   |      |----Season #
   |      |--Files
  |            |--Files
   |----Firefly                 <<Scraper: TVDB - DVD order>>
   |----Firefly           <<TVDB Settings altered for single season and DVD order or absolute ordering>>
   |      |----1x01.Serenity.ext
   |      |----Files
  |      |----1x02.The Train Job.ext
</pre>
</pre>
===Using custom file names===
It's possible to use custom file names that don't match any of the default patterns by editing your [[advancedsettings.xml]] file to include a [[advancedsettings.xml#.3Ctvshowmatching.3E|tvshowmatching]] tag containing regular expressions.


== Multi-part episodes ==
A tvshowmatching regexp needs up to three capturing groups:
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.
:1 capturing group = episode number (season will default to season 1), no multi-episode matches will be attempted
;This allows for file names such as:
:2 capturing groups = season number + episode number (in that order), no multi-episode matches will be attempted
:showname_s01e01e02e03_s02e01e02
:3 capturing groups = season number + episode number + multi-episode matching part (typically just the remainder of the file name)
:showname.104-05-06-201-02
(A capturing group is essentially a part of the regexp contained inside brackets.)
: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.
To have no season but multi-episode matching, use three groups but leave the first empty.
More information can be found on the [[Import - Export Library#TV Episodes|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.
Date-based regexps are also possible, and are marked by a bydate="true" attribute in the regexp.  These also use three capturing groups, either as year-month-day or day-month-year, the lengths must be exactly 4-2-2 or 2-2-4.


<!--== Multi-file episodes ==
Your custom tvshowmatching regexps can be either checked for before the default set (action="prepend") or after (action="append").  Not including an action will result in only your regexps being tested.  Care should be taken to ensure that the right regexp matches your file names, particularly in regard to the three digit "102" pattern seen [[#single episode|above]].
'''This feature has been temporarily disabled, the plan is to implement it in a better fashion at a future date.'''<br />
The regexps should be grouped together inside a single tvshowmatching tag, although you can use two if you wish to prepend ''and'' append different regexps.
You can stack multiple files into one episode.
For that to be available the [[Videos Settings#Library|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 ==
You can also change the multi-episode matching regexp by including a [[Userdata/advancedsettings.xml#.3Ctvmultipartmatching.3E|tvmultipartmatching]] tag in your advancedsettings.xml (separate from the tvshowmatching tag).  
Special episodes are currently supported with [[TheTVDB.com (Video Library)|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 [http://TheTVDB.com TheTVDB.com]).
There can be only one tvmultipartmatching expression, whatever you use will overwrite the default, so take care to only expand on the default pattern unless you are certain.
;Example
The tvmultipartmatching requires one capturing group for the episode number.
:[http://thetvdb.com/?tab=season&seriesid=76736&seasonid=24194&lid=7 Black Adder's Christmas Carol] should have a file name that matches season 0 episode 3 (e.g. contain s00e03).


<pre>
{{note|For simplicity, the split-episode pattern has been excluded from the examples below.}}
TV Shows
To allow for split-episodes, replace the <code>[0-9]+</code> in the episode capturing group with <code>[0-9]+(?:(?:[a-i]|\.[1-9])(?![0-9]))?</code>
  |----BlackAdder
====Examples====
  |      |----Season 0
A fairly straightforward example to begin.
  |           |--filename.s00e01.tittle.*
;Season ## - Episode ##
  |            |--BlackAdder.s00e03.Blackadder's Christmas Carol.*
:"Season [season#] - Episode [episode#]" anywhere in the file name
  |            |--etc...
:{|
</pre>
|
<source lang="xml">
<tvshowmatching action="prepend">
  <regexp>Season ([0-9]+) - Episode ([0-9]+)([^\\/]*)$</regexp>
</tvshowmatching>
</source>
|}
:'''Example''' : TV Shows\Scrubs\Season 1\Scrubs - '''Season 1 - Episode 01''' - Pilot.avi
:The first two capturing groups should be obvious, the third group <code>([^\\/]*)</code> captures everything up to the end of the file name <code>$</code>, this allows for multi-part file names such as ''name''.'''Season 1 - Episode 01''' - '''Season 1 - Episode 02'''.ext as well as the simpler ''name''.'''Season 1 - Episode 01-02'''.ext


== Tweaking matches ==
''You can also use [[Add-on:XWMM]] to edit library entires from a web browser.''


=== The scraper picks the wrong TV Show ===
The entire file path is passed to the regexps, so care should be taken to ensure the matches can't occur earlier in the path, but this does mean for example, you can capture the season number from a sub-folder name.
You can influence the search by having [[Import - Export Library#Video nfo Files|nfo]] files alongside your media
;\Season #\##
:Season [season#] at the end of the directory name, file name starts with [episode#]
:{|
|
<source lang="xml">
<tvshowmatching action="prepend">
    <regexp>Season[\._ ]([0-9]+)[\\/]([0-9]+)([^\\/]*)$</regexp>
</tvshowmatching>
</source>
|}
:'''Example''' : \Battlestar Galactica (2003)\'''Season 3\01''' - Occupation.avi (Season 3, Episode 1)
:Again we use three groups here to allow for multi-episode, but in this case (obviously) only the shorter multi-episode pattern can occur, e.g.  '''Season 1\01x02''' - Episode title.ext.


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:
For numbering without a season, you should ensure that only the episode number gets matched against and not another number in the title or episode title, or a number as part of a different pattern.
<pre>
; - ## -
\TV Shows\Battlestar Galactica\Season 1\Battlestar Galactica - S01E01.avi (TheTVDB omits the year from the original shows)
:" - [episode#] - " anywhere in the file name
\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
<source lang="xml">
\TV Shows\Cupid 2009\Season 1\Cupid - S01E01.avi
<tvshowmatching action="prepend">
\TV Shows\Doctor Who\Season 1\Doctor Who - S01E01.avi
    <regexp> - ()([0-9]+)((?:-[0-9]+)*) - [^\\/]*$</regexp>
\TV Shows\Doctor Who 2005\Season 1\Doctor Who - S01E01.avi
</tvshowmatching>
\TV Shows\Jericho 1995\Season 1\Jericho - S01E01.avi
</source>
\TV Shows\Jericho 2006\Season 1\Jericho - S01E01.avi
|}
\TV Shows\Knight Rider 1982\Season 1\Knight Rider - S01E01.avi
:'''Example''' : \One Piece\One Piece''' - 099 - '''Spirit of the Fakes! Heart of the Rebel Army, Kamyu!.avi ("Season 1", Episode 99) (Using Absolute order)
\TV Shows\Knight Rider 2008\Season 1\Knight Rider - S01E01.avi
:Here, the first capturing group is left empty, and there is a distinct pattern before and after the episode number to ensure only it gets matched.  Also instead of capturing the remainder of the file name for multi-part matching, we only capturing a single repeating pattern so only a '''- 01-02-03 -''' format will work.
</pre>
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.


<pre>
It's also possible to specify a different default season for without-season regexps.
TV Shows
;\Specials\##
  |----Merlin 2008
:Directory name is Specials, file name starts with [episode#]
  |      |----Season #
:{|
  |            |--Files
|
</pre>
<source lang="xml">
<tvshowmatching action="prepend">
    <regexp defaultseason="0">Specials[\\/]()([0-9]+)([^\\/]*)$</regexp>
</tvshowmatching>
</source>
|}
:'''Example''' : \Firefly\'''Specials\04''' - Browncoats Unite.mkv (Season 0, Episode 4)
:A combination of the previous two examples, allowing special episodes to reside in a "Specials" folder rather than a "Season 0" folder. 


[[File:Therenamer.JPG|right|thumb|500px|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.


{{-}}
The default date-based regexps only allow for periods or hyphens as delimiters...
;<nowiki>####_##_##</nowiki>
:[year]_[month]_[day] anywhere in the file name
:{|
|
<source lang="xml">
<tvshowmatching action="prepend">
    <regexp bydate="true">([0-9]{4})_([0-9]{2})_([0-9]{2})[^\\/]*$</regexp>
</tvshowmatching>
</source>
|}
:'''Example:''' : \The Colbert Report\'''2005_10_17'''.avi
:The exact number of digits is specified for each group to ensure compliance.  A separate [day]_[month]_[year] regexp would be needed if both formats are in use.


=== 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 [[advancedsettings.xml#.3Ctvshowmatching.3E|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.
The default regexps don't allow for DVD folder structures, this can usually be remedied by replacing the final <code>$</code> with <code>(?:(?:[\\/]video_ts)?[\\/]video_ts\.ifo)$</code>
 
;S##E##\VIDEO_TS\VIDEO_TS.IFO
'''\Season #\##''' (Season# is at very end of directory name, and filename starts with episode name, neither have to be a specific number of digits) :
:{|
|
<source lang="xml">
<source lang="xml">
  <tvshowmatching>
  <tvshowmatching action="append">
     <regexp>Season[\._ ]([0-9]+)[\\/]([0-9]+)[^\\/]*</regexp>
     <regexp>[Ss]([0-9]+)[ ._-]*[Ee]([0-9]+)([^\\/]*)(?:(?:[\\/]video_ts)?[\\/]video_ts\.ifo)$</regexp>
  </tvshowmatching>
  </tvshowmatching>
</source>
</source>
'''Example''' : \Battlestar Galactica\Season 3\01 - Occupation.avi (Season 3, Episode 1)
|}
:'''Example:''' \Battlestar Galactica (2003)\The Mini-Series '''S00E01E02'''\VIDEO_TS\VIDEO_TS.IFO
:The VIDEO_TS folder is optional, e.g. '''S01E01'''\VIDEO_TS.IFO will also work.




'''###''' ([season#][episode#] with nothing in between all in filename, assumes episode number is always 2 digits) :  
Similarly for Bluray folder structures, you can replace the final <code>$</code> with <code>(?:(?:[\\/]bdmv)?[\\/]index\.bdmv)$</code>
<source lang="xml">  
;<nowiki>#</nowiki>x##\BDMV\index.bdmv
  <tvshowmatching>
:{|
     <regexp>([0-9]+)([0-9][0-9])[^\\/]*</regexp>
|
<source lang="xml">
  <tvshowmatching action="append">
     <regexp>[\\/\._ \[\(-]([0-9]+)x([0-9]+)([^\\/]*)(?:(?:[\\/]bdmv)?[\\/]index\.bdmv)$</regexp>
  </tvshowmatching>
  </tvshowmatching>
</source>
</source>
'''Example''' : \24\Season 6\601 - 6:00am to 7:00am.avi (Season 6, Episode 1)<br />
|}
'''Example 2''' : \Lost\Season 1\Lost - 101.avi (Season 1, Episode 1)<br />
:With Bluray folders, you'll also run into trouble with the various mpls and m2ts files incorrectly matching other patterns, so you should also exclude all the other folders and files from being scanned:
'''Example 3''' : \24\601 - 6:00am to 7:00am.avi (Season 6, Episode 1)
:{|
|
<source lang="xml">
  <video>
    <excludetvshowsfromscan action="append">
      <regexp>[\\/](auxdata|backup|clipinf|playlist|stream|certificate)[\\/]</regexp>
      <regexp>movieobject\.bdmv</regexp>
    </excludetvshowsfromscan>
  </video>
</source>
|}




'''##x##''' ([season#]x[episode#] all in filename :
Finally, a tvmultipartmatching example.
<source lang="xml">
;S##E##+##
  <tvshowmatching>
:Multiple episode numbers, separated by a + sign
  <regexp>([0-9]+)x([0-9]+)[^\\/]*</regexp>
:{|
</tvshowmatching>
|
</source>
<source lang="xml">
'''Example''' : \Scrubs\Season 1\1x01.Pilot.avi (Season 1, Episode 1)
  <tvmultipartmatching>^[-_EeXx+]+([0-9]+)</tvmultipartmatching>
</source>
|}
:'''Example:''' : \Lost\Lost.'''S01E23+24'''.Exodus.mkv
:In this case we can simply add the + sign to the default symbols, thus preserving the defaults as well.


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
==Troubleshooting==
===The scraper picks the wrong TV Show===
The most common cause for this is that you haven't named the show's folder correctly. Check the site being scraped, and copy the title exactly as it is displayed, including anything in brackets.


'''##x##''' ([season#]x[episode#] all in filename :
If that doesn't solve the issue, or you are unable to change the folder name, you can force a match by adding a [[Import - Export Library#TV Shows 2|tvshow.nfo]] with the url of the show's page on the scraped site.
  <source lang="xml">
===All files are added as a single TV show===
<tvshowmatching>
This may happen if you've set content on the wrong folder, (usually the one above the one containing your TV shows). The telltale sign will be the title of the show everything is added as: "Al '''TV'''", "Genius '''Series'''", etc. The title will be derived from the name of your top-level TV folder.
  <regexp>[0]*([0-9]+)x[0]*([0-9]+)[^\\/]*</regexp>
<pre>
</tvshowmatching>
Videos                          <<Source folder, Content: TV Shows>>
</source>
    |----TV                      <<Scanned as "Al TV">>
'''Example''' : \Scrubs\Season 1\01x01.Pilot.avi (Season 1, Episode 1)
    |    |----TV Show 1        <<Ignored>>
which simply strips leading 0's from the result.
    |    |      |--Files
    |    |----TV Show 2        <<Ignored>>
    |    |      |--Files
</pre>
In these cases, you can either remove the source and re-add the TV shows folder as source, or change the content on the source to None, and then set the content on the correct folder (see examples [[#complex|above]]).
===Some files refuse to be added===
The most obvious cause is that the files are not named correctly and don't match any of the patterns.  In these cases you will need to rename the files, or add a custom tvshowmatching regexp to deal with them.


'''s##e##''' (s[season#]e[episode#] at beginning of filename)
If the files appear to be correctly named, they may instead be matching the ''wrong pattern''. If you use custom tvshowmatching regexps, check carefully the order in which the regexps are being matched alongside the defaults. Also check the note in [[#split-episode|split-episode]] above.
  <source lang="xml">
  <tvshowmatching>
  <regexp>[\\/]s([0-9]+)e([0-9]+)</regexp>
</tvshowmatching>
</source>
'''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)
Another possibility is that this is actually a case of the scraper picking the wrong TV show (the problem may be masked by the use of local artwork or lack of online artwork, although episode titles and plots should be a giveaway). In this situation even correctly named files will not get added if they lie outside the numbering of the incorrect show.
  <source lang="xml">
;Example
<tvshowmatching>
:The show [http://www.thetvdb.com/?tab=series&id=82607&lid=7 Castle] is a six episode documentary series about castles, not the [http://www.thetvdb.com/?tab=series&id=83462 multi-season 2009 crime drama]. Any file numbered s01e07 or higher will not be added if XBMC thinks the latter is the former.
  <regexp>Season ([0-9]+) - Episode ([0-9]+)[^\\/]*</regexp>
</tvshowmatching>
  </source>
'''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:55497|this forum thread]].
<source lang="xml">
<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>
</source>
===Understanding Season Ordering Options===
Please see the thetvdb [[Add-on:The_TVDB#Understanding_Season_Ordering_on_theTVDB.com|scraper settings page]] for information on how to set season ordering correctly ''for each folder'' to match your naming.<br />




[[Category:Video]]
[[Category:Video]]
[[Category:XBMC Manual]]
[[Category:XBMC Manual]]

Revision as of 09:21, 13 February 2013

Adding videos to the library/Contents

Adding videos to the library/Naming files

Naming

Library.videos.tvshowsfanart.WSCR.jpg

XBMC will use the folder name to determine the name of the show being scanned, and will only use the file name to determine the season and episode number.

The folder name will be cleaned of commonly used strings, such as DVDRip, 1080p, x264, etc. before being passed to the scraper. If the year of release is included, this will be extracted and used by the scraper to assist in making a match.

Spaces, periods, or underscores may be used to separate words in the folder and file names, but shouldn't be mixed in the same folder name. Note also the caution below regarding file names with periods.

Note: Flat structures with files for different shows in a single directory are not supported.

Directories

Library.videos.tvshowinfo.WSCR.jpg

You must set the content to TV Shows on the directory directly above the individual show folders. To ensure accurate matches for your TV shows, the folder names should match the title displayed on the site being scraped. For the default TVDB scraper this may mean including the year of release, e.g. Castle (2009) (in cases of duplicate titles), or the country of origin, e.g. Being Human (US) (in cases of foreign remakes).

Below the show folder, the files may be organized how you wish, e.g. into separate season folders, or by year. These folders will be ignored.

Simple

Typically, you will add the top-level directory as a source and set the content to TV shows when you add it.

Example
TV Shows                  <<Source folder, Content: TV shows>>
   |----TV Show 1
   |       |----Season #
   |            |--Files
   |----TV Show 2 (year)
   |       |--Files
   |----TV Show 3
   |       |----2008
   |            |--Files

Complex

In more complex situations where your top-level directory is further sub-divided before the show folders, you can add the top-level as source but not set the content, and then set the content to TV shows on each sub-folder.

Example
TV Shows                  <<Source folder, Content: None>>
   |----A-M               <<Content: TV shows>>
   |      |----TV Show 1
   |              |--Files
   |----N-Z               <<Content: TV shows>>
   |      |----TV Show 2
   |              |--Files

It's also possible to have a sub-folder group multiple shows together in an otherwise normal directory structure. Just change the content on the sub-folder and de-select the "Selected folder contains a single TV show" setting.

Example
TV Shows                  <<Source folder, Content: TV shows>>
   |----TV Show 1
   |       |----Season #
   |            |--Files
   |----Star Trek Series  <<Content:TV shows>>
   |       |----Star Trek
   |       |       |--Files
   |       |----Star Trek The Next Generation
   |               |--Files

In these cases, it's best to refrain from scanning the files into the library until the content is set correctly for all folders, to avoid incorrect results and the need to rescan.

Files

XBMC uses a series of regular expressions to determine the season and episode numbers from the file name. These are checked in order with the first match being the one used. Anything else included in the file name is ignored.

Single episode

In the examples we will use the format name.<<pattern>>.ext, where name is the title of the show, and .ext is a recognized video file extension, but only the pattern is important. There are 7 default patterns, the order in which they are checked for by XBMC is included in brackets after each example below (most patterns allow some variation, hence the duplicate numbers). Use of any other numbering scheme will require you to edit your advancedsettings.xml (see below).

All the examples will be read as season 1, episode 2.

With season
The most common scenario.
name.s01e02.ext (1)
name.s1e2.ext (1)
name.s01.e02.ext (1)
name.s01_e02.ext (1)
name.1x02.ext (5)
name.102.ext (6)
Without season
In cases where you only have one season (or are using absolute order in the TVDB scraper), you may want to forego the inclusion of the season number.
name.ep02.ext (2)
name.ep_02.ext (2)
You may also use Roman numerals (I, IV, XI, etc.), often used for mini-series or short documentary series.
name.part.II.ext (7)
name.pt.II.ext (7)
name.pt_II.ext (7)
By date
Common for long-running daily shows, you can also use the date the episode aired.
name.1996.11.14.ext (3)
name.1996-11-14.ext (3)
name.14.11.1996.ext (4)

Multi-episode

In cases where your file contains more than one episode, you can specify all the episodes included. Everything after the first found pattern match will be checked for further matches to the same pattern.

Examples
name.s01e01.s01e02.ext
name.s01e01.episode1.title.s01e02.episode2.title.ext
name.s01e01.s01e02.s01e03.ext
name.1x01_1x02.ext
name.s01e01 1x02.ext (mixed patterns do not work)
name.ep01.ep02.ext

The remainder will also be checked against a shorter form multi-episode pattern.

Examples
name.s01e01e02.ext
name.s01e01-02-03.ext
name.1x01x02.ext
name.ep01_02.ext

The ex-_ are fully interchangeable and stackable, e.g. name.1x01e02_03-x-04.ext is perfectly valid (if somewhat odd).

Note: Only the episodes in the file name will be added, e.g. name.s01e01-03.ext will not include episode 2.

Split-episode

Typical for childrens cartoons, files which only contain a distinct part of an episode may be named as to which part, if the scraper supports it (currently only TVDB using DVD order).

Examples
name.s01e01.1.ext
name.s01e01a.ext
name.1x01.1.ext
name.1x01a.ext
name.ep01.1.ext
name.101.1.ext

Up to 9 sub-parts are allowed (using either .1-.9 or a-i).

These can also be combined with the multi-episode pattern, if your file contains all parts joined as a single episode.

Examples
name.s01e01.1.s01e01.2.ext
name.1x01.1x01.2.ext (note this is (1x01.1)x(01.2) not (1x01).(1x01.2))
name.ep01a_01b.ext

Each part will be added to the library just with it's full episode number, the sub-part will not be displayed.

Note: If you use periods in your file names and include material after the episode number (such as the episode title), you may get a false match to a split-episode pattern if that material begins with a number below 10, e.g.

Nikita.S01E02.2.0.mkv
24.1x02.1.00.am-2.00.am.avi
name.1x01.1x02.ext (i.e. (1x01.1) x (02) )

This will likely lead to the episode not being added to the library. The recommendation is to use a space or underscore instead to separate the numbers for those files, e.g.

Nikita.S01E02_2.0.mkv
24.1x02_1.00.am-2.00.am.avi
name.1x01 1x02.ext (i.e. (1x01) (1x02) )

Special episodes

Special episodes, if supported by your scraper, should be marked as being season 0. You should check the site being scraped to see what episode number to use, as they can be fairly arbitrary. For example, BlackAdder's Christmas Carol should have a file name that matches season 0 episode 3, e.g.:

BlackAdder.s00e03.BlackAdder's Christmas Carol.mkv

The TVDB scraper

The default TV show scraper uses The TVDB to scan your TV shows into the library. You should search on the site before adding a new show to ensure you're using the right title. Caution should be taken over using aliases or alternative titles, although these will work in a website search, they don't work in the API the scraper uses.

The TVDB scraper has three possible settings for determining episode order: Aired order, DVD order, and Absolute order. These will affect how you name your files, or vice versa, how you name your files will affect which setting you should use.

Aired order
The default, episodes are ordered by season and numbered as they were originally broadcast. For split-episodes, each part is given it's own distinct episode number.
Visible when you click on any season link on the show page.
DVD order
Episodes are ordered by season and numbered as they appeared on DVD release. Split-episodes are numbered by episode and sub-part.
Visible when you click the DVD order link on any season page for the show.
Absolute order
Episodes are ordered as a single season and numbered sequentially from start to finish. Split episodes have distinct episode numbers. Commonly used for anime.
Visible when you click the Absolute order link on the All seasons page for the show.

For a list of all available settings and their meaning, see Add-on:The TVDB.

Advanced usage

Supplemental tools

theRenamer (available for Windows) allows you to customize the file names in it's settings

A variety of supplemental tools exist to automatically rename files and folders into XBMC compatible formats.


Changing scraper settings for one show

A very common situation, when you have one or more shows that require different scraper settings (particularly episode order) to the other shows in your folder, it is possible to change the settings for individual shows. Just navigate to the show's folder in file view and select Change content from the context menu and then alter the settings from there. If the files have already been incorrectly added to the library, you will need to refresh the folder (e.g. from the info screen).

The classic example is Firefly, whose aired order differs greatly from it's DVD order:

TV Shows                         <<Source folder, Content: TV shows, Scraper: TVDB - default settings>>
   |----TV Show 1
   |       |----Season 1
   |            |--Files
   |----TV Show 2
   |       |--Files
   |----Firefly                  <<Scraper: TVDB - DVD order>>
   |       |----1x01.Serenity.ext
   |       |----1x02.The Train Job.ext

Using custom file names

It's possible to use custom file names that don't match any of the default patterns by editing your advancedsettings.xml file to include a tvshowmatching tag containing regular expressions.

A tvshowmatching regexp needs up to three capturing groups:

1 capturing group = episode number (season will default to season 1), no multi-episode matches will be attempted
2 capturing groups = season number + episode number (in that order), no multi-episode matches will be attempted
3 capturing groups = season number + episode number + multi-episode matching part (typically just the remainder of the file name)

(A capturing group is essentially a part of the regexp contained inside brackets.)

To have no season but multi-episode matching, use three groups but leave the first empty.

Date-based regexps are also possible, and are marked by a bydate="true" attribute in the regexp. These also use three capturing groups, either as year-month-day or day-month-year, the lengths must be exactly 4-2-2 or 2-2-4.

Your custom tvshowmatching regexps can be either checked for before the default set (action="prepend") or after (action="append"). Not including an action will result in only your regexps being tested. Care should be taken to ensure that the right regexp matches your file names, particularly in regard to the three digit "102" pattern seen above. The regexps should be grouped together inside a single tvshowmatching tag, although you can use two if you wish to prepend and append different regexps.

You can also change the multi-episode matching regexp by including a tvmultipartmatching tag in your advancedsettings.xml (separate from the tvshowmatching tag). There can be only one tvmultipartmatching expression, whatever you use will overwrite the default, so take care to only expand on the default pattern unless you are certain. The tvmultipartmatching requires one capturing group for the episode number.

Note: For simplicity, the split-episode pattern has been excluded from the examples below. To allow for split-episodes, replace the [0-9]+ in the episode capturing group with [0-9]+(?:(?:[a-i]|\.[1-9])(?![0-9]))?

Examples

A fairly straightforward example to begin.

Season ## - Episode ##
"Season [season#] - Episode [episode#]" anywhere in the file name
 <tvshowmatching action="prepend">
   <regexp>Season ([0-9]+) - Episode ([0-9]+)([^\\/]*)$</regexp>
 </tvshowmatching>
Example : TV Shows\Scrubs\Season 1\Scrubs - Season 1 - Episode 01 - Pilot.avi
The first two capturing groups should be obvious, the third group ([^\\/]*) captures everything up to the end of the file name $, this allows for multi-part file names such as name.Season 1 - Episode 01 - Season 1 - Episode 02.ext as well as the simpler name.Season 1 - Episode 01-02.ext


The entire file path is passed to the regexps, so care should be taken to ensure the matches can't occur earlier in the path, but this does mean for example, you can capture the season number from a sub-folder name.

\Season #\##
Season [season#] at the end of the directory name, file name starts with [episode#]
 <tvshowmatching action="prepend">
     <regexp>Season[\._ ]([0-9]+)[\\/]([0-9]+)([^\\/]*)$</regexp>
 </tvshowmatching>
Example : \Battlestar Galactica (2003)\Season 3\01 - Occupation.avi (Season 3, Episode 1)
Again we use three groups here to allow for multi-episode, but in this case (obviously) only the shorter multi-episode pattern can occur, e.g. Season 1\01x02 - Episode title.ext.


For numbering without a season, you should ensure that only the episode number gets matched against and not another number in the title or episode title, or a number as part of a different pattern.

- ## -
" - [episode#] - " anywhere in the file name
 <tvshowmatching action="prepend">
     <regexp> - ()([0-9]+)((?:-[0-9]+)*) - [^\\/]*$</regexp>
 </tvshowmatching>
Example : \One Piece\One Piece - 099 - Spirit of the Fakes! Heart of the Rebel Army, Kamyu!.avi ("Season 1", Episode 99) (Using Absolute order)
Here, the first capturing group is left empty, and there is a distinct pattern before and after the episode number to ensure only it gets matched. Also instead of capturing the remainder of the file name for multi-part matching, we only capturing a single repeating pattern so only a - 01-02-03 - format will work.


It's also possible to specify a different default season for without-season regexps.

\Specials\##
Directory name is Specials, file name starts with [episode#]
 <tvshowmatching action="prepend">
     <regexp defaultseason="0">Specials[\\/]()([0-9]+)([^\\/]*)$</regexp>
 </tvshowmatching>
Example : \Firefly\Specials\04 - Browncoats Unite.mkv (Season 0, Episode 4)
A combination of the previous two examples, allowing special episodes to reside in a "Specials" folder rather than a "Season 0" folder.


The default date-based regexps only allow for periods or hyphens as delimiters...

####_##_##
[year]_[month]_[day] anywhere in the file name
 <tvshowmatching action="prepend">
     <regexp bydate="true">([0-9]{4})_([0-9]{2})_([0-9]{2})[^\\/]*$</regexp>
 </tvshowmatching>
Example: : \The Colbert Report\2005_10_17.avi
The exact number of digits is specified for each group to ensure compliance. A separate [day]_[month]_[year] regexp would be needed if both formats are in use.


The default regexps don't allow for DVD folder structures, this can usually be remedied by replacing the final $ with (?:(?:[\\/]video_ts)?[\\/]video_ts\.ifo)$

S##E##\VIDEO_TS\VIDEO_TS.IFO
 <tvshowmatching action="append">
     <regexp>[Ss]([0-9]+)[ ._-]*[Ee]([0-9]+)([^\\/]*)(?:(?:[\\/]video_ts)?[\\/]video_ts\.ifo)$</regexp>
 </tvshowmatching>
Example: \Battlestar Galactica (2003)\The Mini-Series S00E01E02\VIDEO_TS\VIDEO_TS.IFO
The VIDEO_TS folder is optional, e.g. S01E01\VIDEO_TS.IFO will also work.


Similarly for Bluray folder structures, you can replace the final $ with (?:(?:[\\/]bdmv)?[\\/]index\.bdmv)$

#x##\BDMV\index.bdmv
 <tvshowmatching action="append">
     <regexp>[\\/\._ \[\(-]([0-9]+)x([0-9]+)([^\\/]*)(?:(?:[\\/]bdmv)?[\\/]index\.bdmv)$</regexp>
 </tvshowmatching>
With Bluray folders, you'll also run into trouble with the various mpls and m2ts files incorrectly matching other patterns, so you should also exclude all the other folders and files from being scanned:
  <video>
    <excludetvshowsfromscan action="append">
      <regexp>[\\/](auxdata|backup|clipinf|playlist|stream|certificate)[\\/]</regexp>
      <regexp>movieobject\.bdmv</regexp>
    </excludetvshowsfromscan>
  </video>


Finally, a tvmultipartmatching example.

S##E##+##
Multiple episode numbers, separated by a + sign
 <tvmultipartmatching>^[-_EeXx+]+([0-9]+)</tvmultipartmatching>
Example: : \Lost\Lost.S01E23+24.Exodus.mkv
In this case we can simply add the + sign to the default symbols, thus preserving the defaults as well.

Troubleshooting

The scraper picks the wrong TV Show

The most common cause for this is that you haven't named the show's folder correctly. Check the site being scraped, and copy the title exactly as it is displayed, including anything in brackets.

If that doesn't solve the issue, or you are unable to change the folder name, you can force a match by adding a tvshow.nfo with the url of the show's page on the scraped site.

All files are added as a single TV show

This may happen if you've set content on the wrong folder, (usually the one above the one containing your TV shows). The telltale sign will be the title of the show everything is added as: "Al TV", "Genius Series", etc. The title will be derived from the name of your top-level TV folder.

Videos                           <<Source folder, Content: TV Shows>>
    |----TV                      <<Scanned as "Al TV">>
    |     |----TV Show 1         <<Ignored>>
    |     |       |--Files
    |     |----TV Show 2         <<Ignored>>
    |     |       |--Files

In these cases, you can either remove the source and re-add the TV shows folder as source, or change the content on the source to None, and then set the content on the correct folder (see examples above).

Some files refuse to be added

The most obvious cause is that the files are not named correctly and don't match any of the patterns. In these cases you will need to rename the files, or add a custom tvshowmatching regexp to deal with them.

If the files appear to be correctly named, they may instead be matching the wrong pattern. If you use custom tvshowmatching regexps, check carefully the order in which the regexps are being matched alongside the defaults. Also check the note in split-episode above.

Another possibility is that this is actually a case of the scraper picking the wrong TV show (the problem may be masked by the use of local artwork or lack of online artwork, although episode titles and plots should be a giveaway). In this situation even correctly named files will not get added if they lie outside the numbering of the incorrect show.

Example
The show Castle is a six episode documentary series about castles, not the multi-season 2009 crime drama. Any file numbered s01e07 or higher will not be added if XBMC thinks the latter is the former.