diff --git a/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs index cd57836e0..9495dbf65 100644 --- a/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs @@ -18,10 +18,13 @@ public class QualityParserFixture : CoreTest new object[] { Quality.WEBDL480p }, new object[] { Quality.HDTV720p }, new object[] { Quality.HDTV1080p }, + new object[] { Quality.HDTV2160p }, new object[] { Quality.WEBDL720p }, new object[] { Quality.WEBDL1080p }, + new object[] { Quality.WEBDL2160p }, new object[] { Quality.Bluray720p }, - new object[] { Quality.Bluray1080p } + new object[] { Quality.Bluray1080p }, + new object[] { Quality.Bluray2160p }, }; public static object[] OtherSourceQualityParserCases = @@ -31,10 +34,13 @@ public class QualityParserFixture : CoreTest new object[] { "480p WEB-DL", Quality.WEBDL480p }, new object[] { "HD TV", Quality.HDTV720p }, new object[] { "1080p HD TV", Quality.HDTV1080p }, + new object[] { "2160p HD TV", Quality.HDTV2160p }, new object[] { "720p WEB-DL", Quality.WEBDL720p }, new object[] { "1080p WEB-DL", Quality.WEBDL1080p }, + new object[] { "2160p WEB-DL", Quality.WEBDL2160p }, new object[] { "720p BluRay", Quality.Bluray720p }, - new object[] { "1080p BluRay", Quality.Bluray1080p } + new object[] { "1080p BluRay", Quality.Bluray1080p }, + new object[] { "2160p BluRay", Quality.Bluray2160p }, }; [TestCase("S07E23 .avi ", false)] @@ -157,6 +163,15 @@ public void should_parse_webdl1080p_quality(string title, bool proper) ParseAndVerifyQuality(title, Quality.WEBDL1080p, proper); } + [TestCase("CASANOVA S01E01.2160P AMZN WEBRIP DD2.0 HI10P X264-TROLLUHD", false)] + [TestCase("JUST ADD MAGIC S01E01.2160P AMZN WEBRIP DD2.0 X264-TROLLUHD", false)] + [TestCase("The.Man.In.The.High.Castle.S01E01.2160p.AMZN.WEBRip.DD2.0.Hi10p.X264-TrollUHD", false)] + [TestCase("The Man In the High Castle S01E01 2160p AMZN WEBRip DD2.0 Hi10P x264-TrollUHD", false)] + public void should_parse_webdl2160p_quality(string title, bool proper) + { + ParseAndVerifyQuality(title, Quality.WEBDL2160p, proper); + } + [TestCase("WEEDS.S03E01-06.DUAL.Bluray.AC3.-HELLYWOOD.avi", false)] [TestCase("Chuck - S01E03 - Come Fly With Me - 720p BluRay.mkv", false)] [TestCase("The Big Bang Theory.S03E01.The Electric Can Opener Fluctuation.m2ts", false)] diff --git a/src/NzbDrone.Core.Test/Profiles/ProfileServiceFixture.cs b/src/NzbDrone.Core.Test/Profiles/ProfileServiceFixture.cs index c02b8df48..4f799fa7d 100644 --- a/src/NzbDrone.Core.Test/Profiles/ProfileServiceFixture.cs +++ b/src/NzbDrone.Core.Test/Profiles/ProfileServiceFixture.cs @@ -19,7 +19,7 @@ public void init_should_add_default_profiles() Subject.Handle(new ApplicationStartedEvent()); Mocker.GetMock() - .Verify(v => v.Insert(It.IsAny()), Times.Exactly(5)); + .Verify(v => v.Insert(It.IsAny()), Times.Exactly(6)); } [Test] diff --git a/src/NzbDrone.Core.Test/Qualities/QualityFixture.cs b/src/NzbDrone.Core.Test/Qualities/QualityFixture.cs index 673ca0ca9..e011286c6 100644 --- a/src/NzbDrone.Core.Test/Qualities/QualityFixture.cs +++ b/src/NzbDrone.Core.Test/Qualities/QualityFixture.cs @@ -13,22 +13,38 @@ public class QualityFixture : CoreTest { public static object[] FromIntCases = { + new object[] {0, Quality.Unknown}, new object[] {1, Quality.SDTV}, new object[] {2, Quality.DVD}, + new object[] {3, Quality.WEBDL1080p}, new object[] {4, Quality.HDTV720p}, new object[] {5, Quality.WEBDL720p}, new object[] {6, Quality.Bluray720p}, - new object[] {7, Quality.Bluray1080p} + new object[] {7, Quality.Bluray1080p}, + new object[] {8, Quality.WEBDL480p}, + new object[] {9, Quality.HDTV1080p}, + new object[] {10, Quality.RAWHD}, + new object[] {12, Quality.HDTV2160p}, + new object[] {13, Quality.WEBDL2160p}, + new object[] {14, Quality.Bluray2160p}, }; public static object[] ToIntCases = { + new object[] {Quality.Unknown, 0}, new object[] {Quality.SDTV, 1}, new object[] {Quality.DVD, 2}, + new object[] {Quality.WEBDL1080p, 3}, new object[] {Quality.HDTV720p, 4}, new object[] {Quality.WEBDL720p, 5}, new object[] {Quality.Bluray720p, 6}, - new object[] {Quality.Bluray1080p, 7} + new object[] {Quality.Bluray1080p, 7}, + new object[] {Quality.WEBDL480p, 8}, + new object[] {Quality.HDTV1080p, 9}, + new object[] {Quality.RAWHD, 10}, + new object[] {Quality.HDTV2160p, 12}, + new object[] {Quality.WEBDL2160p, 13}, + new object[] {Quality.Bluray2160p, 14}, }; [Test, TestCaseSource("FromIntCases")] @@ -49,16 +65,20 @@ public static List GetDefaultQualities(params Quality[] allo { var qualities = new List { + Quality.Unknown, Quality.SDTV, Quality.WEBDL480p, Quality.DVD, Quality.HDTV720p, Quality.HDTV1080p, + Quality.HDTV2160p, Quality.RAWHD, Quality.WEBDL720p, - Quality.Bluray720p, Quality.WEBDL1080p, - Quality.Bluray1080p + Quality.WEBDL2160p, + Quality.Bluray720p, + Quality.Bluray1080p, + Quality.Bluray2160p, }; if (allowed.Length == 0) diff --git a/src/NzbDrone.Core/Parser/Parser.cs b/src/NzbDrone.Core/Parser/Parser.cs index d60d18783..c92fd5463 100644 --- a/src/NzbDrone.Core/Parser/Parser.cs +++ b/src/NzbDrone.Core/Parser/Parser.cs @@ -222,7 +222,7 @@ public static class Parser private static readonly Regex CleanTorrentSuffixRegex = new Regex(@"\[(?:ettv|rartv|rarbg|cttv)\]$", RegexOptions.IgnoreCase | RegexOptions.Compiled); - private static readonly Regex ReleaseGroupRegex = new Regex(@"-(?[a-z0-9]+)\b(?[a-z0-9]+)\b(?(?!\s).+?(?REAL)\b", RegexOptions.Compiled); - private static readonly Regex ResolutionRegex = new Regex(@"\b(?:(?<_480p>480p|640x480|848x480)|(?<_576p>576p)|(?<_720p>720p|1280x720)|(?<_1080p>1080p|1920x1080))\b", + private static readonly Regex ResolutionRegex = new Regex(@"\b(?:(?<_480p>480p|640x480|848x480)|(?<_576p>576p)|(?<_720p>720p|1280x720)|(?<_1080p>1080p|1920x1080)|(?<_2160p>2160p))\b", RegexOptions.Compiled | RegexOptions.IgnoreCase); private static readonly Regex CodecRegex = new Regex(@"\b(?:(?x264)|(?h264)|(?XvidHD)|(?Xvid)|(?divx))\b", @@ -76,6 +76,12 @@ public static QualityModel ParseQuality(string name) return result; } + if (resolution == Resolution._2160p) + { + result.Quality = Quality.Bluray2160p; + return result; + } + if (resolution == Resolution._1080p) { result.Quality = Quality.Bluray1080p; @@ -94,6 +100,12 @@ public static QualityModel ParseQuality(string name) if (sourceMatch.Groups["webdl"].Success) { + if (resolution == Resolution._2160p) + { + result.Quality = Quality.WEBDL2160p; + return result; + } + if (resolution == Resolution._1080p) { result.Quality = Quality.WEBDL1080p; @@ -118,6 +130,12 @@ public static QualityModel ParseQuality(string name) if (sourceMatch.Groups["hdtv"].Success) { + if (resolution == Resolution._2160p) + { + result.Quality = Quality.HDTV2160p; + return result; + } + if (resolution == Resolution._1080p) { result.Quality = Quality.HDTV1080p; @@ -198,6 +216,12 @@ public static QualityModel ParseQuality(string name) return result; } + if (resolution == Resolution._2160p) + { + result.Quality = Quality.HDTV2160p; + return result; + } + if (resolution == Resolution._1080p) { result.Quality = Quality.HDTV1080p; @@ -296,6 +320,7 @@ private static Resolution ParseResolution(string name) if (match.Groups["_576p"].Success) return Resolution._576p; if (match.Groups["_720p"].Success) return Resolution._720p; if (match.Groups["_1080p"].Success) return Resolution._1080p; + if (match.Groups["_2160p"].Success) return Resolution._2160p; return Resolution.Unknown; } @@ -346,6 +371,7 @@ public enum Resolution _576p, _720p, _1080p, + _2160p, Unknown } } diff --git a/src/NzbDrone.Core/Profiles/ProfileService.cs b/src/NzbDrone.Core/Profiles/ProfileService.cs index e439b1a43..d85faf713 100644 --- a/src/NzbDrone.Core/Profiles/ProfileService.cs +++ b/src/NzbDrone.Core/Profiles/ProfileService.cs @@ -94,7 +94,8 @@ public void Handle(ApplicationStartedEvent message) Quality.WEBDL720p, Quality.WEBDL1080p, Quality.Bluray720p, - Quality.Bluray1080p); + Quality.Bluray1080p, + Quality.WEBDL2160p); AddDefaultProfile("SD", Quality.SDTV, Quality.SDTV, @@ -111,13 +112,21 @@ public void Handle(ApplicationStartedEvent message) Quality.WEBDL1080p, Quality.Bluray1080p); + AddDefaultProfile("HD-2160p", Quality.HDTV2160p, + Quality.HDTV2160p, + Quality.WEBDL2160p, + Quality.Bluray2160p); + AddDefaultProfile("HD - All", Quality.HDTV720p, Quality.HDTV720p, Quality.HDTV1080p, + Quality.HDTV2160p, Quality.WEBDL720p, Quality.WEBDL1080p, + Quality.WEBDL2160p, Quality.Bluray720p, - Quality.Bluray1080p); + Quality.Bluray1080p, + Quality.Bluray2160p); } } } \ No newline at end of file diff --git a/src/NzbDrone.Core/Qualities/Quality.cs b/src/NzbDrone.Core/Qualities/Quality.cs index 9fba87e84..0e0655978 100644 --- a/src/NzbDrone.Core/Qualities/Quality.cs +++ b/src/NzbDrone.Core/Qualities/Quality.cs @@ -67,7 +67,10 @@ public override bool Equals(object obj) public static Quality HDTV1080p { get { return new Quality(9, "HDTV-1080p"); } } public static Quality RAWHD { get { return new Quality(10, "Raw-HD"); } } //public static Quality HDTV480p { get { return new Quality(11, "HDTV-480p"); } } - + public static Quality HDTV2160p { get { return new Quality(12, "HDTV-2160p"); } } + public static Quality WEBDL2160p { get { return new Quality(13, "WEBDL-2160p"); } } + public static Quality Bluray2160p { get { return new Quality(14, "Bluray-2160p"); } } + public static List All { get @@ -84,7 +87,10 @@ public static List All Bluray1080p, WEBDL480p, HDTV1080p, - RAWHD + RAWHD, + HDTV2160p, + WEBDL2160p, + Bluray2160p, }; } } @@ -105,7 +111,10 @@ public static HashSet DefaultQualityDefinitions new QualityDefinition(Quality.WEBDL720p) { Weight = 8, MinSize = 0, MaxSize = 100 }, new QualityDefinition(Quality.Bluray720p) { Weight = 9, MinSize = 0, MaxSize = 100 }, new QualityDefinition(Quality.WEBDL1080p) { Weight = 10, MinSize = 0, MaxSize = 100 }, - new QualityDefinition(Quality.Bluray1080p) { Weight = 11, MinSize = 0, MaxSize = 100 } + new QualityDefinition(Quality.Bluray1080p) { Weight = 11, MinSize = 0, MaxSize = 100 }, + new QualityDefinition(Quality.HDTV2160p) { Weight = 12, MinSize = 0, MaxSize = 100 }, + new QualityDefinition(Quality.WEBDL2160p) { Weight = 13, MinSize = 0, MaxSize = 100 }, + new QualityDefinition(Quality.Bluray2160p) { Weight = 14, MinSize = 0, MaxSize = 100 }, }; } }