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 - coreano - 2015-12-08

please help Kodi works on roku 3Huh


Regex fails to parse episodes - dragonkeyper - 2015-12-23

Hello I'm trying to move from media portal to Kodi for various reasons, but at the moment i have a few minor obstacles i need to over come. Can anyone explain why the following advancedsettings.xml file is not working on the following path/naming convention.

Z:\Media\TV Shows\Alias Smith and Jones\Season 01\1.01 - Alias Smith and Jones.avi

<advancedsettings>
<tvshowmatching>
<regexp>[0-9]{1,2}\.[0-9]{2}\s-\s.*\..{3}</regexp>
</tvshowmatching>
</advancedsettings>


RE: Extra REGEX for TV Show Episode matching - dragonkeyper - 2015-12-24

(2015-12-23, 08:51)dragonkeyper Wrote: Hello I'm trying to move from media portal to Kodi for various reasons, but at the moment i have a few minor obstacles i need to over come. Can anyone explain why the following advancedsettings.xml file is not working on the following path/naming convention.

Z:\Media\TV Shows\Alias Smith and Jones\Season 01\1.01 - Alias Smith and Jones.avi

<advancedsettings>
<tvshowmatching>
<regexp>[0-9]{1,2}\.[0-9]{2}\s-\s.*\..{3}</regexp>
</tvshowmatching>
</advancedsettings>

Never mind I got it.


RE: Extra REGEX for TV Show Episode matching - el_Salmon - 2015-12-30

Hi,

I want to parse, for example, this tv shows file:

Code:
Crossing Lines.SE02-EP12.El equipo (2ยช parte).2014.HDTV-1080p.AC3.DUAL.mkv

I have added these lines to my ~/.kodi/userdata/advancedsettings.xml file:
Code:
<tvshowmatching action="append">
<regexp>[Ss][Ee]([0-9]+)[][ ._-]*[Ee][Pp]([0-9]+)([^\\/]*)$</regexp>  <!-- foo.SE01-EP02 -->
<regexp>SE([0-9]+)[][ ._-]*EP([0-9]+)([^\\/]*)$</regexp>  <!-- foo.SE01-EP02 -->
</tvshowmatching>
but it doesn't work


RE: Extra REGEX for TV Show Episode matching - crazygambit - 2016-02-11

I checked out the anime regex on this thread, which also appears in the wiki, but it's based on seasons rather than absolute ordering. Since I really didn't want to rename my collection and since I couldn't find any decent regex for absolute number I decided to learn how to do it myself. After banging my head against the wall for 2 days, I finally figured it out. I just have to say the wiki is woefully inadequate to tackle this issue, which a lot of people have been having for years. I guess most have given up and renamed their files. If you haven't yet, then this might be of use. It catches 100% of my episodes, even multi episodes without ever renaming anything. Even difficult to match shows like Macross 7 or Eyeshield 21 are no issue. Specials need to be numbered according to the TVDB if you're using that scraper, though you don't need to add S00. That's more of a scraper than a regex issue. I still have no clue how Anidb deals with specials, so I can't help you there. So without further ado here it is:

Code:
<advancedsettings>
    
<tvshowmatching action="prepend">


<!-- Anime specific matching exclusively for Absolute Ordering. Everything will be matched to season 1, except Specials that will be assigned season 0 -->

<!-- Anime must be contained in a folder called anime (case insensitive) at any dept, to avoid messing with regular TV Shows. You can change it to match your folder sructure. If your anime isn't separate from your other shows then simply delete "Anime" from the regex, but bear in mind it won't play nice with shows with more than 1 season -->

<!-- Files must either have a mkv, mp4, avi or ogm extenion to avoid matching spam files that sometimes come with some downloads like .url and the like. Also optional. Remove (?:(?=.*\.mkv$)|(?=.*\.mp4$)|(?=.*\.avi$)|(?=.*\.ogm$)) if you want to match any extensions. -->

<!-- The last number without brackets not immediately followed by letters other than "v" will be matched. That means shows like Macross 7, Eyeshield 21 or Hunter x Hunter (2011) pose no problem to match. -->

<!-- Specials are automatically asigned to season 0, so there's no need to add "S00" to the filename, but that doesn't affect the match. The file must be in a folder called "Specials" (case insensiive) for each show somewhere inside your anime folder. I recommend numbering after TVDB. -->

