Kodi Community Forum
Extra REGEX for TV Show Episode matching - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Tips, tricks, and step by step guides (https://forum.kodi.tv/forumdisplay.php?fid=110)
+--- Thread: Extra REGEX for TV Show Episode matching (/showthread.php?tid=51614)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26


RE: Extra REGEX for TV Show Episode matching - kwanbis - 2013-02-11

(2013-02-11, 10:22)scudlee Wrote: 1x10 isn't found because of the .7 immediately after the episode number:

Speaking of episode titles... The reason season 2 isn't included should become apparent if you compare the file names to the titles being scraped.
Thanks scudle for the s01e10 comment.

Now, I can not seem to understand what is the problem with the season 2 episodes:

21:09:33 T:3796 DEBUG: VideoInfoScanner: No NFO file found. Using title search for 'W:\Once Upon A Time\Once.Upon.A.Time.S02e01.Broken.720p.Webdl.mkv'
21:09:33 T:3796 DEBUG: VIDEO::CVideoInfoScanner::OnProcessSeriesFolder - no match for show: 'Once Upon A Time', season: 2, episode: 1.0, airdate: '01/01/1601', title: ''

The S02 episodes are the same as the S01, the only difference is that it includes the 720p text.

It is weird that is looking for anairdate 01/01/1601, but I do not know why is that happening.


RE: Extra REGEX for TV Show Episode matching - scudlee - 2013-02-11

Sorry, I was being a little facetious. I meant if you compare the file name of a file that scraped to the episode title that it shows up as in XBMC, you'd notice a discrepancy. e.g.

once.upon.a.time.s01e03.snow.falls.webdl.mkv is scanned in as 1x3. Katy No Pocket (i.e. not 1x3. Snow Falls).

This is because the series is being picked up as Once Upon a Time, and not Once Upon a Time (2011). The earlier series only had one season, so none of the second season episodes will be scanned.

To fix it you just need to add the "(2011)" to the folder name.


RE: Extra REGEX for TV Show Episode matching - kwanbis - 2013-02-11

(2013-02-11, 20:59)scudlee Wrote: To fix it you just need to add the "(2011)" to the folder name.
That was it! Perfect. I decided to remove all the titles from my episodes, as in any case, XBMC would add them for me. Thanks!


RE: Extra REGEX for TV Show Episode matching - Kinematics - 2013-02-12

Been spending today working on getting proper regexes for anime. Seems to be solid, and mostly complete. Posting here in case it can help anyone else.

The example files were each tested against the regex to make sure they work. At the moment, every anime TV show I have is properly matched, aside from a few multi-episode files.

Aside: The docs on how multiple episodes per files work (and how the regex is constructed for them) is rather vague, so I just left that out since I couldn't get it to work right. If someone has suggestions, I'd appreciate it.


Fully commented version:
Code:
<advancedsettings>
    <tvshowmatching action="prepend">
        <!-- Regex info: -->
        <!-- First capturing match is assigned to the season.  Second capturing match is assigned to the episode. -->
        <!-- (?i) turns on case-insensitive matching -->
        <!-- (?:stuff) is a non-capturing group for 'stuff', so as not to interfere with season/episode numbers. -->

        <!-- Anime specific matching. -->
        
        <!--
        Building the regex from back to front:
        
        Closing checksum (optionally followed by random text, but we don't have to match that) contained in (), {} or [].
        Preceded by any number of bracketed items of any sort of content, with possible spacing, dashes or underscores in between
        Possibly preceded by unbracketed text. Make sure it doesn't find episode numbers inside brackets.
        Preceded by the episode number (optionally labelled), with possible version number
        Preceded by various combinations of dash, dot, underscore or space, to separate the title from the episode number
        Possibly preceded by a season number, or 'Special' or 'OVA'
        -->
        
        <!-- Regexes listed in order of match preference -->
        <!-- The regexes in the prepend set are anchored to checksums, so should be checked before normal Kodi defaults. -->
        
        <!-- For reference, this is the regex containing everything from the episode number onwards.  It will be the same for all regexes in this section. -->
        
        <!-- <regexp>(?:[ _.-]*(?:ep?[ .]?)?(\d{1,3})(?:[_ ]?v\d+)?)+(?=\b|_)[^])}]*?(?:[[({][^])}]+[])}][ _.-]*)*?(?:[[({][\da-f]{8}[])}])</regexp> -->
        
        <!-- First check if we have an explicit season directory. -->
        
        <!-- Inside a directory that specifies the season.  May include any number of subdirectories.  Doesn't try to find season markers in the file name. -->
        <!-- EG: Saki/Season 1/Saki [Jarzka]/[Jarzka] Saki 01 - Encounter [480p 10bit DVD FLAC] [9EED32CB] -->
        <!-- EG: Saki/Season 3/[Underwater-FFF] Saki Zenkoku-hen - The Nationals - 01 (720p) [AF65724D] -->

        <regexp>(?i)[\\/](?:S(?:eason)?\s*(?=\d))?(Specials|\d{1,3})[\\/](?:[^\\/]+[\\/])*[^\\/]+(?:\b|_)(?:[ _.-]*(?:ep?[ .]?)?(\d{1,3})(?:[_ ]?v\d+)?)+(?=\b|_)[^])}]*?(?:[[({][^])}]+[])}][ _.-]*)*?(?:[[({][\da-f]{8}[])}])</regexp>
        
        <!-- Include season marker in the filename. -->
        <!-- EG: [CoalGuys] K-ON!! S2 - 05 [4B19B10F] -->
        
        <regexp>(?i)[-._ ]+S(?:eason ?)?(\d{1,3})(?:[ _.-]*(?:ep?[ .]?)?(\d{1,3})(?:[_ ]?v\d+)?)+(?=\b|_)[^])}]*?(?:[[({][^])}]+[])}][ _.-]*)*?(?:[[({][\da-f]{8}[])}])</regexp>


        <!-- Test for a Special/OVA/OAV/etc marker, which is interpreted as Season 0 by XBMC. -->
        <!-- If none is found, it will default to an empty string, which sets the file to season 1. -->
        
        <!-- EG: [SHiN-gx] Fight Ippatsu! Juuden-chan!! - Special 1 [DVD][720x480 AR h.264 FLAC][v2][FF09021F].mkv -->
        <!-- EG: [gleam] Kurenai OVA - 01 [OAD][0e73f000].mkv -->
        <!-- EG: [Jarzka] Saki Picture Drama 1 [480p 10bit DVD FLAC] [BA3CE364] -->
        <!-- EG: [avatar-nyanko] Koikoi 7 - 01 (DVD) [5E95FA4A] -->
        <!-- EG: [gg]_Chuunibyou_Demo_Koi_ga_Shitai!_-_01_[5B6EFD1F] -->
        <!-- EG: [Eclipse] Akane-iro ni Somaru Saka - 01 (1024x576 h264) [39920E63].mkv -->
        <!-- EG: [gg]_Bakemonogatari_-_01_[CC0CF5D2].mkv -->
        <!-- EG: [Doki]_Asobi_ni_Iku_yo!_-_03v2_(1280x720_h264_AAC)_[B5B9C6F3].mkv -->
        <!-- EG: [Coalgirls]_Yuru_Yuri_02_(1280x720_Blu-Ray_FLAC)_[43E5A6B4] -->
        <!-- EG: Touch 01(DVD) - (112ceb61) Central Anime  -->
        <!-- EG: Cross Game 02 - Central Anime (1280x720) [BF23052D].mp4 -->
        <!-- EG: [Taka]_Naruto_Shippuuden_135_[480p][9073B8C2] -->

        <regexp>(?i)(Special|SP|OVA|OAV|Picture Drama|(?=\b|_))(?:[ _.-]*(?:ep?[ .]?)?(\d{1,3})(?:[_ ]?v\d+)?)+(?=\b|_)[^])}]*?(?:[[({][^])}]+[])}][ _.-]*)*?(?:[[({][\da-f]{8}[])}])</regexp>
        
        <!-- Multipart episode handling is still uncertain. (?:-(\d{1,3}))? -->
        <!-- EG: [Triad]_Dokuro-chan_-_01-02 [12345678].mkv -->

    </tvshowmatching>
    
    <tvshowmatching action="append">
        <!-- Alternate version that does not include checksums. Put this after normal XBMC patterns. -->
        <!-- Since it doesn't use the checksum anchor, need to make sure it's not a directory name. -->

        <!-- For reference, this is the regex containing everything from the episode number onwards.  It will be the same for all regexes in this section. -->
        
        <!-- <regexp>(?:[ _.-]*(?:ep?[ .]?)?(\d{1,3})(?:[_ ]?v\d+)?)+(?=\b|_)[^])}]*?(?:[[({][^])}]+[])}][ _.-]*)*?[^][)(}{\\/]*$</regexp> -->


        <!-- Inside a directory that specifies the season. -->
        <!-- EG: Saki/Season 2/[HorribleSubs] Saki Episode of Side A - 14 [720p] -->

        <regexp>(?i)[\\/](?:S(?:eason)?\s*(?=\d))?(Specials|\d{1,3})[\\/](?:[^\\/]+[\\/])*[^\\/]+(?:\b|_)[ _.-]*(?:ep?[ .]?)?(\d{1,3})(?:[_ ]?v\d+)?(?:\b|_)[^])}]*?(?:[[({][^])}]+[])}][ _.-]*)*?[^][)(}{\\/]*?$</regexp>

        <!-- Include season marker in the filename. -->
        <!-- EG: [DeadFish] Toaru Kagaku no Railgun S - S2 - 01 [720p][AAC].mp4 -->
      
        <regexp>(?i)[-._ ]+S(?:eason ?)?(\d{1,3})(?:[ _.-]*(?:ep?[ .]?)?(\d{1,3})(?:[_ ]?v\d+)?)+(?=\b|_)[^])}]*?(?:[[({][^])}]+[])}][ _.-]*)*?[^][)(}{\\/]*$</regexp>

        
        <!-- EG: [a.f.k.] Lucky Star - 01.avi -->
        <!-- EG: Air Master - 04 [HQA&N!].avi -->
        <!-- EG: [ANE] Yosuga no Sora - Ep01v2 [BDRip 1080p x264 FLAC] -->
        <!-- EG: [DeadFish] Jinrui wa Suitai Shimashita - Special 01 [BD][720p][AAC].mp4 -->

        <regexp>(?i)(Special|SP|OVA|OAV|Picture Drama|(?=\b|_))(?:[ _.-]*(?:ep?[ .]?)?(\d{1,3})(?:[_ ]?v\d+)?)+(?=\b|_)[^])}]*?(?:[[({][^])}]+[])}][ _.-]*)*?[^][)(}{\\/]*$</regexp>

    </tvshowmatching>
