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


- xexe - 2012-03-08

jenskristian Wrote:I have some files I hope someone here can help me with. The best would be to have some that would work for multiple shows etc.

I'm using v2.4, but the examples mentioned below are examples of episodes that doesn't get identified. Would really appreciate if someone had the time to help me out.

YoungDangerous-releases

CSI.4x01.Assume_Nothing_.WS_DVDRip_XviD-YoungDangerous
csis4ep01.rar
csis4ep01.avi

SiSO-releases

Friends.S09E01.UNCUT.RERiP.DVDRip.XviD-SiSO
f0901ur.xvid-siso.rar
f0901ur.xvid-siso.avi

Friends.S10E01.UNCUT.DVDRip.XviD-SiSO
fs1001uc.xvid-siso.rar
fs1001uc.xvid-siso.avi

Files with 'sseeee' format

The.Amazing.Race.S18E11E12.HDTV.XviD-LOL
the.amazing.race.181112.hdtv-lol.rar
the.amazing.race.181112.hdtv-lol.avi

Files without season

AFL.Full.Color.Football.E01.720p.x264-TRE
AFL.Full.Color.Football.E01.720p.x264-TRE.mkv

Nissene Over Skog og Hei EP01 720p BluRay DD2.0 x264-NorTV
Nissene Over Skog og Hei EP01 720p BluRay DD2.0 x264-NorTV.mkv


http://pastebin.com/xvvX89Ki

Some of these should work by default i.e. S18E11E12 the problem you are facing is liekly rar related.

f0901ur.xvid-siso.avi etc i cant suport as it is truely terrible name with certain chance of false positive.

I would consider revisiting this decision if you can get me BIG data sets to work with. e.g. a few hundred release names


- xexe - 2012-03-08

roth2006 Wrote:Are these regex's built into XBMC now?





Image

No and they never will be as per the opening post explanation.

In essence XBMC regex is all about 100% positive matches with no false positives. This regex is playing it a bit more dangerously. It is VERY relaible but wont ever be 100% so its not suitable for XBMC


- MasterCATZ - 2012-03-11

thanks for your scripts

now 3 of my anime series are finally showing , now to work out why the rest are not Tongue


xbmc default picked up only


[Taka]_Naruto_Shippuuden_239_[480p][5C3807A8].mp4

and
Detective Conan - 543 [DCTP][720p][569A7A36].mp4 ( after I had changed underscores to spaces )

with your script working
[Mazui]_Denpa_Onna_to_Seishun_Otoko_-_06v2_[636EA4DA].mkv


Kaleido_Star season 1 worked ( 1 - 26 )