<regexp defaultseason="0">(?i)Anime.*Specials(?:(?=.*\.mkv$)|(?=.*\.mp4$)|(?=.*\.avi$)|(?=.*\.ogm$)).+(?=\w)(?&lt;![a-df-z0-9])(\d+)(?&lt;=\d)(?!.*[\\\/])(?![a-uw-z0-9\])}px])</regexp>

        <!-- EG: Anime/Kurenai/Specials/[gleam] Kurenai OVA - 01 [OAD][0e73f000].mkv -->
        


<!-- We are looking for a multi episode with the format Anime/Show 01-02.mkv There can be any number of folders in between and numbers either before or after. It will match only the last set, so in the following file it will pick episodes 08 and 09 for example and not 01 and 12. It will fail on single episodes even if the folder has a range of episodes, so no need to rename anything. -->

<!-- smb://n5200xxx/data/anime/started/hack/[kaa]_hack_twilight_01-12.dvd(complete)/hack_twilight_08-09.dvd(aac)[kaa][06da16fc].ogm -->


<regexp>(?i)()Anime(?:(?=.*\.mkv$)|(?=.*\.mp4$)|(?=.*\.avi$)|(?=.*\.ogm$)).+(?=\w)(?&lt;![a-df-z0-9])(\d+)(\-\d+)(?&lt;=\d)(?!.*[\\\/])(?![a-uw-z0-9\])}px])</regexp>


<!-- This one matches single episodes, always matching the last valid number as the episode. It supports a wide array of formats either with CRC, resolution, hash, etc. or without. -->


<regexp>(?i)()Anime(?:(?=.*\.mkv$)|(?=.*\.mp4$)|(?=.*\.avi$)|(?=.*\.ogm$)).+(?=\w)(?&lt;![a-df-z0-9])(\d+)(?&lt;=\d)(?!.*[\\\/])(?![a-uw-z0-9\])}px])</regexp>

</tvshowmatching>

</advancedsettings>

I wanted to post it here, so people interested would see it, but I don't want to hijack this thread. I'll make a new one to answer any questions you guys might have.


RE: Extra REGEX for TV Show Episode matching - rexo - 2016-03-26

Hello after some debugging I found way to scan TV Shows all placed in one folder.
With this there is no need to move each show to separate folders:

Code:
<advancedsettings>
<video>
<cleanstrings>
<regexp>[ _\\,\\.\\(\\)\\[\\]\\-](ac3|dts|custom|dc|remastered|divx|divx5|dsr|dsrip|dutch|dvd|dvd5|dvd9|dvdrip|dvdscr|dvdscreener|screener|dvdivx|cam|fragment|fs|hdtv|hdrip|hdtvrip|internal|limited|multisubs|ntsc|ogg|ogm|pal|pdtv|proper|repack|rerip|retail|r3|r5|bd5|se|svcd|swedish|german|read.nfo|nfofix|unrated|extended|ws|telesync|ts|telecine|tc|brrip|bdrip|480p|480i|576p|576i|720p|720i|1080p|1080i|3d|hrhd|hrhdtv|hddvd|bluray|x264|h264|xvid|xvidvd|xxx|www.www|cd[1-9]|\\[.*\\])([ _\\,\\.\\(\\)\\[\\]\\-]|$)</regexp>
<regexp>[ _.]?[Ss][0-9]+[ _.x]?[Ee][0-9]+.*</regexp>
<regexp>(\[.*\])</regexp>
</cleanstrings>
</video>
</advancedsettings>

I added this second regex, first and last are copied from Kodi source code.
This second one removes season and episode numbers from name while sending request to info provider.


RE: Extra REGEX for TV Show Episode matching - dregge8 - 2016-04-18

(2016-03-26, 23:41)rexo Wrote: Hello after some debugging I found way to scan TV Shows all placed in one folder.
With this there is no need to move each show to separate folders:

Code:
<advancedsettings>
<video>
<cleanstrings>
<regexp>[ _\\,\\.\\(\\)\\[\\]\\-](ac3|dts|custom|dc|remastered|divx|divx5|dsr|dsrip|dutch|dvd|dvd5|dvd9|dvdrip|dvdscr|dvdscreener|screener|dvdivx|cam|fragment|fs|hdtv|hdrip|hdtvrip|internal|limited|multisubs|ntsc|ogg|ogm|pal|pdtv|proper|repack|rerip|retail|r3|r5|bd5|se|svcd|swedish|german|read.nfo|nfofix|unrated|extended|ws|telesync|ts|telecine|tc|brrip|bdrip|480p|480i|576p|576i|720p|720i|1080p|1080i|3d|hrhd|hrhdtv|hddvd|bluray|x264|h264|xvid|xvidvd|xxx|www.www|cd[1-9]|\\[.*\\])([ _\\,\\.\\(\\)\\[\\]\\-]|$)</regexp>
<regexp>[ _.]?[Ss][0-9]+[ _.x]?[Ee][0-9]+.*</regexp>
<regexp>(\[.*\])</regexp>
</cleanstrings>
</video>
</advancedsettings>

