A recent user of MC had an issue with MC not returning the correct season & episode information from the show they where trying to use. That show was named 3x3 Eyes
Now the issue here is that the 3x3 is also one of the methods to name the season & episodes of a particular Tv show. An example of the full path of one of these shows would be something like this....
C:\Video\TV Shows\3x3 Eyes\1x01 - Transmigration.aviThe issue is is that because the
regex looks left-to-right it finds a match with 3x3 & so returns with Season 3 & Episode 3. If the Season & episode had been writen like this....
C:\Video\TV Shows\3x3 Eyes\S01E01 - Transmigration.aviit would have been fine, since in MC the
regex test for the S??E?? format is tested before the ??x?? method & once the first match is found MC moves onto the next video file.
MC has 3
regex test built in, S??E??, ??x?? & ????. The last is just simply defining say Season 1 Episode 1 as 0101. This is left to last in MC since any video path containg a 4 digit year will trigger the
regex.
So if you had.....
C:\Backup 2009\Video\TV Shows\Two & A Half Men\0403.avithe
regex would return the season as 20 & the Episode number as 09.
Is there a better way?Well the 3x3 show bugged me a bit, I had a few solutions that I really wasn't happy with before I came across a better one.....
What I wanted was to return the
last match, not the first......that way it will still work if there is only one match, but the filename component takes priority over the rest of the path of the video file - as you would want.
The basis of the next
regex is from this web site....
http://frightanic.wordpress.com/2007/06/08/regex-match-last-occurrence/the
regex example they give is quite simple.....
foo(?!.*foo)In this case it returns the last foo in a text string.
So for our
regex's we just need to replace both foo's with our current
regex's, so the new
regex's become.
[Ss]([\d]{1,2}).?[Ee]([\d]{1,2})(?!.*[Ss]([\d]{1,2}).?[Ee]([\d]{1,2}))
([\d]{1,2}) ?[xX] ?([\d]{1,2})(?!.*([\d]{1,2}) ?[xX] ?([\d]{1,2}))
([0-9]+)([0-9][0-9])(?!.*([0-9]+)([0-9][0-9]))I've tested each of these with my test path below succesfully in MC....
C:\2009\21x4 Eyes\S01E01\S07E02 7x3 704.aviall
regex's return the season 7 & relavent episode number.
Cheers