diff --git a/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs index e11e08fc8..0324b62bd 100644 --- a/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs @@ -1,6 +1,5 @@ -using FluentAssertions; +using FluentAssertions; using NUnit.Framework; -using NzbDrone.Core.CustomFormats; using NzbDrone.Core.Parser; using NzbDrone.Core.Qualities; using NzbDrone.Core.Test.Framework; @@ -68,6 +67,7 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("The.Girls.Next.Door.S03E06.DVD.Rip.XviD-WiDE", false)] [TestCase("the.shield.1x13.circles.ws.xvidvd-tns", false)] [TestCase("the_x-files.9x18.sunshine_days.ac3.ws_dvdrip_xvid-fov.avi", false)] + [TestCase("The.Third.Jihad.2008.DVDRip.360p.H264 iPod -20-40", false)] public void should_parse_dvd_quality(string title, bool proper) { ParseAndVerifyQuality(title, Source.DVD, proper, Resolution.R480p); @@ -91,6 +91,7 @@ namespace NzbDrone.Core.Test.ParserTests [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)] + [TestCase("Where.Do.We.Go.Now.2011.LIMITED.BluRay.360p.H264-20-40", false)] public void should_parse_bluray480p_quality(string title, bool proper) { ParseAndVerifyQuality(title, Source.BLURAY, proper, Resolution.R480p); diff --git a/src/NzbDrone.Core/Parser/QualityParser.cs b/src/NzbDrone.Core/Parser/QualityParser.cs index 78606fb8c..6a01cf15e 100644 --- a/src/NzbDrone.Core/Parser/QualityParser.cs +++ b/src/NzbDrone.Core/Parser/QualityParser.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Linq; using System.Text.RegularExpressions; @@ -54,7 +54,7 @@ namespace NzbDrone.Core.Parser private static readonly Regex RealRegex = new Regex(@"\b(?REAL)\b", RegexOptions.Compiled); - private static readonly Regex ResolutionRegex = new Regex(@"\b(?:(?480p|640x480|848x480)|(?576p)|(?720p|1280x720)|(?1080p|1920x1080|1440p|FHD|1080i)|(?2160p|4k[-_. ](?:UHD|HEVC|BD)|(?:UHD|HEVC|BD)[-_. ]4k))\b", + private static readonly Regex ResolutionRegex = new Regex(@"\b(?:(?360p)|(?480p|640x480|848x480)|(?576p)|(?720p|1280x720)|(?1080p|1920x1080|1440p|FHD|1080i)|(?2160p|4k[-_. ](?:UHD|HEVC|BD)|(?:UHD|HEVC|BD)[-_. ]4k))\b", RegexOptions.Compiled | RegexOptions.IgnoreCase); private static readonly Regex CodecRegex = new Regex(@"\b(?:(?x264)|(?h264)|(?XvidHD)|(?X-?vid)|(?divx))\b", @@ -159,7 +159,7 @@ namespace NzbDrone.Core.Parser return result; } - if (resolution == Resolution.R480p) + if (resolution == Resolution.R360p || resolution == Resolution.R480p) { result.Quality = Quality.Bluray480p; return result; @@ -354,7 +354,7 @@ namespace NzbDrone.Core.Parser // Anime Bluray matching if (AnimeBlurayRegex.Match(normalizedName).Success) { - if (resolution == Resolution.R480p || resolution == Resolution.R576p || normalizedName.Contains("480p")) + if (resolution == Resolution.R360p || resolution == Resolution.R480p || resolution == Resolution.R576p || normalizedName.Contains("480p")) { result.Quality = Quality.DVD; return result; @@ -401,7 +401,7 @@ namespace NzbDrone.Core.Parser return result; } - if (resolution == Resolution.R480p) + if (resolution == Resolution.R360p || resolution == Resolution.R480p) { result.Quality = Quality.SDTV; return result; @@ -477,6 +477,11 @@ namespace NzbDrone.Core.Parser return Resolution.Unknown; } + if (match.Groups["R360p"].Success) + { + return Resolution.R360p; + } + if (match.Groups["R480p"].Success) { return Resolution.R480p; @@ -565,6 +570,7 @@ namespace NzbDrone.Core.Parser public enum Resolution { Unknown, + R360p = 360, R480p = 480, R576p = 576, R720p = 720,