1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-14 11:23:42 +02:00

New: Parsing of '[WEB]' as WebDL

This commit is contained in:
Mark McDowall 2021-01-13 16:57:39 -08:00
parent 8077434a38
commit ba2ca7ee29
2 changed files with 39 additions and 1 deletions

View File

@ -3,7 +3,6 @@
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 @@ public void should_parse_dvd_quality(string title, bool proper)
[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 @@ public void should_parse_hdtv2160p_quality(string title, bool proper)
[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 @@ public void should_parse_webrip720p_quality(string title, bool proper)
[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 @@ public void should_parse_webrip1080p_quality(string title, bool proper)
[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);

View File

@ -59,6 +59,7 @@ public class QualityParser
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);
@ -341,6 +342,39 @@ public static QualityModel ParseQualityName(string name)
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;