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

+- Kodi Community Forum (http://forum.kodi.tv)
+-- Forum: Support (/forumdisplay.php?fid=33)
+--- Forum: Tips, tricks, and step by step guides (/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


RE: Extra REGEX for TV Show Episode matching - coreano - 2015-12-08 01:21

please help Kodi works on roku 3Confused


Regex fails to parse episodes - dragonkeyper - 2015-12-23 08:51

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 - mousears - 2015-12-24 01:01

https://youtu.be/3g_fh9jlC7w
TOP 5 VIDEO ADDONS DECEMBER 2015


RE: Extra REGEX for TV Show Episode matching - mousears - 2015-12-24 01:03

https://youtu.be/Y5SYjQa2bmA
HOW TO INSTALL KODI ON FIRESTICK


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

(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 19:57

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 07:00

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 23:41

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|dv​dscr|dvdscreener|screener|dvdivx|cam|fragment|fs|hdtv|hdrip|hdtvrip|internal|lim​ited|multisubs|ntsc|ogg|ogm|pal|pdtv|proper|repack|rerip|retail|r3|r5|bd5|se|svc​d|swedish|german|read.nfo|nfofix|unrated|extended|ws|telesync|ts|telecine|tc|brr​ip|bdrip|480p|480i|576p|576i|720p|720i|1080p|1080i|3d|hrhd|hrhdtv|hddvd|bluray|x​264|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 10:36

(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|dv​dscr|dvdscreener|screener|dvdivx|cam|fragment|fs|hdtv|hdrip|hdtvrip|internal|lim​ited|multisubs|ntsc|ogg|ogm|pal|pdtv|proper|repack|rerip|retail|r3|r5|bd5|se|svc​d|swedish|german|read.nfo|nfofix|unrated|extended|ws|telesync|ts|telecine|tc|brr​ip|bdrip|480p|480i|576p|576i|720p|720i|1080p|1080i|3d|hrhd|hrhdtv|hddvd|bluray|x​264|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 16:50

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


http://imgur.com/yYPajfe


http://imgur.com/VcbmQwK

Any thoughts?


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

I am a big fan of Kodi..Smile
Thanks


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

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 17:19

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. (?:season).