From 6ad6bf270fd7bad5eec20e3f5b0e6db8918fb556 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 Fixes #5742 (cherry picked from commit ba2ca7ee2929f8ed5411e11e9a96001a37723dcc) --- .../ParserTests/QualityParserFixture.cs | 5 +++ src/NzbDrone.Core/Parser/QualityParser.cs | 34 +++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs index e6254a27c..5e844708d 100644 --- a/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs @@ -86,6 +86,7 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("Glee.S04E10.Glee.Actually.480p.WEB-DL.x264-mSD", false)] [TestCase("The.Big.Bang.Theory.S06E11.The.Santa.Simulation.480p.WEB-DL.x264-mSD", false)] [TestCase("Da.Vincis.Demons.S02E04.480p.WEB.DL.nSD.x264-NhaNc3", false)] + [TestCase("[HorribleSubs] Movie Title! 2018 [Web][MKV][h264][480p][AAC 2.0][Softsubs (HorribleSubs)]", false)] public void should_parse_webdl480p_quality(string title, bool proper) { ParseAndVerifyQuality(title, Source.WEBDL, proper, Resolution.R480p); @@ -145,6 +146,8 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("The.Nightly.Show.2016.03.14.720p.WEB.x264-spamTV", false)] [TestCase("The.Nightly.Show.2016.03.14.720p.WEB.h264-spamTV", false)] [TestCase("BrainDead.S01E01.The.Insanity.Principle.720p.WEB-DL.DD5.1.H.264-BD", false)] + [TestCase("[HorribleSubs] Movie Title! 2018 [Web][MKV][h264][720p][AAC 2.0][Softsubs (HorribleSubs)]", false)] + [TestCase("[HorribleSubs] Movie Title! 2018 [Web][MKV][h264][AAC 2.0][Softsubs (HorribleSubs)]", false)] public void should_parse_webdl720p_quality(string title, bool proper) { ParseAndVerifyQuality(title, Source.WEBDL, proper, Resolution.R720p); @@ -177,6 +180,7 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("Legacies.2020.1080p.AMZN.WEB...", false)] [TestCase("Legacies.2020.1080p.AMZN.WEB.", false)] [TestCase("Movie Title - 2020 1080p Viva MKV WEB", false)] + [TestCase("[HorribleSubs] Movie Title! 2018 [Web][MKV][h264][1080p][AAC 2.0][Softsubs (HorribleSubs)]", false)] public void should_parse_webdl1080p_quality(string title, bool proper) { ParseAndVerifyQuality(title, Source.WEBDL, proper, Resolution.R1080p); @@ -193,6 +197,7 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("The.Nightly.Show.2016.03.14.2160p.WEB.x264-spamTV", false)] [TestCase("The.Nightly.Show.2016.03.14.2160p.WEB.h264-spamTV", false)] [TestCase("The.Nightly.Show.2016.03.14.2160p.WEB.PROPER.h264-spamTV", true)] + [TestCase("[HorribleSubs] Movie Title! 2018 [Web][MKV][h264][2160p][AAC 2.0][Softsubs (HorribleSubs)]", false)] public void should_parse_webdl2160p_quality(string title, bool proper) { ParseAndVerifyQuality(title, Source.WEBDL, proper, Resolution.R2160p); diff --git a/src/NzbDrone.Core/Parser/QualityParser.cs b/src/NzbDrone.Core/Parser/QualityParser.cs index 566be6bfc..02dcb02cc 100644 --- a/src/NzbDrone.Core/Parser/QualityParser.cs +++ b/src/NzbDrone.Core/Parser/QualityParser.cs @@ -69,6 +69,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); @@ -425,6 +426,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 = Source.UNKNOWN;