mwheelerjr / mptvseries

Automatically exported from code.google.com/p/mptvseries
0 stars 0 forks source link

Default parsing expression false positive on airdate filenames #644

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
If a filename uses "2012.09.13" or alike dates in the filename this was picked 
up as Season '2012' and Episode '09'.

So to correct: ^(?:.*\\)?(?<series>[^\\]+?)[ _.\-\[]+(?:(?<season>\d+)[ 
_.\-\[\]]*[ex](?<episode>\d+)|(?:\#|\-\s)(?<season>(?!(?:\d{4}.\d{2}.\d{2}|\d{2}
.\d{2}.\d{4}))\d+)\.(?<episode>\d+))(?:[ _.+-]+(?:\k<season>[ 
_.\-\[\]]*[ex](?<episode2>\d+)|(?:\#|\-\s)\k<season>\.(?<episode2>\d+))|(?:[ 
_.+-]*[ex+-]+(?<episode2>\d+)))*[ _.\-\[\]]*(?<title>(?![^\\].*?(?<!the)[ 
.(-]sample[ .)-]).*?)\.(?<ext>[^.]*)$

Original issue reported on code.google.com by RoChess....@gmail.com on 13 Sep 2012 at 4:22

GoogleCodeExporter commented 8 years ago
Thanks Rochess. Has this been verified to work without breaking existing 
[YYYY-MM-DD], not sure I will have time to do any regression testing on this 
one.

Original comment by damien.haynes@gmail.com on 8 Oct 2012 at 10:30

GoogleCodeExporter commented 8 years ago

Original comment by damien.haynes@gmail.com on 20 Oct 2012 at 12:01

GoogleCodeExporter commented 8 years ago
This is terrible, in copy-n-pasting back and forth some critical parts of the 
old expression got removed. Correct expression is:

^(?:.*\\)?(?<series>[^\\]+?)[ _.\-\[]+(?:[s]?(?<season>\d+)[ 
_.\-\[\]]*[ex](?<episode>\d+)|(?:\#|\-\s)(?<season>(?!(?:\d{4}.\d{2}.\d{2}|\d{2}
.\d{2}.\d{4}))\d+)\.(?<episode>\d+))(?:[ _.+-]+(?:[s]?\k<season>[ 
_.\-\[\]]*[ex](?<episode2>\d+)|(?:\#|\-\s)\k<season>\.(?<episode2>\d+))|(?:[ 
_.+-]*[ex+-]+(?<episode2>\d+)))*[ _.\-\[\]]*(?<title>(?![^\\].*?(?<!the)[ 
.(-]sample[ .)-]).*?)\.(?<ext>[^.]*)$

Old one was:

^(?:.*\\)?(?<series>[^\\]+?)[ _.\-\[]+(?:[s]?(?<season>\d+)[ 
_.\-\[\]]*[ex](?<episode>\d+)|(?:\#|\-\s)(?<season>\d+)\.(?<episode>\d+))(?:[ 
_.+-]+(?:[s]?\k<season>[ 
_.\-\[\]]*[ex](?<episode2>\d+)|(?:\#|\-\s)\k<season>\.(?<episode2>\d+))|(?:[ 
_.+-]*[ex+-]+(?<episode2>\d+)))*[ _.\-\[\]]*(?<title>(?![^\\].*?(?<!the)[ 
.(-]sample[ .)-]).*?)\.(?<ext>[^.]*)$

The 'diff' == "(?!(?:\d{4}.\d{2}.\d{2}|\d{2}.\d{2}.\d{4}))", which is an 
exclusion expression to only capture the postfixed expression ("\d+" in this 
case) if there are no results found. It looks for "4444.22.22" or "22.22.4444" 
format as those are the different type of date formats a filename might contain.

Tested it on wide range of filenames, and found no breaking changes.

With this new correct one that is :)

Sorry for the fubar!

Original comment by RoChess....@gmail.com on 29 Oct 2012 at 10:33

GoogleCodeExporter commented 8 years ago
Fantastic, thanks Rochess

Original comment by damien.haynes@gmail.com on 29 Oct 2012 at 10:41

GoogleCodeExporter commented 8 years ago
Done r1980

Original comment by damien.haynes@gmail.com on 29 Oct 2012 at 10:45