New: Parsing of '[WEB]' as WebDL

Fixes #5742

(cherry picked from commit ba2ca7ee2929f8ed5411e11e9a96001a37723dcc)
This commit is contained in:
Mark McDowall 2021-01-13 16:57:39 -08:00 committed by Qstick
parent 2237624333
commit 6ad6bf270f
2 changed files with 39 additions and 0 deletions

View File

@ -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);

View File

@ -69,6 +69,7 @@ namespace NzbDrone.Core.Parser
private static readonly Regex OtherSourceRegex = new Regex(@"(?<hdtv>HD[-_. ]TV)|(?<sdtv>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;