but the rest stopped but may not have been added to the scrapper yet ( will check this soon

Kaleido_Star_-_26_-_An_Amazing_Comeback_[9FF6141B].mkv
not working
Kaleido_Star_-_27_-_The_Amazing_Prologue_to_Stardom_Part_One_[244B3845].mkv
Kaleido_Star_-_30_-_The_Lonely_Amazing_New_Member_[71C6657A].mkv ( I do not see why this wouldn't work so i think its the scrapper )

the scrapper has picked up these as being known but does not know about the files

ie
if I go to the Tv Show section they show file less but if i go to where the Video's are it know about them

but it might be just that it read the folder name and not any of the files during the search ( as these have simple folder names )



[Coalgirls]_Bakemonogatari_01_(1920x1080_Blu-Ray_FLAC)_[86FE4DBE].mkv
[HorribleSubs] Hanasaku Iroha - 13 [720p].mkv
[Hatsuyuki]_Maken-Ki!_-_01_[1280x720][3502BCC9].mkv
[Raws-4U] Skip Beat! - 15 (D-TX 1280x720 x264).mp4

*edit*

cleared data base and started again using AniDB instead of just TVDB
last time AniDB gave me no results whilst TVDB gave me at least Naruto ..

it appears to be working now

how ever out of these
(G_P) Patlabor TV 720p
028bit.mkv
Astarotte no Omocha! 1-12 (BD 720p) [Kirakira]
Baka to Test to Shokanju Ni [Commie]
Bakemonogatari [Coalgirls][1080p]
Black_Rock_Shooter_(2010)_[1080p,BluRay,x264]_-_THORA
Bleach
Dantalian no Shoka 1-12 [Commie]
Denpa Onna to Seishun Otoko[Mazui]
Detective_Conan
Fate-Zero 1-13 [UTW]
Green.Lantern.First.Flight.2009.BluRay.1080p.DTS.x264.dxva-EuReKA
Hanasaku Iroha [HorribleSubs][720p]
Hidan no Aria [UTW]
Hoshi_wo_Ou_Kodomo_(2011)_[1080p,BluRay,DTS,x264]_-_THORA
Ikkitousen_Xtreme_Xecutor_[Seto_Otaku-Shimeji]
Itsuka Tenma no Kuro Usagi 1-12 + OVA [Derp][1280x720_x264_AAC]
Kaleido_Star
KoreHuh wa Zombie Desuka 1-12 + OVA [TV 720p H264 AC3]
Magical Girl Madoka Magica (1280x720 Blu-Ray FLAC) [Coalgirls]
Maken-Ki! [Hatsuyuki]
Mardock_Scramble_The_First_Compression_(2010)_[720p,BluRay,flac,x264]_-_THORA
Mashiro Iro Symphony 01-12 (1280x720 x264 AAC)[Oyatsu]
Naruto
Nekogami Yaoyorozu 1-12
Patlabor_the_Movie_(1989)_[720p,BluRay,x264]_-_THORA
Patlabor_the_Movie_2_(1993)_[720p,BluRay,x264]_-_THORA
Saint Seiya The Lost Canvas 1-26 [720p]
Seikon no Qwaser (2010) [Doki][1280x720 h264 BD FLAC]
Shinryaku Ika Musume S2 [720p][HorribleSubs]
Skip Beat
Softenni 01-12 720p [Ayako-Nishishi]
Tegami Bachi - Letter Bee REVERSE (720p) [Ruri]
The_Recollections_of_a_Certain_Pilot_(2011)_[720p,BluRay,flac,x264]_-_Taka-THORA
Usagi drop
WXIII_Patlabor_the__Movie_3_(2002)_[720p,BluRay,x264]_-_THORA
[ANE] Shinryaku! Ika Musume [BDRip 720p x264 FLAC]
[Coalgirls]_Bakemonogatari_(1280x720_Blu-Ray_FLAC)
[Coalgirls]_Tears_to_Tiara_(1280x720_Blu-Ray_FLAC)
[Elysium]Shiki.v2(BD.1080p.FLAC)
[FFF-Hiryuu] Towa no Quon 01 [BD Hi10P 1920x1080 H264 5.1 FLAC] [AC1C2828].mkv
[FFF-Hiryuu] Towa no Quon 02 [BD Hi10P 1920x1080 H264 5.1 FLAC] [0A6EBFC9].mkv
[HorribleSubs] Fate Zero
[Mazui]_Boku_Ha_Tomodachi_Ga_Sukunai
[Mochi] Letter Bee - Tegami Bachi (1280x720 h264)
[Raws-4U] Skip Beat! (D-TX 1280x720 H264 AAC) [Subbed]
[SFW] Letter Bee - Light and Blue Night Fantasy [DVD][E9D62451].mkv
[Seto Otaku-Hiryuu] Hyakka Ryouran Samurai Girls [BD 1280x720 H264 AAC]
[Solstice] Tears to Tiara [h264]
[SubDESU] Seikon no Qwaser II BD (1280x720)
[Taka]_Usagi_Drop_01-11_[720p][BATCH]
[UTW] Amagami SS [BD][h264-1080p FLAC]
[UTW]_C3_Cube_x_Cursed_x_Curious_-_[h264-720p]
[gg] C The Money of Soul and Possibility Control [720p]

it has only found these

Children Who Chase Lost Voices Deep Below ( only reconised name not file )
Naruto ( only knows about naruto and no files )
Patlabour ( only know the name not any files )
Usagi Drop ( perfect )
Hidan no Aria ( perfect)
Maken-ki ( perfect)
ikkitousen ( perfect)
skip beat ( perfect)
seikon no qwaser ( perfect)
kaleido star ( perfect )


how ever this time it did not pick up the others it did before :S

Detective Conan
Denpa_Onna_to_Seishun_Otoko

Bakemonogatari
Hanasaku Iroha

why is their so many hit miss's based on scrapper used


any how pastebin here

http://pastebin.com/6fXjQ19e


not that it shows anything wrong :S

will gladly pay for working generic regex's that will work 100% with anime collections
( I really hate renaming files from the original naming structures especially when I need to seed dead torrents )
so far only Detective Conan is the only renamed series I have as I have 2x copies of it

( I have it pointed at only a small collection atm mostly only things collected this yr .. HDD prices from the Flooding caught me just before I got around to upgrading my array so currently using my old backup drives )


RE: [ALL PLATFORMS] Extra REGEX for TV Show Episode matching - bondaki - 2012-03-29

Hi

I've been using your regex's for a while now, and struggling with, you guessed it, anime episodes XD

there's a few animes i've noticed don't have any of their episodes indexed, like Yuru Yuri, kaiji, and kaiji season 2. they are all on thetvdb.com, numbered and listed correctly, and here are the original file names
http://pastebin.com/7fHvvDq0

there's also a lot of wierdness going on with minami-ke, but that's because of the way the seasons are organized/named, nothing regex's can do about that

in case you still need a massive list of anime naming, i'll put some in here
http://pastebin.com/ptMFfS3w



RE: - j3tang - 2012-04-02

(2012-03-08, 13:04)xexe Wrote:
j3tang Wrote:I've taken this bit from version 2.4

Code:
<regexp>(?i)()(?:[\. _-]|ep)(\d{1,3})[\. _-v].*[[({][\da-f]{8}[])}]</regexp>

for my anime and have found that it does a great job, except for one thing, which is the reason for my posting. It is not able to pick up multi-part episodes. Is there something that can be added to the above regex that will pick up episodes like the below?

[Taka]_Naruto_Shippuuden_197-198_[480p][85ACEA2B].avi


Any help is much appreciated Smile

I would need a much bigger sample set to work on this. Grep out the failed to enumerate lines and pastebin them then PM me.


I'm still very new to this and so I'm not quite sure what to paste over to pastebin from the xbmc.log.

I found, for example, the line where it detects one of these problem files (and the log does not have any "failed to enumerate" lines:

Quote:18:25:38 T:2956587008 DEBUG: VideoInfoScanner: Found episode match /volumes/airport/videos/anime/naruto shippuuden/[taka]_naruto_shippuuden_154-155_[480p][ee0d2138].mp4 (s1e155) [(?i)()(?:[\. _-]|ep)(\d{1,3})[\. _-v].*[[({][\da-f]{8}[])}]]

and what happens is that it picks up the back end of the two part file. The file in the example is seen within XBMC as episode 155, without anything about 154.


Is this what you mean by larger sample size?
The files that are not working are all the same format:

[Taka]_Naruto_Shippuuden_135-136_[480p][9073B8C2]
[Taka]_Naruto_Shippuuden_152-153_[480p][89E717B0]
[Taka]_Naruto_Shippuuden_154-155_[480p][EE0D2138]
[Taka]_Naruto_Shippuuden_197-198_[480p][85ACEA2B]
[Taka]_Naruto_Shippuuden_221-222_[480p][25C1E805]
[Taka]_Naruto_Shippuuden_248-249_[480p][14CD5F0F]


Files properly being detected are formatted this way:

[Taka]_Naruto_Shippuuden_131_[480p][62262B68]



RE: [ALL PLATFORMS] Extra REGEX for TV Show Episode matching - gokudo - 2012-04-05

I think the anime regexp subject could use some help from experiences of the past. Took me an hour to dig it up again but here it is, the in my opinion ultimate anidb-naming compatible regexp I've found so far: http://forum.xbmc.org/showthread.php?tid=64587&pid=584697#pid584697 . There are others in the same thread, you might want to try for yourself. http://forum.xbmc.org/showthread.php?tid=64587&pid=726611#pid726611 even has a regexp which works for single digit episodes, I use it but there maybe side effects if you have much numbering difference in your tv shows. Since I have mostly anime I use a combination of the two posts above and are happy..with the occasional false positive of course and no multiple episodes.


RE: [ALL PLATFORMS] Extra REGEX for TV Show Episode matching - willmeister_85 - 2012-04-25

Hi,

I am wondering if anyone can help.

I recently used xbmc to access my itunes tv library using a certain regexp and it worked perfectly, apart from special episodes which i'm not too bothered about. The itunes folder structure I have on my hard drive is as follows:

iTunes/Tv Shows/(show name)/Season 1/01 (episode name).m4v

e.g iTunes/Tv shows/Dexter/Season 2/05 The Dark Defender.m4v

I have since done a fresh install of windows and can't remember for the life of me what the regexp was! Doh! I have found one from this page http://forum.xbmc.org/showthread.php?tid=90568 but it doesn't seem to work.







RE: [ALL PLATFORMS] Extra REGEX for TV Show Episode matching - bondaki - 2012-05-03

willmeister_85 have you tried the regxp linked on the first page of this thread ?

try that. If it fails, copy the failed-to-ennumerate lines from the error log (should be in appdata/roaming/xbmc i think)


RE: [ALL PLATFORMS] Extra REGEX for TV Show Episode matching - jennix - 2012-05-07

Hi,

@xexe: because i get spontaneous blackouts when i try to understand regex, i'm very glad about your work Wink
But i have a usecase, which isnt handled by this and i wonder if you (or someone) could help me. I'm using the pvr-branch of xbmc-eden with vdr as tv-backend. In vdr i have a script which is sorting new recorded episodes in a special directory order:

Code:
/<some_dir>/<some_dir>/<name_of_the_tvshow>/<season><number>/<number><episode name>/<special_vdr_directory>/<filename>

So as example this will give for Lost, Season 1, Episode 03 (Tabula Rasa):

Code:
/recordings/TVShows/Lost/Season_01/03._Tabula_Rasa/2010-09-27.23.25.17-0.rec/00001.ts

I thought i could start with this:

Code:
<regexp>(?i)[/\\](?:s|season)\W?(\d{1,2})\D*[/\\](\d{1,2})\W([^/\\]*)</regexp> <!-- /UFO/Season 1/02.Computer.Affair.Divx e.g. lame sequntial numbering witout season  -->

but the problem is that the name of the episode is in the directory (here: Tabula Rasa) and the videofile itself is located some hierarchy-levels below (here: 00001.ts). How can i put this together for xbmc?
So, this is just the first part of the problem. Second is, that the filename has not always the *.ts-extension, because vdr had also its own video-format with the extension *.vdr. And the video files also can be splitted into 00001.vdr, 00002.vdr and so on.

Any hint? Thanks in advance,

regards, Jens




RE: Extra REGEX for TV Show Episode matching - Daedrox - 2012-06-21

Just thought I'd post my contribution. Tongue

Was looking to get some of my anime working. Thought I'd go learn a little RegExp and try to tackle the problem of the existing code that requires the CRC hash in the file name.

Code:
<regexp>(?i)()[[({][^]]+?[])}].*?(?:[\. _-]|ep)(\d{1,3})[\.[( _\-v]</regexp>

This looks for a [Blah] subber tag before the episode number and ignores anything after the episode number. (Technically after the character after the episode number...)
This should work if the file has the CRC in the name or not. However it does not work if the subber tag does not exist, or if it is after the episode number, so I leave the existing CRC one aswell. Episodes are generally released with the [subber] tag at the front of the file name, but it is not uncommon for people to move the [subber] tag behind the episode name and number for the sake of keeping episodes in chronological order when the episodes are from different subbing groups.

I also allowed for an open bracket to follow the episode number as I encountered a series that did this. Eg. [Chihiro]Ikkitousen_-_Great_Guardians_06[XviD][E5A9BD0C].avi

This solved a few false positives I was getting aswell, eg. "[m.3.3.w]_Dantalian_no_Shoka_-_01_[h264_720p]_[A00CA01B].mkv" detected as Episode 3. But this is also probably more likely to produce false positives than checking for the CRC hash as this just checks for anything in brackets before the episode number. Should probably limit it to square brackets only, to help prevent false positives, but I personally didn't experience any problems.

I would put a ^ in front of the open bracket for the subbing group, which would mean that it must be at the start of the file name, but I'm presuming the string that is being passed is including the file path, and hence the subber tag would not be at the start of the string. Maybe have it require a / directly before the subber tag?

I noticed j3tang was reporting problems with picking up double episodes, so I modified it a little, but this hasn't been tested aside from http://www.regextester.com/.

Code:
<regexp>(?i)()[[({][^]]+?[])}].*?(?:[\. _-]|ep)(\d{1,3})(-\d{1,3})?[\.[ _\-v]</regexp>

I just added "(-\d{1,3})?" after the episode number, if this is right, which I'm pretty sure it is, might want to add this to most of the regexp's?

Also of note, I encountered a fairly big flaw with the existing code. The section of the code that checks for the trailing character after the episode number, was accepting almost any alpha character.

Code:
[ss-eclipse] hayate no gotoku - 2nd season - 14 (1280x720 h264) [b3d60db5].mkv
and every other episode in this season was matched as (s1e2) by:
Code:
(?i)()[[({][^]]+?[])}].*?(?:[\. _-]|ep)(\d{1,3})(-\d{1,3})?[\. _-v]

This was due to the "_-v", meaning any character between _ and v.
So it became "_\-v".
I'm tempted to add in '\' with all the brackets, but it seems to have managed thus far.

Edit:
I found an issue with my regex that could pose a problem for many.
Code:
DEBUG: VideoInfoScanner: Found episode match smb://n5200xxx/data/anime/started/hack/[kaa]_hack_twilight_01-12.dvd(complete)/hack_twilight_08.dvd(aac)[kaa][06da16fc].avi (s1e1) [(?i)()[[({][^]]+?[])}].*?(?:[\. _-]|ep)(\d{1,3})(-\d{1,3})?[\.[( _\-v]]
DEBUG: VideoInfoScanner: Adding multipart episode 12 [^[-_EeXx]+([0-9]+)]

Due to only checking for a [subber] tag rather than a CRC check, if you leave the folders with this information in the folder names, it will likely pick up that info rather than the intended episode info. In this case, it picked up the folder name of [kaa]_hack_twilight_01-12.dvd(complete) and decided that the episode was a multipart episode of 1-12, and obviously did this for every episode in that folder.

Probably wouldn't be a problem if you checked for CRC first (I used this order to cater to the [m.3.3.w] group), and it is still more forgiving of folder structure than many of the other regex's.


RE: Extra REGEX for TV Show Episode matching - catastrofuk - 2012-07-07

Thought I would ask here before I go any further with this;

I am in the process of cataloging World Cup games.

I would like to have series folders names as "Group A", "Group B" etc, Semi-Finals, Finals etc instead of the the standard "season 1". An example of an individual file name would be say Group Cx02 Argentina vs Brazil.avi

Is this possible with regexp and xbmc? If so where do I begin Big Grin




RE: Extra REGEX for TV Show Episode matching - GreenGremlim - 2012-07-26

Hello I need a regex for ember media manager to detect some tv shows I have that it doesn't detect. The shows are sorted as follows:
D:\Share I\Séries\24\24 Season 1\24 S01E01 Day 1- 12-00 A.M.-1-00 A.M\24 S01E01 Day 1- 12-00 A.M.-1-00 A.M.avi
D:\Share I\Séries\Alias\Season 1\Alias S01E01 Truth Be Told\Alias S01E01 Truth Be Told.avi
D:\Share I\Séries\V 2009\V 2009 Season 1\V S01E01 Pilot\V S01E01 Pilot.avi
Anyone can help? I don't have a clue on how to do it Sad


RE: Extra REGEX for TV Show Episode matching - rydraj - 2012-07-29

Could anyone help me with a Regex for the following structure;

<Drive>\<Television>\<Person of Interest (2011) [HD_TV]>\<Season 1 (2011-2012)>\<01 Pilot.mkv>

-- AND --

<Drive>\<Television>\<The Simpsons (1989)>\<Season 13 (2001-2002) [HD_Blu-ray]>\<01 Treehouse of Horror XII.mkv>


RE: Extra REGEX for TV Show Episode matching - shin-go - 2012-08-12

I have quite a bit of media and everything is structured the same way, but I'm pretty poor with regular expressions.

My directory structure is:

<directory>/<series name> - <episode number>.<extension>

The video extensions tend to be avi, mpg, mpeg, mp4, mkv, wmv, flv, and ogm.

Note that for separate seasons I make a different directory rather than mix since there are odd cases where subsequent seasons of the same namesake show have very different names (it's not a matter of S1, S2, ad infinitum).

Any help with the regex would be greatly appreciated


RE: Extra REGEX for TV Show Episode matching - xbmcuser123 - 2012-09-02

Hi,

This may have already been posted in this long thread but I need some help on the naming convention.
I have several HDDs each containing a TV Show folder : TV 1, TV 2, etc etc
I have created a folder named TV and created inside seveveral junctions.
So the file structure is :
TV/TV 1/ TV Show 1/ Season 1/TV SHow 1.S01E01.avi
...
TV/TV 1/ TV Show 1/ Season 2/TV SHow 1.S01E01.avi
...
TV/TV 2/ TV Show 1/ Season 1/TV SHow 1.S01E01.avi
....

Whenever I add a new hard drive I create a new TV x folder and the associated junction link.

I would like to add TV as the source folder for XBMC library instead of adding each TV x folder.
Which naming convention shall I use for that ?

Thank you for your help