I added this second regex, first and last are copied from Kodi source code.
This second one removes season and episode numbers from name while sending request to info provider.

I added these settings to my advanced xml with no luck. Currently running Kodi 16.1, restarted the system as well. When it updates the library it seem like it is finding each individual show name, however nothing appears in my TV Show library.


RE: Extra REGEX for TV Show Episode matching - dregge8 - 2016-04-18

The tv shows appear in the mysql DB but not the Kodi Library?

watch gallery

http://imgur.com/yYPajfe

watch gallery

http://imgur.com/VcbmQwK

Any thoughts?


RE: Extra REGEX for TV Show Episode matching - Jessica136 - 2016-05-17

I am a big fan of Kodi..Smile
Thanks


RE: Extra REGEX for TV Show Episode matching - MrBass - 2016-07-23

Hopefully this threads still alive and one of you kind folks will be able to help me with my problem.

My TV Shows are all stored in the following format,

Show Name/Season/Episode Number - Title (Release Date).extn

E.g. volume1/Media/TV Shows/Dead Of Summer/Season 1/01 - Patience (28-Jun-2016).mkv

I've tried the following in my advancedsettings.xml,

Code:
<tvshowmatching action="prepend">
    <regexp>(season)\s(\d{1,2})[\\/](\d{1,2})[A-Za-z -]*</regexp>
  </tvshowmatching>

Unfortunately that gets interpreted as s0e1 - which appears to be the trend with all my shows. So whilst, the show is getting scraped, the episodes are all showing as the same non-existing season 0 episode 1.

Is it possible to have a regexp setting for my format or am I going to have to painstakingly rename all my files.

Out of interest, what string is Kodi searching for? If I knew that then I might be able to work something out myself.

Any help really appreciated.


RE: Extra REGEX for TV Show Episode matching - scudlee - 2016-07-24

Try removing the brackets around the word season.

Since that makes it technically the first capturing group of your regexp, which should be for the season number, I'm guessing that because it's not actually a number it's being interpreted as a 0 (whence "season 0").

The second group, which should be for the episode number, is capturing the season number instead (whence "episode 1", at least for every season 1 episode).

You don't need the brackets just to surround a word.

If you do for some reason need to group a part of the regexp (e.g. because that part is optional), you can make it non-capturing by adding a ?: after the opening bracket, e.g. (?Confusedeason).


RE: Extra REGEX for TV Show Episode matching - hema2311 - 2016-08-28

thanks


RE: Extra REGEX for TV Show Episode matching - SpiderBoxLive - 2016-10-22

Not getting it.


RE: Extra REGEX for TV Show Episode matching - conan76 - 2016-11-03

Hi from France (and excuse me for my bad english...)

simple explanation :

I'm using Kodi 17 with a mysql Database.

i've got tv series named "Scorpion", saison "2"
i've got this directory architecture : "\\DS1813\Series\Scorpion\S02"

Files are named like that : "Scorpion - 02x05 - Les supers fun guys.mkv"

Episode 16 of this serie is in 2 parts (2x 45min)

After many search how to define a episode in 2 parts for kodi, i found in kodi wiki the "Split-episode" explanation and i name my files like this :

Scorpion - 02x06.1 - La tour de cristal infernale
Scorpion - 02x06.2 - La tour de cristal infernale

but kodi list 2 files in media library, scrapper define is "thetvdb"

where is the problem ?

Thanks for your help.


RE: Extra REGEX for TV Show Episode matching - MasterCATZ - 2016-11-13

somethings broken

my database is in shambles
thankfully I can still export my anime from kodi gui as a backup , but the movies have all disappeared ...
*edit* damn now anime are gone also

some of its stored in my profile database folder and some of its in the sql database

last time i modiefied my advancedsettings.xml was using Version: V2.4 template ...
and the settings seem to be skipped now with kodi 17