Regex for TV show structure
#1
Huh Apologies - I have search the forums and google and I am struggling to construct a regex expression that will suit my folder structure.

I am new to XBMC, trying to convert from Media Portal so I can use a Raspberry Pi as a media centre.

Because of other systems, I really don't want to rename my files and folders. Here is an example of how my TV series is set out:

\TV Series\30 Rock\07\01 - The Beginning of the End.mp4
\TV Series\30 Rock \07\12+13 - Hogcock and Last Lunch.mp4
\TV Series\BBC Documentaries\2012\192 - Voyager To the Final Frontier.mkv
\TV Series\BBC Documentaries\2013\36 - The Sea King - Britain's Flying Past.avi

Using the expression:
([0-9]+)[\\/]([0-9]+)([^\\/]*)$

Seems to pick up all of them apart from the mulit-episode files (\TV Series\30 Rock \07\12+13 - Hogcock and Last Lunch.mp4)

And I can't seem to find a way to get it to pick those up.

Any help would be great - Many thanks in advance.

Wayne
Nod
Reply
#2
try ([0-9]+)[\\/]([0-9]+\+[0-9]+|[0-9]+)([^\\/]*)$

check for Number+Number 1st , then just Number

is this what you wanted
Reply
#3
Hi k_zeon - thanks for the reply...

That is what I wanted but I cannot seem to get XBMC to pick up the multi-episode files correctly.

\TV Series\30 Rock \07\12+13 - Hogcock and Last Lunch.mp4

I have read everything and the easiest way seems to be to rename all the files (which really isn't an option at this time).

When I get home tonight I will send a copy of my advancedsettings.xml and do a debug report to post as well to see if anybody can help me get the file names resolved.

Thank you for your help anyway...
Reply
#4
Hi:

So to try and get this working I did the following:

I set up a test directory structure for one season of one series as follows:
30 Rock
----- 05
--------------- 01 - The Fabian Strategy.avi
--------------- 02 - When It Rains, It Pours.avi
--------------- 03 - Let's Stay Together.avi
--------------- 04 - Live Show (East Coast).avi
--------------- 05 - Reaganing.avi
--------------- 06+07 - Gentleman's Intermission.avi
--------------- 08 - College.avi
--------------- 09 - Chain Reaction of Mental Anguish.avi
--------------- 10 - Christmas Attack Zone.avi
etc...

I tried a couple of different goes with the advanced settings - all of which had the same result:

My original attempt:
Code:
<advancedsettings>
<tvshowmatching action="prepend"><regexp>([0-9]+)[\\/]([0-9]+\+[0-9]+|[0-9]+)([^\\/]*)$</regexp></tvshowmatching>
<tvmultipartmatching>^[-_EeXx+]+([0-9]+)</tvmultipartmatching>
</advancedsettings>

Then as suggested above:
Code:
<advancedsettings>
<tvshowmatching action="prepend"><regexp>([0-9]+)[\\/]([0-9]+\+[0-9]+|[0-9]+)([^\\/]*)$</regexp></tvshowmatching>
</advancedsettings>

Then a combination of the two:
Code:
<advancedsettings>
<tvshowmatching action="prepend"><regexp>([0-9]+)[\\/]([0-9]+\+[0-9]+|[0-9]+)([^\\/]*)$</regexp></tvshowmatching>
<tvmultipartmatching>^[-_EeXx+]+([0-9]+)</tvmultipartmatching>
</advancedsettings>

I still get the same result - where 06+07 - Gentleman's Intermission.avi is detected as episode 6 only.

My debug log is uploaded at: http://xbmclogs.com/show.php?id=5334

Looking through the log myself I can see that line #278 shows the + sign is being removed from the file:

Code:
VideoInfoScanner: Found episode match smb://portal/tv1/media/xbmc_test/30 rock/05/06 07 - gentleman's intermission.avi (s5e6) [([0-9]+)[\\/]([0-9]+)([^\\/]*)$]

Which is the same even with the updated regex.

Can anybody tell me what I am doing wrong?

Many thanks in advance.

Wayne.
Reply
#5
Hi - Does anybody have any ideas or am I flogging a dead horse?

I am clutching at straws now and going round in circles and if I had the option to rename the files, I would...

Many thanks in advance.

Wayne.
Reply
#6
Hi - Looking at other threads: Is this because I am use to MediaPortal showing both episodes for the one filename in the library and XBMC only shows the first episode?

If so what is the point of multi-part matching if part 2 will not be shown in the library anyway?
Reply
#7
No, both parts should show in Library view if it worked. If you happen to be looking only in File view then it's true you'd only see one entry for each file, but you'd already know if it had worked from the debug log, because there would be a line with "VideoInfoScanner: Adding multipart episode ..." directly after the first episode match.

Your first instincts were right, the combination:
Code:
<advancedsettings>
  <tvshowmatching action="prepend">
    <regexp>([0-9]+)[\\/]([0-9]+)([^\\/]*)$</regexp>
  </tvshowmatching>
  <tvmultipartmatching>^[-_EeXx+]+([0-9]+)</tvmultipartmatching>
</advancedsettings>
is the one that should have worked. The fact that it doesn't is, as you've spotted, because XBMC is translating the plus sign into a space before enumerating the file.

There's probably not much you can do, except file a bug report on trac, and hope it's an easy fix (it could, for example, be part of a standard URI handling, making it difficult to single out a special case without breaking elsewhere).

Other than that, the only other choice is to bite the bullet and rename your files.
Reply
#8
Hi - Thank you scudlee - at least I know I was not going mad and it should have been working...

I think the ultimate solution will be to buy some hard disks and make a copy so that I can rename them to whatever I want :-)

Wayne...
Reply

Logout Mark Read Team Forum Stats Members Help
Regex for TV show structure0