From ba2ca7ee2929f8ed5411e11e9a96001a37723dcc Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 13 Jan 2021 16:57:39 -0800 Subject: [PATCH] New: Parsing of '[WEB]' as WebDL --- .../ParserTests/QualityParserFixture.cs | 6 +++- src/NzbDrone.Core/Parser/QualityParser.cs | 34 +++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs index c4f827e16..a64014e52 100644 --- a/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs @@ -3,7 +3,6 @@ using NUnit.Framework; using NzbDrone.Core.Parser; using NzbDrone.Core.Qualities; using NzbDrone.Core.Test.Framework; -using NzbDrone.Test.Common; namespace NzbDrone.Core.Test.ParserTests { @@ -88,6 +87,7 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("Da.Vincis.Demons.S02E04.480p.WEB.DL.nSD.x264-NhaNc3", false)] [TestCase("Incorporated.S01E08.Das.geloeschte.Ich.German.Dubbed.DL.AmazonHD.x264-TVS", false)] [TestCase("Haters.Back.Off.S01E04.Rod.Trip.mit.meinem.Onkel.German.DL.NetflixUHD.x264", false)] + [TestCase("[HorribleSubs] Series Title! S01 [Web][MKV][h264][480p][AAC 2.0][Softsubs (HorribleSubs)]", false)] public void should_parse_webdl480p_quality(string title, bool proper) { ParseAndVerifyQuality(title, Quality.WEBDL480p, proper); @@ -193,6 +193,8 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("into.the.badlands.s03e16.h264.720p-web-handbrake.mkv", false)] [TestCase("BrainDead.S01E01.The.Insanity.Principle.720p.WEB-DL.DD5.1.H.264-BD", false)] [TestCase("Jerks.S03E05.Griebnitzsee.German.720p.MaxdomeHD.AVC-TVS", false)] + [TestCase("[HorribleSubs] Series Title! S01 [Web][MKV][h264][720p][AAC 2.0][Softsubs (HorribleSubs)]", false)] + [TestCase("[HorribleSubs] Series Title! S01 [Web][MKV][h264][AAC 2.0][Softsubs (HorribleSubs)]", false)] public void should_parse_webdl720p_quality(string title, bool proper) { ParseAndVerifyQuality(title, Quality.WEBDL720p, proper); @@ -230,6 +232,7 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("Legacies.S02E02.This.Year.Will.Be.Different.1080p.AMZN.WEB...", false)] [TestCase("Legacies.S02E02.This.Year.Will.Be.Different.1080p.AMZN.WEB.", false)] [TestCase("Series Title - S01E11 2020 1080p Viva MKV WEB", false)] + [TestCase("[HorribleSubs] Series Title! S01 [Web][MKV][h264][1080p][AAC 2.0][Softsubs (HorribleSubs)]", false)] public void should_parse_webdl1080p_quality(string title, bool proper) { ParseAndVerifyQuality(title, Quality.WEBDL1080p, proper); @@ -251,6 +254,7 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("The.Nightly.Show.2016.03.14.2160p.WEB.PROPER.h264-spamTV", true)] [TestCase("House.of.Cards.US.s05e13.4K.UHD.WEB.DL", false)] [TestCase("House.of.Cards.US.s05e13.UHD.4K.WEB.DL", false)] + [TestCase("[HorribleSubs] Series Title! S01 [Web][MKV][h264][2160p][AAC 2.0][Softsubs (HorribleSubs)]", false)] public void should_parse_webdl2160p_quality(string title, bool proper) { ParseAndVerifyQuality(title, Quality.WEBDL2160p, proper); diff --git a/src/NzbDrone.Core/Parser/QualityParser.cs b/src/NzbDrone.Core/Parser/QualityParser.cs index 4670c0bc2..fda3ec8e9 100644 --- a/src/NzbDrone.Core/Parser/QualityParser.cs +++ b/src/NzbDrone.Core/Parser/QualityParser.cs @@ -59,6 +59,7 @@ namespace NzbDrone.Core.Parser private static readonly Regex OtherSourceRegex = new Regex(@"(?HD[-_. ]TV)|(?SD[-_. ]TV)", RegexOptions.Compiled | RegexOptions.IgnoreCase); private static readonly Regex AnimeBlurayRegex = new Regex(@"bd(?:720|1080|2160)|(?<=[-_. (\[])bd(?=[-_. )\]])", RegexOptions.Compiled | RegexOptions.IgnoreCase); + private static readonly Regex AnimeWebDlRegex = new Regex(@"\[WEB\]", RegexOptions.Compiled | RegexOptions.IgnoreCase); private static readonly Regex HighDefPdtvRegex = new Regex(@"hr[-_. ]ws", RegexOptions.Compiled | RegexOptions.IgnoreCase); @@ -341,6 +342,39 @@ namespace NzbDrone.Core.Parser return result; } + if (AnimeWebDlRegex.Match(normalizedName).Success) + { + result.SourceDetectionSource = QualityDetectionSource.Name; + + if (resolution == Resolution.R360P || resolution == Resolution.R480P || + resolution == Resolution.R576p || normalizedName.ContainsIgnoreCase("480p")) + { + result.ResolutionDetectionSource = QualityDetectionSource.Name; + result.Quality = Quality.WEBDL480p; + + return result; + } + + if (resolution == Resolution.R1080p || normalizedName.ContainsIgnoreCase("1080p")) + { + result.ResolutionDetectionSource = QualityDetectionSource.Name; + result.Quality = Quality.WEBDL1080p; + + return result; + } + + if (resolution == Resolution.R2160p || normalizedName.ContainsIgnoreCase("2160p")) + { + result.ResolutionDetectionSource = QualityDetectionSource.Name; + result.Quality = Quality.WEBDL2160p; + + return result; + } + + result.Quality = Quality.WEBDL720p; + return result; + } + if (resolution != Resolution.Unknown) { var source = QualitySource.Unknown;