</advancedsettings>

Edit: Updated regexes


RE: Extra REGEX for TV Show Episode matching - gahenna - 2013-02-24

I have been trying to get XBMC to scrape the shows I have without manually adding the nfo's with no sucess. I have TheRenamer put the files in the format Show/Show.s01e01.name.mkv. I have read through the REGEX that you have been posting and I'm not sure how it will help in me. They seem to help if you keep the files in a format other than the preferred XBMC formats.
Q1. Is there a format I can use that will allow the XBMC scraper to actually do it's job?

Q2. Is there a way I can set up the code to direct certain files to certain shows? Eg. Recognize the show format as Once Upon a Time and start scraping on that?

I have attached my debug code below. pastebin

Thank you


RE: Extra REGEX for TV Show Episode matching - scudlee - 2013-02-24

According to your log, you have a tvshow.nfo file (containing xml) in the Once Upon a Time (2011), but it doesn't have an <episodeguide> tag in it. All your episodes are being enumerated correctly, but without the episodeguide URL, there's nothing to match them against.

Delete the tvshow.nfo and everything should work.


RE: Extra REGEX for TV Show Episode matching - gahenna - 2013-02-24

So by having Ember Media scrape some episodes I am doing a disservice to my media? XBMC should handle it all or have it all handled 3rd party?


