Regular Expressions

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
J_K_M_A_N Offline
Fan
Posts: 443
Joined: Feb 2006
Reputation: 1
Location: Minnesota
Post: #21
DonJ Wrote:Please update this wiki page with your custom regexps: http://www.xboxmediacenter.com/wiki/inde...e=TV_Shows

Does anyone want to add an example of how you want things listed here and I will try to add some entries? I am not sure if you want real examples or just something like:

TV Show Name\Season #\TV Show Name - S##E## - Episode Name.avi

Or if you want some of it italicized or what. The above format works if you want to add that in whatever format you would like it in.

Thanks.

J_K_M_A_N
find quote
muggsy Online
Member
Posts: 54
Joined: Mar 2007
Reputation: 0
Post: #22
J_K_M_A_N Wrote:Does anyone want to add an example of how you want things listed here and I will try to add some entries? I am not sure if you want real examples or just something like:

TV Show Name\Season #\TV Show Name - S##E## - Episode Name.avi

Or if you want some of it italicized or what. The above format works if you want to add that in whatever format you would like it in.

Thanks.

J_K_M_A_N

Ok, this is my testing, and I done a lot of testing...

For me it doesn't do recursive scans when you TV shows are actually located on the Xbox (like mine) and all I could get to work was when I put the avi in the root of the Series files like so

\Battlestar Galactica\S03E01 - whatever.avi and that works fine

Then by chance (coz I don;t use SMB normally, I tried it that way and found the following

\Battlestar Galactica\Season 3\Battlestar Galactica.S03E04 - Whatever.avi was being scanned.

Then I started testing regexp... and I had a few problems, but the regexp causing my the least greief is this

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

This will pick up the following

\Battlestar Galactica\season 3\01 - test.avi perfectly fine

It doesn't like this example

\Battlestar Galactica\season 3\01 - 33.avi at all

I did some testing, and for some reason it refused to scan a folder called Season 4. It didn't matter whether I used eitehr of the following expressions
Code:
Season[\._ ]([0-9]+)[\\/]([0-9]+)[^\\/]*
[Ss]eason[\._ ]([0-9]+)[\\/]([0-9]+)[^\\/]*
which both past regexp testers.

I did try various things after the episode selction, but it didn't like anything I did.

To be honest I've given up. All my season folders are now named with lower case, and I'm buying a nice new NAS HDD to store all the stuff that was on my xbox (I needed a good excuse for a 1TB drive)

BUT, if any one can suggest something that will work for the following example I would be grateful..

\Battlestar Galactica\Season 1\01 - 33.avi

Love the work, I love it so much I get disappointed when then are no svn updates when I check =)
find quote
cockbongo Offline
Junior Member
Posts: 8
Joined: Mar 2006
Reputation: 0
Location: Edinburgh
Post: #23
Hiya,

First post, but we all got to start somewhere...

I can get my regexp expressions to pick up most of my files regardless of how they are named - with two exceptions. No matter what i put in, i can't get it to pick up the following structure:

Show Name/Season 1/ShowName.101.text.avi

(if its 1x01 or S01E01 then it picks it up no problem, but as soon as you take out a letter it misses it completely)

Show Name/Season 1/1x01 - Episode Title

(I did read spiff's comment that having an episode number first is tricky as it causes confusion with shows like 24, but can anyone provide a regexp for it since i don't actually watch 24!)

Any help would be much appreciated!
find quote
cockbongo Offline
Junior Member
Posts: 8
Joined: Mar 2006
Reputation: 0
Location: Edinburgh
Post: #24
Noticed you can't edit the posts here...

This is currently what my AdvancedSettings.xml looks like...

