Fixed: Handle numerical hashed releases

pull/3113/head
Mark McDowall 10 years ago
parent d4ccbda99f
commit 98b4027510

@ -1,5 +1,6 @@
using FluentAssertions; using FluentAssertions;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common; using NzbDrone.Test.Common;
@ -14,52 +15,59 @@ namespace NzbDrone.Core.Test.ParserTests
{ {
@"C:\Test\Some.Hashed.Release.S01E01.720p.WEB-DL.AAC2.0.H.264-Mercury\0e895c37245186812cb08aab1529cf8ee389dd05.mkv".AsOsAgnostic(), @"C:\Test\Some.Hashed.Release.S01E01.720p.WEB-DL.AAC2.0.H.264-Mercury\0e895c37245186812cb08aab1529cf8ee389dd05.mkv".AsOsAgnostic(),
"somehashedrelease", "somehashedrelease",
"WEBDL-720p", Quality.WEBDL720p,
"Mercury" "Mercury"
}, },
new object[] new object[]
{ {
@"C:\Test\0e895c37245186812cb08aab1529cf8ee389dd05\Some.Hashed.Release.S01E01.720p.WEB-DL.AAC2.0.H.264-Mercury.mkv".AsOsAgnostic(), @"C:\Test\0e895c37245186812cb08aab1529cf8ee389dd05\Some.Hashed.Release.S01E01.720p.WEB-DL.AAC2.0.H.264-Mercury.mkv".AsOsAgnostic(),
"somehashedrelease", "somehashedrelease",
"WEBDL-720p", Quality.WEBDL720p,
"Mercury" "Mercury"
}, },
new object[] new object[]
{ {
@"C:\Test\Fake.Dir.S01E01-Test\yrucreM-462.H.0.2CAA.LD-BEW.p027.10E10S.esaeleR.dehsaH.emoS.mkv".AsOsAgnostic(), @"C:\Test\Fake.Dir.S01E01-Test\yrucreM-462.H.0.2CAA.LD-BEW.p027.10E10S.esaeleR.dehsaH.emoS.mkv".AsOsAgnostic(),
"somehashedrelease", "somehashedrelease",
"WEBDL-720p", Quality.WEBDL720p,
"Mercury" "Mercury"
}, },
new object[] new object[]
{ {
@"C:\Test\Fake.Dir.S01E01-Test\yrucreM-LN 1.5DD LD-BEW P0801 10E10S esaeleR dehsaH emoS.mkv".AsOsAgnostic(), @"C:\Test\Fake.Dir.S01E01-Test\yrucreM-LN 1.5DD LD-BEW P0801 10E10S esaeleR dehsaH emoS.mkv".AsOsAgnostic(),
"somehashedrelease", "somehashedrelease",
"WEBDL-1080p", Quality.WEBDL1080p,
"Mercury" "Mercury"
}, },
new object[] new object[]
{ {
@"C:\Test\Weeds.S01E10.DVDRip.XviD-NZBgeek\AHFMZXGHEWD660.mkv".AsOsAgnostic(), @"C:\Test\Weeds.S01E10.DVDRip.XviD-NZBgeek\AHFMZXGHEWD660.mkv".AsOsAgnostic(),
"weeds", "weeds",
"DVD", Quality.DVD,
"NZBgeek" "NZBgeek"
}, },
new object[] new object[]
{ {
@"C:\Test\Deadwood.S02E12.1080p.BluRay.x264-SONARR\Backup_72023S02-12.mkv".AsOsAgnostic(), @"C:\Test\Deadwood.S02E12.1080p.BluRay.x264-SONARR\Backup_72023S02-12.mkv".AsOsAgnostic(),
"deadwood", "deadwood",
"Bluray-1080p", Quality.Bluray1080p,
"SONARR" "SONARR"
},
new object[]
{
@"C:\Test\Grimm S04E08 Chupacabra 720p WEB-DL DD5 1 H 264-ECI\123.mkv".AsOsAgnostic(),
"grimm",
Quality.WEBDL720p,
"ECI"
} }
}; };
[Test, TestCaseSource("HashedReleaseParserCases")] [Test, TestCaseSource("HashedReleaseParserCases")]
public void should_properly_parse_hashed_releases(string path, string title, string quality, string releaseGroup) public void should_properly_parse_hashed_releases(string path, string title, Quality quality, string releaseGroup)
{ {
var result = Parser.Parser.ParsePath(path); var result = Parser.Parser.ParsePath(path);
result.SeriesTitle.Should().Be(title); result.SeriesTitle.Should().Be(title);
result.Quality.ToString().Should().Be(quality + " v1"); result.Quality.Quality.Should().Be(quality);
result.ReleaseGroup.Should().Be(releaseGroup); result.ReleaseGroup.Should().Be(releaseGroup);
} }
} }

@ -132,7 +132,10 @@ namespace NzbDrone.Core.Parser
new Regex(@"^[A-Z]{11}\d{3}$", RegexOptions.Compiled), new Regex(@"^[A-Z]{11}\d{3}$", RegexOptions.Compiled),
//Backup filename (Unknown origins) //Backup filename (Unknown origins)
new Regex(@"^Backup_\d{5,}S\d{2}-\d{2}$", RegexOptions.Compiled) new Regex(@"^Backup_\d{5,}S\d{2}-\d{2}$", RegexOptions.Compiled),
//123 - Started appearing December 2014
new Regex(@"^123$", RegexOptions.Compiled)
}; };
//Regex to detect whether the title was reversed. //Regex to detect whether the title was reversed.

Loading…
Cancel
Save