Kodi Community Forum

Full Version: Scraping - Custom Directory Structure & File Names
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

Hey All,

So I've left my XBMC set up for awhile. I have a custom regexp:

Season[\._ ][0]*([0-9]+)[\\/][ep[0]*([0-9]+)[^\\/]*

Which looks for:

Show\Season 01\[ep01] - Name Of Episode.avi

My only issue is multipart episodes. These are named in two conventions:

[ep01-02] - Episode 01 Name + Episode 02 Name
[ep01a] - Ep Name (p1)
[ep01b] - Ep Name (p2)

I had a look here:

and is says:

Quote:Note that when using a custom RegExp to match a custom file naming convention, add (.*) to the end of the RegExp so that the 3rd RegExp capture is found for the second episode.

So I have added .* to the end of my "Season[\._ ][0]*([0-9]+)[\\/][ep[0]*([0-9]+)[^\\/]*" leaving me with:

Quote: Season[\._ ][0]*([0-9]+)[\\/][ep[0]*([0-9]+)[^\\/]*.*

This still works for the single episode files however nothing changes on the multipart episodes.

I must confess I did bring this up about a year ago (almost to the day =S): http://forum.xbmc.org/showthread.php?tid=107867.
Sorry about that but it's been a year and I still haven't got round to making sense of it.

Perhaps if someone could break down the RegExp as I just made an educated guess at what it should be and it worked (well for the single episode files).

Do I need to change the naming format for my mulitpart episodes, as currently I'm assuming I can get away with leaving them as "[ep01-02] The Begriming + The Second Comming.avi".

Thanks in advance,

You need a capture around the .* at the end.
(2012-08-16, 00:46)jmarshall Wrote: [ -> ]You need a capture around the .* at the end.

Excuse my ignorance but what is a capture?
(2012-08-16, 10:03)olympia Wrote: [ -> ]()

I thought as much but they all seem closed off to me.

I tried running it through http://regexpal.com/

(At work so have not tried it in XBMC yet)

But this seems to select the right bit of text:

Quote:Season[\._ ][0]*([0-9]+)[\\/][ep[0]*([0-9]+)[^\\/]...

From the below:

C:\Show\Season 01\[ep01-02] - Info.avi

the quote string returns:

Quote: Season 01\[ep01-02]

Is this what I need it to return in order to scrape the correct info?

(Will do this by trial and error tonight but thought I'd ask the question to give myself a head start.)

I appreciate that adding the ... only allows for 3 following characters but I think this should be okay as I don't believe I have any two part episodes witch go into 3 figures (ie [ep100-101]).

If you follow the advice from jmarshall and the pointer from me, then this should leaves you with:
Season[\._ ][0]*([0-9]+)[\\/][ep[0]*([0-9]+)[^\\/]*(.*)
(2012-08-16, 13:22)olympia Wrote: [ -> ]If you follow the advice from jmarshall and the pointer from me, then this should leaves you with:
Season[\._ ][0]*([0-9]+)[\\/][ep[0]*([0-9]+)[^\\/]*(.*)

Heh will try yours first as you guys actually understand it. Trust it will work but will update the post either way.

Thank you to the both of you.