<tvshowmatching>
<regexp>\[[Ss]([0-9]*)\]_\[[Ee]([0-9]*)[^\\/]*</regexp>
<regexp>[\._ \-]([0-9]*)x([0-9]*)[^\\/]*</regexp>
<regexp>[\._ \-][Ss]([0-9]*)[\.\-]?[Ee]([0-9]*)[^\\/]*</regexp>
<regexp>[\._ \-]([0-9]*)([0-9][0-9])[\._ \-][^\\/]*</regexp>
<regexp>[\._ \-]([0-9]+)([0-9][0-9])[\._ \-][^\\/]*</regexp>
<regexp>([0-9]+)([0-9][0-9])[^\\/]*</regexp>
<regexp>([0-9]+)([0-9][0-9])[\._ \-][^\\/]*</regexp>
<twopart>
<regexp>\[[Ss]([0-9]*)\]_\[[Ee][0-9][0-9]\-([0-9]*)\][^\\/]*</regexp>
<regexp>[\._ \-][Ss]([0-9]*)[^0-9]*[Ee][0-9][0-9]\-([0-9]*)[^\\/]*</regexp>
<regexp>[\._ \-][0-9]*x[0-9]*[\._ \-]*([0-9]*)x([0-9]*)[^\\/]*</regexp>
</twopart>
</tvshowmatching>

You can see i'm trying to catch every single combination here, but something's slipping through!
find quote
blakholephysics Offline
Member
Posts: 67
Joined: Jun 2006
Reputation: 0
Post: #25
You did add the <advancedsettings> </advancedsettings> tags?

I can't seem to get it to work. I must be doing something small wrong. I do have an old revision of XBMC (which may or may not be the problem)

Here is the contents of my advancedsettings.xml

Code:
<advancedsettings>
<moviestacking append="no">
    <regexp>[ _\.-]+part[ _\.-]*([0-9a-d]+)</regexp>
</moviestacking>
<tvshowmatching>
    <regexp>[Ss]eason ([0-9]+)[\\/]([0-9]+) - [^\\/]*</regexp>
    <twopart>
    </twopart>
</tvshowmatching>
</advancedsettings>

The movies one works fine, but I can't seem to get my tv show matching to work. Once again my tv shows are in the

Tvshowname/Season #/episode# - Episodetitle.extension

I do have it scan recursively and included the <twopart></twopart> tag as you mentioned a problem with earlier revisions.

Any ideas?
find quote
stokkes Offline
Member
Posts: 78
Joined: Feb 2004
Reputation: 0
Post: #26
blakholephysics:

try this:
Code:
<regexp>Season ([0-9]+)[\\/]([0-9]+) - .*\.[0-9a-zA-z]+[^\\/]</regexp>
find quote
stokkes Offline
Member
Posts: 78
Joined: Feb 2004
Reputation: 0
Post: #27
Ok,

I think i found a bug in XBMC's RegEx engine. I've confirmed with two different regexp programs and websites (http://www.regextester.com), using TextMate on a Mac and Notepad++ on Windows.

Here's the regexp that works in all those but not XBMC (for CERTAIN things):

Code:
([0-9]|[0-9][0-9])([0-9][0-9]) - [^\\/]

This should match all the following below (tested and confirmed on other regexp engines):

101 - Pilot.avi (Season 1, Episode 1)
610 - My Show.avi (Season 6, Episode 10)
1024 - Testing.avi (Season 10, Episode 24)

The values of $1 is the Season number and $2 the episode number. Essentially this regexp finds a series of 3 numbers followed by a dash, gets the last two numbers of the string and sets it as the episode number, the first character or two characters for Season 10+ are set as the Season number and stored in $1.

This works fine, but NOT in XBMC.

It will match the first two, but not the last one.

All my other shows which are named this way did get scanned into the DB except for two:

South Park Season 10
SG-1 Season 10

Test it for yourself.
find quote
stokkes Offline
Member
Posts: 78
Joined: Feb 2004
Reputation: 0
Post: #28
Well I feel like an ass.

Carry on. nothing to see in my previous post.

** blushes **
find quote
blakholephysics Offline
Member
Posts: 67
Joined: Jun 2006
Reputation: 0
Post: #29
What does .*\. mean?
literal . but ".*" ?

And did you mean for the last z to be capital in [0-9a-zA-z]?
find quote
spiff Online
Grumpy Bastard Developer
Posts: 12,179
Joined: Nov 2003
Reputation: 82
Post: #30
. - any char
* any amount that char
? this is optional.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
find quote
Post Reply