RE: Extra REGEX for TV Show Episode matching - jenkins - 2013-04-17

Hi!

I know this is old stuff but i was wondering if it is possible to have one folder full of tvshow files?

like:
MyTVShows/some.serie.bla.SxxExx.bla.mkv
MyTVShows/some.other.serie.bla.SxxExx.bla.mkv

do some one know of a way to do this?


RE: Extra REGEX for TV Show Episode matching - vandark - 2013-04-28

hello my series located in a remote ftp server in movies not have a problem but in tv shows the scrappers not recognice the foders and not work correctly ( im tested xem and theTVDB)

the sctructure is:

Tv Shows/_seasons_completes_/The.serie.example.s01.complete.blabhah.2008.blablah/The.serie.example.s01e01..blabhah.720p.blablah/blahblah.the.serie.s01e01.720p.mkv


if I give right click and obtain information from the TV series and manually put the name of the TV series if I updated everything inside that folder correctly.

the problem is that all folders in the series instead of putting a space put a point. (.)

If I put the number with spaces works well


RE: Extra REGEX for TV Show Episode matching - vandark - 2013-05-01

in advancedsettings.xml

<advancedsettings>
<video>
<cleanstrings>
<regexp>[ \,\.\(\)\[\]\-](spanish|[Ss]([0-9]+)[\.\-]?[Ee]([0-9]+)|\[.*\])([ \,\.\(\)\[\]\-]|$)</regexp>
<regexp>(\[.*\])</regexp>
</cleanstrings>
</video>
</advancedsettings>


