Fixed: Parse 360p releases as base quality instead of 720p

Co-Authored-By: Mark McDowall <markus101@users.noreply.github.com>
This commit is contained in:
Qstick 2020-02-22 16:00:07 -05:00
parent d19321733b
commit deeb2979f1
2 changed files with 14 additions and 7 deletions

View File

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

View File

@ -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>REAL)\b",
RegexOptions.Compiled);
private static readonly Regex ResolutionRegex = new Regex(@"\b(?:(?<R480p>480p|640x480|848x480)|(?<R576p>576p)|(?<R720p>720p|1280x720)|(?<R1080p>1080p|1920x1080|1440p|FHD|1080i)|(?<R2160p>2160p|4k[-_. ](?:UHD|HEVC|BD)|(?:UHD|HEVC|BD)[-_. ]4k))\b",
private static readonly Regex ResolutionRegex = new Regex(@"\b(?:(?<R360p>360p)|(?<R480p>480p|640x480|848x480)|(?<R576p>576p)|(?<R720p>720p|1280x720)|(?<R1080p>1080p|1920x1080|1440p|FHD|1080i)|(?<R2160p>2160p|4k[-_. ](?:UHD|HEVC|BD)|(?:UHD|HEVC|BD)[-_. ]4k))\b",
RegexOptions.Compiled | RegexOptions.IgnoreCase);
private static readonly Regex CodecRegex = new Regex(@"\b(?:(?<x264>x264)|(?<h264>h264)|(?<xvidhd>XvidHD)|(?<xvid>X-?vid)|(?<divx>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,