mirror of
https://github.com/Radarr/Radarr.git
synced 2024-10-27 06:02:33 +01:00
Fixed: Parse WEB at end of Release Title, Improve truncated names
Co-Authored-By: Mark McDowall <markus101@users.noreply.github.com>
This commit is contained in:
parent
874b1bd17c
commit
d01c0afa56
@ -164,6 +164,9 @@ public void should_parse_webrip720p_quality(string title, bool proper)
|
||||
[TestCase("The.Simpsons.S25E21.Pay.Pal.1080p.WEB-DL.DD5.1.H.264-NTb", false)]
|
||||
[TestCase("The.Simpsons.2017.1080p.WEB-DL.DD5.1.H.264.Remux.-NTb", false)]
|
||||
[TestCase("Fast.and.Furious.Presents.Hobbs.and.Shaw.2019.1080p.AMZN.WEB-DL.DDP5.1.H.264-NTG", false)]
|
||||
[TestCase("Legacies.2020.1080p.AMZN.WEB...", false)]
|
||||
[TestCase("Legacies.2020.1080p.AMZN.WEB.", false)]
|
||||
[TestCase("Movie Title - 2020 1080p Viva MKV WEB", false)]
|
||||
public void should_parse_webdl1080p_quality(string title, bool proper)
|
||||
{
|
||||
ParseAndVerifyQuality(title, Source.WEBDL, proper, Resolution.R1080p);
|
||||
@ -334,8 +337,8 @@ public void should_parse_quality_from_extension(string title)
|
||||
QualityParser.ParseQuality(title).QualityDetectionSource.Should().Be(QualityDetectionSource.Extension);
|
||||
}
|
||||
|
||||
[TestCase("Movie.Title.2016.1080p.KORSUB.WEBRip.x264.AAC2.0-RADARR", "korsub")]
|
||||
[TestCase("Movie.Title.2016.1080p.KORSUBS.WEBRip.x264.AAC2.0-RADARR", "korsubs")]
|
||||
[TestCase("Movie.Title.2016.1080p.KORSUB.WEBRip.x264.AAC2.0-RADARR", "KORSUB")]
|
||||
[TestCase("Movie.Title.2016.1080p.KORSUBS.WEBRip.x264.AAC2.0-RADARR", "KORSUBS")]
|
||||
[TestCase("Wonder Woman 2017 HC 720p HDRiP DD5 1 x264-LEGi0N", "Generic Hardcoded Subs")]
|
||||
[TestCase("Ghost.In.The.Shell.2017.720p.SUBBED.HDRip.V2.XViD-26k.avi", "Generic Hardcoded Subs")]
|
||||
public void should_parse_hardcoded_subs(string postTitle, string sub)
|
||||
|
@ -16,7 +16,7 @@ public class QualityParser
|
||||
|
||||
private static readonly Regex SourceRegex = new Regex(@"\b(?:
|
||||
(?<bluray>M?BluRay|Blu-Ray|HDDVD|BD(?!$)|BDISO|BD25|BD50|BR.?DISK)|
|
||||
(?<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)|[. ](?-i:WEB)$|\d+0p(?:[-. ]AMZN)?[-. ]WEB[-. ]|WEB-DLMux|\b\s\/\sWEB\s\/\s\b|AMZN[. ]WEB[. ])|
|
||||
(?<webrip>WebRip|Web-Rip|WEBMux)|
|
||||
(?<hdtv>HDTV)|
|
||||
(?<bdrip>BDRip)|
|
||||
@ -33,7 +33,7 @@ public class QualityParser
|
||||
(?<pdtv>PDTV)|
|
||||
(?<sdtv>SDTV)|
|
||||
(?<tvrip>TVRip)
|
||||
)\b",
|
||||
)(?:\b|$|[ .])",
|
||||
RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
|
||||
|
||||
private static readonly Regex RawHDRegex = new Regex(@"\b(?<rawhd>RawHD|1080i[-_. ]HDTV|Raw[-_. ]HD|MPEG[-_. ]?2)\b",
|
||||
@ -101,7 +101,7 @@ public static QualityModel ParseQuality(string name)
|
||||
|
||||
public static QualityModel ParseQualityName(string name)
|
||||
{
|
||||
var normalizedName = name.Replace('_', ' ').Trim().ToLower();
|
||||
var normalizedName = name.Replace('_', ' ').Trim();
|
||||
var result = ParseQualityModifiers(name, normalizedName);
|
||||
var subMatch = HardcodedSubsRegex.Matches(normalizedName).OfType<Match>().LastOrDefault();
|
||||
|
||||
@ -117,8 +117,8 @@ public static QualityModel ParseQualityName(string name)
|
||||
}
|
||||
}
|
||||
|
||||
var test = SourceRegex.Matches(normalizedName);
|
||||
var sourceMatch = SourceRegex.Matches(normalizedName).OfType<Match>().LastOrDefault();
|
||||
var sourceMatches = SourceRegex.Matches(normalizedName);
|
||||
var sourceMatch = sourceMatches.OfType<Match>().LastOrDefault();
|
||||
var resolution = ParseResolution(normalizedName);
|
||||
var codecRegex = CodecRegex.Match(normalizedName);
|
||||
var remuxMatch = RemuxRegex.IsMatch(normalizedName);
|
||||
@ -328,13 +328,13 @@ public static QualityModel ParseQualityName(string name)
|
||||
sourceMatch.Groups["dsr"].Success ||
|
||||
sourceMatch.Groups["tvrip"].Success)
|
||||
{
|
||||
if (resolution == Resolution.R1080p || normalizedName.Contains("1080p"))
|
||||
if (resolution == Resolution.R1080p || normalizedName.ContainsIgnoreCase("1080p"))
|
||||
{
|
||||
result.Quality = Quality.HDTV1080p;
|
||||
return result;
|
||||
}
|
||||
|
||||
if (resolution == Resolution.R720p || normalizedName.Contains("720p"))
|
||||
if (resolution == Resolution.R720p || normalizedName.ContainsIgnoreCase("720p"))
|
||||
{
|
||||
result.Quality = Quality.HDTV720p;
|
||||
return result;
|
||||
@ -354,19 +354,19 @@ public static QualityModel ParseQualityName(string name)
|
||||
// Anime Bluray matching
|
||||
if (AnimeBlurayRegex.Match(normalizedName).Success)
|
||||
{
|
||||
if (resolution == Resolution.R360p || resolution == Resolution.R480p || resolution == Resolution.R576p || normalizedName.Contains("480p"))
|
||||
if (resolution == Resolution.R360p || resolution == Resolution.R480p || resolution == Resolution.R576p || normalizedName.ContainsIgnoreCase("480p"))
|
||||
{
|
||||
result.Quality = Quality.DVD;
|
||||
return result;
|
||||
}
|
||||
|
||||
if (resolution == Resolution.R1080p || normalizedName.Contains("1080p"))
|
||||
if (resolution == Resolution.R1080p || normalizedName.ContainsIgnoreCase("1080p"))
|
||||
{
|
||||
result.Quality = remuxMatch ? Quality.Remux1080p : Quality.Bluray1080p;
|
||||
return result;
|
||||
}
|
||||
|
||||
if (resolution == Resolution.R2160p || normalizedName.Contains("2160p"))
|
||||
if (resolution == Resolution.R2160p || normalizedName.ContainsIgnoreCase("2160p"))
|
||||
{
|
||||
result.Quality = remuxMatch ? Quality.Remux2160p : Quality.Bluray2160p;
|
||||
return result;
|
||||
@ -413,9 +413,9 @@ public static QualityModel ParseQualityName(string name)
|
||||
return result;
|
||||
}
|
||||
|
||||
if (normalizedName.Contains("848x480"))
|
||||
if (normalizedName.ContainsIgnoreCase("848x480"))
|
||||
{
|
||||
if (normalizedName.Contains("dvd"))
|
||||
if (normalizedName.ContainsIgnoreCase("dvd"))
|
||||
{
|
||||
result.Quality = Quality.DVD;
|
||||
}
|
||||
@ -423,9 +423,9 @@ public static QualityModel ParseQualityName(string name)
|
||||
result.Quality = Quality.SDTV;
|
||||
}
|
||||
|
||||
if (normalizedName.Contains("1280x720"))
|
||||
if (normalizedName.ContainsIgnoreCase("1280x720"))
|
||||
{
|
||||
if (normalizedName.Contains("bluray"))
|
||||
if (normalizedName.ContainsIgnoreCase("bluray"))
|
||||
{
|
||||
result.Quality = Quality.Bluray720p;
|
||||
}
|
||||
@ -433,9 +433,9 @@ public static QualityModel ParseQualityName(string name)
|
||||
result.Quality = Quality.HDTV720p;
|
||||
}
|
||||
|
||||
if (normalizedName.Contains("1920x1080"))
|
||||
if (normalizedName.ContainsIgnoreCase("1920x1080"))
|
||||
{
|
||||
if (normalizedName.Contains("bluray"))
|
||||
if (normalizedName.ContainsIgnoreCase("bluray"))
|
||||
{
|
||||
result.Quality = Quality.Bluray1080p;
|
||||
}
|
||||
@ -443,17 +443,17 @@ public static QualityModel ParseQualityName(string name)
|
||||
result.Quality = Quality.HDTV1080p;
|
||||
}
|
||||
|
||||
if (normalizedName.Contains("bluray720p"))
|
||||
if (normalizedName.ContainsIgnoreCase("bluray720p"))
|
||||
{
|
||||
result.Quality = Quality.Bluray720p;
|
||||
}
|
||||
|
||||
if (normalizedName.Contains("bluray1080p"))
|
||||
if (normalizedName.ContainsIgnoreCase("bluray1080p"))
|
||||
{
|
||||
result.Quality = Quality.Bluray1080p;
|
||||
}
|
||||
|
||||
if (normalizedName.Contains("bluray2160p"))
|
||||
if (normalizedName.ContainsIgnoreCase("bluray2160p"))
|
||||
{
|
||||
result.Quality = Quality.Bluray2160p;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user