Naming video files/TV shows

XBMC requires each TV show to be in its own folder, and for each file to contain a pattern from which XBMC can determine the season and episode number (e.g. "S01E01").


 * Folder name = Show title
 * File name = Season/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.

Directories
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                 <  in the episode capturing group with

Examples
A fairly straightforward example to begin.
 * Season ## - Episode ##
 * "Season [season#] - Episode [episode#]" anywhere in the file name


 * }
 * 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#]


 * }
 * 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
 * " - [episode#] - " anywhere in the file name


 * }
 * 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#]


 * }
 * 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


 * }
 * 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
 * S##E##\VIDEO_TS\VIDEO_TS.IFO


 * }
 * 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
 * # x##\BDMV\index.bdmv


 * }
 * 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:


 * }

Finally, a tvmultipartmatching example.
 * S##E##+##
 * Multiple episode numbers, separated by a + sign


 * }
 * 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.

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                          <> |TV                     <> |    |TV Show 1         <> |    |       |--Files |    |TV Show 2         <> |    |       |--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.

A fourth cause can be that you've different season listings than the scraper you're using. E.g. your season one is S1E01-S1E20 while according to the scraper E17-20 belongs to season two. The scraper will then add E1-16 to season one, the rest won't get scraped.

To fix this you can:
 * Use a different scraper. The TV addon XEM allows you to choose use between four different sources.
 * Create NFO files for the TV show.
 * If you still want to add the TV show with the scraper that has different listings than you, check the scraper site and rename/move your files according to its listings.