mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-04 10:02:40 +01:00
Fixed: Changed Quality Parser to avoid matching tags in the Episode title instead of the Quality tags.
This commit is contained in:
parent
cd3b6000a0
commit
19d625c6c5
@ -165,6 +165,7 @@ public void should_parse_webdl720p_quality(string title, bool proper)
|
|||||||
[TestCase("Series Title S06E08 1080p WEB h264-EXCLUSIVE", false)]
|
[TestCase("Series Title S06E08 1080p WEB h264-EXCLUSIVE", false)]
|
||||||
[TestCase("Series Title S06E08 No One PROPER 1080p WEB DD5 1 H 264-EXCLUSIVE", true)]
|
[TestCase("Series Title S06E08 No One PROPER 1080p WEB DD5 1 H 264-EXCLUSIVE", true)]
|
||||||
[TestCase("Series Title S06E08 No One PROPER 1080p WEB H 264-EXCLUSIVE", true)]
|
[TestCase("Series Title S06E08 No One PROPER 1080p WEB H 264-EXCLUSIVE", true)]
|
||||||
|
[TestCase("The.Simpsons.S25E21.Pay.Pal.1080p.WEB-DL.DD5.1.H.264-NTb", 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);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
@ -64,137 +65,140 @@ public static QualityModel ParseQuality(string name)
|
|||||||
result.Quality = Quality.RAWHD;
|
result.Quality = Quality.RAWHD;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
var sourceMatch = SourceRegex.Match(normalizedName);
|
var sourceMatch = SourceRegex.Matches(normalizedName).OfType<Match>().LastOrDefault();
|
||||||
var resolution = ParseResolution(normalizedName);
|
var resolution = ParseResolution(normalizedName);
|
||||||
var codecRegex = CodecRegex.Match(normalizedName);
|
var codecRegex = CodecRegex.Match(normalizedName);
|
||||||
|
|
||||||
if (sourceMatch.Groups["bluray"].Success)
|
if (sourceMatch != null && sourceMatch.Success)
|
||||||
{
|
{
|
||||||
if (codecRegex.Groups["xvid"].Success || codecRegex.Groups["divx"].Success)
|
if (sourceMatch.Groups["bluray"].Success)
|
||||||
{
|
{
|
||||||
result.Quality = Quality.DVD;
|
if (codecRegex.Groups["xvid"].Success || codecRegex.Groups["divx"].Success)
|
||||||
return result;
|
{
|
||||||
}
|
|
||||||
|
|
||||||
if (resolution == Resolution._2160p)
|
|
||||||
{
|
|
||||||
result.Quality = Quality.Bluray2160p;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resolution == Resolution._1080p)
|
|
||||||
{
|
|
||||||
result.Quality = Quality.Bluray1080p;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resolution == Resolution._480p || resolution == Resolution._576p)
|
|
||||||
{
|
|
||||||
result.Quality = Quality.DVD;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
result.Quality = Quality.Bluray720p;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sourceMatch.Groups["webdl"].Success)
|
|
||||||
{
|
|
||||||
if (resolution == Resolution._2160p)
|
|
||||||
{
|
|
||||||
result.Quality = Quality.WEBDL2160p;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resolution == Resolution._1080p)
|
|
||||||
{
|
|
||||||
result.Quality = Quality.WEBDL1080p;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resolution == Resolution._720p)
|
|
||||||
{
|
|
||||||
result.Quality = Quality.WEBDL720p;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name.Contains("[WEBDL]"))
|
|
||||||
{
|
|
||||||
result.Quality = Quality.WEBDL720p;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
result.Quality = Quality.WEBDL480p;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sourceMatch.Groups["hdtv"].Success)
|
|
||||||
{
|
|
||||||
if (resolution == Resolution._2160p)
|
|
||||||
{
|
|
||||||
result.Quality = Quality.HDTV2160p;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resolution == Resolution._1080p)
|
|
||||||
{
|
|
||||||
result.Quality = Quality.HDTV1080p;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resolution == Resolution._720p)
|
|
||||||
{
|
|
||||||
result.Quality = Quality.HDTV720p;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name.Contains("[HDTV]"))
|
|
||||||
{
|
|
||||||
result.Quality = Quality.HDTV720p;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
result.Quality = Quality.SDTV;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sourceMatch.Groups["bdrip"].Success ||
|
|
||||||
sourceMatch.Groups["brrip"].Success)
|
|
||||||
{
|
|
||||||
switch (resolution)
|
|
||||||
{
|
|
||||||
case Resolution._720p:
|
|
||||||
result.Quality = Quality.Bluray720p;
|
|
||||||
return result;
|
|
||||||
case Resolution._1080p:
|
|
||||||
result.Quality = Quality.Bluray1080p;
|
|
||||||
return result;
|
|
||||||
default:
|
|
||||||
result.Quality = Quality.DVD;
|
result.Quality = Quality.DVD;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (sourceMatch.Groups["dvd"].Success)
|
if (resolution == Resolution._2160p)
|
||||||
{
|
{
|
||||||
result.Quality = Quality.DVD;
|
result.Quality = Quality.Bluray2160p;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sourceMatch.Groups["pdtv"].Success ||
|
if (resolution == Resolution._1080p)
|
||||||
sourceMatch.Groups["sdtv"].Success ||
|
{
|
||||||
sourceMatch.Groups["dsr"].Success ||
|
result.Quality = Quality.Bluray1080p;
|
||||||
sourceMatch.Groups["tvrip"].Success)
|
return result;
|
||||||
{
|
}
|
||||||
if (HighDefPdtvRegex.IsMatch(normalizedName))
|
|
||||||
{
|
if (resolution == Resolution._480p || resolution == Resolution._576p)
|
||||||
result.Quality = Quality.HDTV720p;
|
{
|
||||||
|
result.Quality = Quality.DVD;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
result.Quality = Quality.Bluray720p;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result.Quality = Quality.SDTV;
|
if (sourceMatch.Groups["webdl"].Success)
|
||||||
return result;
|
{
|
||||||
|
if (resolution == Resolution._2160p)
|
||||||
|
{
|
||||||
|
result.Quality = Quality.WEBDL2160p;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resolution == Resolution._1080p)
|
||||||
|
{
|
||||||
|
result.Quality = Quality.WEBDL1080p;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resolution == Resolution._720p)
|
||||||
|
{
|
||||||
|
result.Quality = Quality.WEBDL720p;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name.Contains("[WEBDL]"))
|
||||||
|
{
|
||||||
|
result.Quality = Quality.WEBDL720p;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
result.Quality = Quality.WEBDL480p;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sourceMatch.Groups["hdtv"].Success)
|
||||||
|
{
|
||||||
|
if (resolution == Resolution._2160p)
|
||||||
|
{
|
||||||
|
result.Quality = Quality.HDTV2160p;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resolution == Resolution._1080p)
|
||||||
|
{
|
||||||
|
result.Quality = Quality.HDTV1080p;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resolution == Resolution._720p)
|
||||||
|
{
|
||||||
|
result.Quality = Quality.HDTV720p;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name.Contains("[HDTV]"))
|
||||||
|
{
|
||||||
|
result.Quality = Quality.HDTV720p;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
result.Quality = Quality.SDTV;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sourceMatch.Groups["bdrip"].Success ||
|
||||||
|
sourceMatch.Groups["brrip"].Success)
|
||||||
|
{
|
||||||
|
switch (resolution)
|
||||||
|
{
|
||||||
|
case Resolution._720p:
|
||||||
|
result.Quality = Quality.Bluray720p;
|
||||||
|
return result;
|
||||||
|
case Resolution._1080p:
|
||||||
|
result.Quality = Quality.Bluray1080p;
|
||||||
|
return result;
|
||||||
|
default:
|
||||||
|
result.Quality = Quality.DVD;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sourceMatch.Groups["dvd"].Success)
|
||||||
|
{
|
||||||
|
result.Quality = Quality.DVD;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sourceMatch.Groups["pdtv"].Success ||
|
||||||
|
sourceMatch.Groups["sdtv"].Success ||
|
||||||
|
sourceMatch.Groups["dsr"].Success ||
|
||||||
|
sourceMatch.Groups["tvrip"].Success)
|
||||||
|
{
|
||||||
|
if (HighDefPdtvRegex.IsMatch(normalizedName))
|
||||||
|
{
|
||||||
|
result.Quality = Quality.HDTV720p;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
result.Quality = Quality.SDTV;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -304,7 +308,7 @@ public static QualityModel ParseQuality(string name)
|
|||||||
}
|
}
|
||||||
catch (ArgumentException)
|
catch (ArgumentException)
|
||||||
{
|
{
|
||||||
//Swallow exception for cases where string contains illegal
|
//Swallow exception for cases where string contains illegal
|
||||||
//path characters.
|
//path characters.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user