tvshows in the folder ftp://series scan correcty and works great

but

the tv shows in ftp://_seasons.completes./ dont scan and not working correctly around the 90% fault on detecting tv shows,


any iddea ??

HELP!!!!


RE: Extra REGEX for TV Show Episode matching - vandark - 2013-05-01

this is the log for help.

23:49:23 T:2866803776 DEBUG: scraper: CreateSearchUrl returned <url cache="cache-crimen.en.el.paraiso.s01.xml">http://www.thetvdb.com/api/GetSeries.php?seriesname=crimen.en.el.paraiso.s01&amp;language=es</url>
23:49:23 T:2866803776 DEBUG: CurlFile::Open(0xa8312a78) http://www.thetvdb.com/api/GetSeries.php?seriesname=crimen.en.el.paraiso.s01&language=es
23:49:23 T:2866803776 DEBUG: scraper: GetSearchResults returned <?xml version="1.0" encoding="utf-8" standalone="yes"?><results></results>
23:49:23 T:2866803776 WARNING: No information found for item 'ftp://user:pass@ftpserver/SERIES/_Temporadas.Completas_/Crimen.En.El.Paraiso.S01.SPANiSH.720p.HDTV.x264-XPERT_HD/', it won't be added to the library.
23:49:24 T:2866803776 DEBUG: VideoInfoScanner: No NFO file found. Using title search for 'ftp://user:pass@ftpserver/SERIES/_Temporadas.Completas_/Cronicas.Vampiricas.S03.SPANiSH.720p.HDTV.x264-sPHD/'
23:49:24 T:2866803776 DEBUG: FindMovie: Searching for 'Cronicas Vampiricas S03' using XEM scraper (path: '/home/pi/.xbmc/addons/metadata.thexem.de', content: 'tvshows', version: '1.0.5')
23:49:24 T:2866803776 DEBUG: scraper: CreateSearchUrl returned <url cache="cache-cronicas%20vampiricas%20s03.xml">http://www.thetvdb.com/api/GetSeries.php?seriesname=cronicas%20vampiricas%20s03&amp;language=es</url>
23:49:24 T:2866803776 DEBUG: CurlFile::Open(0xa262e3e0) http://www.thetvdb.com/api/GetSeries.php?seriesname=cronicas%20vampiricas%20s03&language=es
23:49:25 T:2866803776 DEBUG: scraper: GetSearchResults returned <?xml version="1.0" encoding="utf-8" standalone="yes"?><results></results>
23:49:25 T:2866803776 DEBUG: FindMovie: Searching for 'Cronicas.Vampiricas.S03' using XEM scraper (path: '/home/pi/.xbmc/addons/metadata.thexem.de', content: 'tvshows', version: '1.0.5')
23:49:25 T:2866803776 DEBUG: scraper: CreateSearchUrl returned <url cache="cache-cronicas.vampiricas.s03.xml">http://www.thetvdb.com/api/GetSeries.php?seriesname=cronicas.vampiricas.s03&amp;language=es</url>
23:49:25 T:2866803776 DEBUG: CurlFile::Open(0xa262e3e0) http://www.thetvdb.com/api/GetSeries.php?seriesname=cronicas.vampiricas.s03&language=es
23:49:25 T:2866803776 DEBUG: scraper: GetSearchResults returned <?xml version="1.0" encoding="utf-8" standalone="yes"?><results></results>
23:49:25 T:2866803776 WARNING: No information found for item 'ftp://user:pass@ftpserver/SERIES/_Temporadas.Completas_/Cronicas.Vampiricas.S03.SPANiSH.720p.HDTV.x264-sPHD/', it won't be added to the library.
23:49:26 T:2866803776 DEBUG: VideoInfoScanner: No NFO file found. Using title search for 'ftp://user:pass@ftpserver/SERIES/_Temporadas.Completas_/Cuentame.Como.Paso.S13.SPANISH.720p.HDTV.x264-sPHD/'
23:49:26 T:2866803776 DEBUG: FindMovie: Searching for 'Cuentame Como Paso S13' using XEM scraper (path: '/home/pi/.xbmc/addons/metadata.thexem.de', content: 'tvshows', version: '1.0.5')


