1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-10-30 07:22:35 +01:00

Fixed: Improved quality parsing from truncated release names

Closes #3345
This commit is contained in:
Mark McDowall 2019-12-29 01:08:25 -08:00
parent fd6d4493c4
commit 562c8c4afe
2 changed files with 6 additions and 4 deletions

View File

@ -222,6 +222,8 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("Played.S01E08.Pro.Gamer.1440p.BKPL.WEB-DL.H.264-LiGHT", false)] [TestCase("Played.S01E08.Pro.Gamer.1440p.BKPL.WEB-DL.H.264-LiGHT", false)]
[TestCase("Good.Luck.Charlie.S04E11.Teddy's.Choice.FHD.1080p.Web-DL", false)] [TestCase("Good.Luck.Charlie.S04E11.Teddy's.Choice.FHD.1080p.Web-DL", false)]
[TestCase("Outlander.S04E03.The.False.Bride.1080p.NF.WEB.DDP5.1.x264-NTb[rartv]", false)] [TestCase("Outlander.S04E03.The.False.Bride.1080p.NF.WEB.DDP5.1.x264-NTb[rartv]", false)]
[TestCase("Legacies.S02E02.This.Year.Will.Be.Different.1080p.AMZN.WEB...", false)]
[TestCase("Legacies.S02E02.This.Year.Will.Be.Different.1080p.AMZN.WEB.", false)]
public void should_parse_webdl1080p_quality(string title, bool proper) public void should_parse_webdl1080p_quality(string title, bool proper)
{ {
ParseAndVerifyQuality(title, Quality.WEBDL1080p, proper); ParseAndVerifyQuality(title, Quality.WEBDL1080p, proper);

View File

@ -16,7 +16,7 @@ namespace NzbDrone.Core.Parser
private static readonly Regex SourceRegex = new Regex(@"\b(?: private static readonly Regex SourceRegex = new Regex(@"\b(?:
(?<bluray>BluRay|Blu-Ray|HD-?DVD|BD(?!$))| (?<bluray>BluRay|Blu-Ray|HD-?DVD|BD(?!$))|
(?<webdl>WEB[-_. ]DL|WEBDL|AmazonHD|iTunesHD|MaxdomeHD|NetflixU?HD|WebHD|[. ]WEB[. ](?:[xh]26[45]|DDP?5[. ]1)|\d+0p[-. ]WEB[-. ]|WEB-DLMux|\b\s\/\sWEB\s\/\s\b)| (?<webdl>WEB[-_. ]DL|WEBDL|AmazonHD|iTunesHD|MaxdomeHD|NetflixU?HD|WebHD|[. ]WEB[. ](?:[xh]26[45]|DDP?5[. ]1)|\d+0p(?:[-. ]AMZN)?[-. ]WEB[-. ]|WEB-DLMux|\b\s\/\sWEB\s\/\s\b|AMZN[. ]WEB[. ])|
(?<webrip>WebRip|Web-Rip|WEBMux)| (?<webrip>WebRip|Web-Rip|WEBMux)|
(?<hdtv>HDTV)| (?<hdtv>HDTV)|
(?<bdrip>BDRip)| (?<bdrip>BDRip)|
@ -26,7 +26,7 @@ namespace NzbDrone.Core.Parser
(?<pdtv>PDTV)| (?<pdtv>PDTV)|
(?<sdtv>SDTV)| (?<sdtv>SDTV)|
(?<tvrip>TVRip) (?<tvrip>TVRip)
)\b", )(?:\b|$|[ .])",
RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace); RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
private static readonly Regex RawHDRegex = new Regex(@"\b(?<rawhd>RawHD|1080i[-_. ]HDTV|Raw[-_. ]HD|MPEG[-_. ]?2)\b", private static readonly Regex RawHDRegex = new Regex(@"\b(?<rawhd>RawHD|1080i[-_. ]HDTV|Raw[-_. ]HD|MPEG[-_. ]?2)\b",
@ -95,8 +95,8 @@ namespace NzbDrone.Core.Parser
return result; return result;
} }
var test = SourceRegex.Matches(normalizedName); var sourceMatches = SourceRegex.Matches(normalizedName);
var sourceMatch = SourceRegex.Matches(normalizedName).OfType<Match>().LastOrDefault(); var sourceMatch = sourceMatches.OfType<Match>().LastOrDefault();
var resolution = ParseResolution(normalizedName); var resolution = ParseResolution(normalizedName);
var codecRegex = CodecRegex.Match(normalizedName); var codecRegex = CodecRegex.Match(normalizedName);
var remuxMatch = RemuxRegex.IsMatch(normalizedName); var remuxMatch = RemuxRegex.IsMatch(normalizedName);