From ac5732536d540da14e37fbc3ef9fc536be47df92 Mon Sep 17 00:00:00 2001 From: Leonardo Galli Date: Sat, 1 Jul 2017 14:01:38 +0200 Subject: [PATCH] Fixed: BDRemux not recognized as such and BDRips without resolution recognized as DVD. Fixes #1755 --- .../ParserTests/QualityParserFixture.cs | 14 ++++++++++---- src/NzbDrone.Core/Parser/QualityParser.cs | 14 ++++++++++---- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs index cafe517f5..95d3c0ae6 100644 --- a/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs @@ -74,8 +74,7 @@ public void should_parse_sdtv_quality(string title, bool proper) [TestCase("WEEDS.S03E01-06.DUAL.XviD.Bluray.AC3-REPACK.-HELLYWOOD.avi", true)] [TestCase("The.Shield.S01E13.NTSC.x264-CtrlSD", false)] [TestCase("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD", false)] - [TestCase("WEEDS.S03E01-06.DUAL.BDRip.X-viD.AC3.-HELLYWOOD", false)] - [TestCase("WEEDS.S03E01-06.DUAL.BDRip.AC3.-HELLYWOOD", false)] + [TestCase("WEEDS.S03E01-06.DUAL.BDRip.X-viD.AC3.-HELLYWOOD", false)] [TestCase("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD.avi", false)] [TestCase("WEEDS.S03E01-06.DUAL.XviD.Bluray.AC3.-HELLYWOOD.avi", false)] [TestCase("The.Girls.Next.Door.S03E06.DVDRip.XviD-WiDE", false)] @@ -83,8 +82,6 @@ public void should_parse_sdtv_quality(string title, bool proper) [TestCase("the.shield.1x13.circles.ws.xvidvd-tns", false)] [TestCase("the_x-files.9x18.sunshine_days.ac3.ws_dvdrip_xvid-fov.avi", false)] [TestCase("[FroZen] Miyuki - 23 [DVD][7F6170E6]", false)] - [TestCase("Hannibal.S01E05.480p.BluRay.DD5.1.x264-HiSD", false)] - [TestCase("Heidi Girl of the Alps (BD)(640x480(RAW) (BATCH 1) (1-13)", false)] [TestCase("[Doki] Clannad - 02 (848x480 XviD BD MP3) [95360783]", false)] public void should_parse_dvd_quality(string title, bool proper) { @@ -100,6 +97,14 @@ public void should_parse_webdl480p_quality(string title, bool proper) ParseAndVerifyQuality(title, Quality.WEBDL480p, proper); } + [TestCase("Heidi Girl of the Alps (BD)(640x480(RAW) (BATCH 1) (1-13)", false)] + [TestCase("Hannibal.S01E05.480p.BluRay.DD5.1.x264-HiSD", false)] + [TestCase("WEEDS.S03E01-06.DUAL.BDRip.AC3.-HELLYWOOD", false)] + public void should_parse_bluray480p_quality(string title, bool proper) + { + ParseAndVerifyQuality(title, Quality.Bluray480p, proper); + } + [TestCase("Dexter - S01E01 - Title [HDTV]", false)] [TestCase("Dexter - S01E01 - Title [HDTV-720p]", false)] [TestCase("Pawn Stars S04E87 REPACK 720p HDTV x264 aAF", true)] @@ -227,6 +232,7 @@ public void should_parse_bluray576p_quality(string title) [TestCase("Contract.to.Kill.2016.REMUX.1080p.BluRay.AVC.DTS-HD.MA.5.1-iFT")] [TestCase("27.Dresses.2008.REMUX.1080p.Bluray.AVC.DTS-HR.MA.5.1-LEGi0N")] + [TestCase("27.Dresses.2008.BDREMUX.1080p.Bluray.AVC.DTS-HR.MA.5.1-LEGi0N")] public void should_parse_remux1080p_quality(string title) { ParseAndVerifyQuality(title, Quality.Remux1080p, false); diff --git a/src/NzbDrone.Core/Parser/QualityParser.cs b/src/NzbDrone.Core/Parser/QualityParser.cs index 93f706b3d..559efaca7 100644 --- a/src/NzbDrone.Core/Parser/QualityParser.cs +++ b/src/NzbDrone.Core/Parser/QualityParser.cs @@ -50,7 +50,7 @@ public class QualityParser private static readonly Regex HardcodedSubsRegex = new Regex(@"\b(?(\w+SUBS?)\b)|(?(HC))\b", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace); - private static readonly Regex RemuxRegex = new Regex(@"\b(?Remux)\b", + private static readonly Regex RemuxRegex = new Regex(@"\b(?(BD)?Remux)\b", RegexOptions.Compiled | RegexOptions.IgnoreCase); private static readonly Regex ProperRegex = new Regex(@"\b(?proper|repack|rerip)\b", @@ -65,7 +65,7 @@ public class QualityParser private static readonly Regex ResolutionRegex = new Regex(@"\b(?:(?480p|640x480|848x480)|(?576p)|(?720p|1280x720)|(?1080p|1920x1080)|(?2160p))\b", RegexOptions.Compiled | RegexOptions.IgnoreCase); - private static readonly Regex CodecRegex = new Regex(@"\b(?:(?x264)|(?h264)|(?XvidHD)|(?Xvid)|(?divx))\b", + private static readonly Regex CodecRegex = new Regex(@"\b(?:(?x264)|(?h264)|(?XvidHD)|(?X-?vid)|(?divx))\b", RegexOptions.Compiled | RegexOptions.IgnoreCase); private static readonly Regex OtherSourceRegex = new Regex(@"(?HD[-_. ]TV)|(?SD[-_. ]TV)", RegexOptions.Compiled | RegexOptions.IgnoreCase); @@ -144,7 +144,7 @@ public static QualityModel ParseQuality(string name) if (resolution == Resolution.R480P) { - result.Quality = Quality.DVD; + result.Quality = Quality.Bluray480p; return result; } @@ -215,6 +215,12 @@ public static QualityModel ParseQuality(string name) if (sourceMatch.Groups["bdrip"].Success || sourceMatch.Groups["brrip"].Success) { + if (codecRegex.Groups["xvid"].Success || codecRegex.Groups["divx"].Success) + { + result.Quality = Quality.DVD; + return result; + } + switch (resolution) { case Resolution.R720p: @@ -230,7 +236,7 @@ public static QualityModel ParseQuality(string name) result.Quality = Quality.Bluray480p; return result; default: - result.Quality = Quality.DVD; + result.Quality = Quality.Bluray480p; return result; } }