RE: Extra REGEX for TV Show Episode matching - MasterCATZ - 2013-06-23

<regexp>[Ss]([0-9]+)[][ ._-]*[Ee][Pp]([0-9]+)([^\\/]*)$</regexp> <!-- foo.s01.ep01, foo.s01_ep01, S01EP02 foo -->


just came across some files named foo.S02.Ep01.foo

for some reason after adding in the [Pp] it was regex'd properly .. it was adding all episodes as season 1 and ignoring all the season numbering

what I could not work out is it was getting the episode numbers right


RE: Extra REGEX for TV Show Episode matching - JaKXz - 2013-08-11

Hi, I have the following example of a TV show and it's path and filename:

Code:
/Volumes/Data/Media/TV/Suits/Season 3/04 - Conflict of Interest [720p].mkv

And this regex to get the season #, episode #, and name:

Code:
(?i)(?<season>se|season\W?(\d{1,2}))\D*[/\\](?<episode>\d{1,2})\W*(?<name>(\w*.\b){1,})

which from the target string example returns
Code:
Season 3/04 - Conflict of Interest

What am I missing in my advancedsettings.xml (I have it under
Code:
<tvshowmatching action="append">
) to make this find all the episodes that are missing from my TV subfolders? I.e. How can I make XMBC recognize the three things I (think) I have pulled from the file string and thus properly list all my episodes?

Please let me know if I can clarify this question better, thanks in advance! Smile


RE: Extra REGEX for TV Show Episode matching - luhanmcs - 2013-09-04

