User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » Regular Expression help! Page [1]  
bous
All American
11215 Posts
user info
edit post

I am using a frontend (Media Portal with TV-Series plug-in) for my home theater pc and I keep tv shows on it...

My filenames are setup as: <series>\S<season>\filename.ext

for filename ... all i want to get from it is the episode & extension
possible filenames:

group-blah101.avi
show.name.s01e03.720p.hdtv.x264-group.mkv
show.name.1x03.pdtv.xvid-group.mkv

i was thinking get the first set of numbers... if it's 3+ numbers, take the last 2 as <episode>
if it is e{2}, take that
if it's x{2}, take that

^<series>[\\]S(?<season>[0-2]?\d)[\\]*?(?:s(?<season>[0-2]?\d)e(?<episode>\d\d)|(?<season>(?:[0-2]\d|(?<!\d)\d))x?(?<episode>\d\d))(?!\d)(?:[ .-]?(?:s\k<season>e?(?<episode2>\d{2}(?!\d))|\k<season>x?(?<episode2>\d{2}(?!\d))|(?<episode2>\d\d(?!\d))|E(?<episode2>\d\d))|)[ -.]*\.(?<ext>[^.]*)$

That works for everything but when the show name is not in the filename and only in the first directory. so i'd rather grab <series> from the first directory and ignore the show name completely and move on to the <season> and <episode> that follows.

[Edited on May 14, 2008 at 9:56 PM. Reason : code]

5/14/2008 9:56:25 PM

LimpyNuts
All American
16859 Posts
user info
edit post

You do realize processing time increases exponentially with the complexity of the test pattern right?

Make 1, 2,5, or however many and test in order of priority til you get a match.

i.e. match against [ignore this crap] s(digits)e(digits) [ignore this crap greedy] period characters
if that fails try the 1x03 test. Then rename all your shit to something that makes sense.

5/16/2008 10:37:11 PM

 Message Boards » Tech Talk » Regular Expression help! Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.39 - our disclaimer.