I need help because I have some episodes of series that are divided into pieces and languages​​.
Ex1. Futurama - 00x01 - Bender's Big Score [Part 1].avi, Futurama - 00x01 - Bender's Big Score [Part 2].avi, Futurama - 00x01 - Bender's Big Score [Part 3].avi
Ex2. Hunter x Hunter - 01x01 - [br].avi, Hunter x Hunter - 01x01 - [jp].avi
I want the text that is written within brackets is shown in my xbmc library for the titles shown are not repeated.
It's Possible editing the file "advancedsettings.xml" without having to create NFO files?


RE: Extra REGEX for TV Show Episode matching - snyft - 2014-01-09

So i was wondering if i use the xbmc standard stacking regexp commands:
<moviestacking>
<!-- <cd/dvd/part/pt/disk/disc/d> <0-N> -->
<regexp>(.*?)([ _.-]*(?:cd|dvd|p(?:ar)?t|dis[ck]|d)[ _.-]*[0-9]+)(.*?)(\.[^.]+)$</regexp>
<!-- <cd/dvd/part/pt/disk/disc/d> <a-d> -->
<regexp>(.*?)([ _.-]*(?:cd|dvd|p(?:ar)?t|dis[ck]|d)[ _.-]*[a-d])(.*?)(\.[^.]+)$</regexp>
<!-- movienamea-xvid.avi, movienameb-xvid.avi -->
<regexp>(.*?)([ ._-]*[a-d])(.*?)(\.[^.]+)$</regexp>
</moviestacking>

Do they cover the ones included in this settingsfile (ie is it outdated)?
<regexp>(?i)(.*-done[\. _-])(\d)(\.)(\w{3})$</regexp> <!-- movie name.blah.DVDRip.XviD-DoNE.1.avi -->
<regexp>(?i)(.*?[\. _-]cd)(\d)([\. _-].*?\.)(\w{3})$</regexp> <!-- movie name.blah.iNTERNAL.DVDRip.XViD.CD1-TWiST.avi -->
<regexp>(?i)(.*?[\. _-]cd)(\d)(\.)(\w{3})$</regexp> <!-- group-40yearoldv-cd1.avi -->
<regexp>(?i)(.*?cd)(\d)(\.)(\w{3})$</regexp> <!-- group-30doncd1.avi -->
<regexp>(?i)(.*[\. _-])([abc])(\.)(\w{3})$</regexp> <!-- group-310ty-a.avi -->
<regexp>(?i)(.*?)([abc123])(\.)(\w{3})$</regexp> <!-- group-outa.avi -->
<regexp>(?i)(.*?)([abc123])([\. _-](?:xvid|divx|int)\.)(\w{3})$</regexp> <!-- group-moviea-xvid.avi -->
<regexp>(?i)(.*)(\d{1,2})(\.)(\w{3})$</regexp> <!-- group-movie2.avi -->
<regexp>(?i)(.*)(\d{1,2})([\. _-]\w{3,10}\.)(\w{3})$</regexp> <!-- movie1-grp.avi -->
<regexp>(?i)(.*?[\. _-])(\d{1,2})(\.)(\w{3})$</regexp> <!-- movie-name-01.avi.avi -->
<regexp>(?i)(.*?[\. _-]part)(\d{1,2})([\. _-].*?\.)(\w{3})$</regexp> <!-- Movie.name.DvDrip.Part1-group.avi -->
<regexp>(?i)(.*[\. _-])([123abc])([\. _-].*\.)(\w{3})$</regexp> <!-- the.movie.dual.audio-a-group.avi -->
<regexp>(?i)(.*)(\w)(Of[123].*\.)(\w{3})$</regexp> <!-- the movie - blah1Of2-.avi -->
<regexp>(?i)(.*)([123abc])(-int\.)(\w{3})$</regexp> <!-- group-movie4a-int.avi -->