1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-09-11 12:02:35 +02:00

Parser now recognizes Hardcoded subs. By default these releases are rejected. However, they can still be manually downloaded.

This commit is contained in:
Leonardo Galli 2017-01-06 14:38:52 +01:00
parent 145c2ca4a4
commit cd310626e9
3 changed files with 31 additions and 3 deletions

View File

@ -81,9 +81,18 @@ private IEnumerable<DownloadDecision> GetMovieDecisions(List<ReleaseInfo> report
}
else
{
remoteEpisode.DownloadAllowed = true;
//decision = GetDecisionForReport(remoteEpisode, searchCriteria); TODO: Rewrite this for movies!
decision = new DownloadDecision(remoteEpisode);
if (parsedEpisodeInfo.Quality.HardcodedSubs.IsNotNullOrWhiteSpace())
{
remoteEpisode.DownloadAllowed = true;
decision = new DownloadDecision(remoteEpisode, new Rejection("Hardcoded subs found: " + parsedEpisodeInfo.Quality.HardcodedSubs));
}
else
{
remoteEpisode.DownloadAllowed = true;
//decision = GetDecisionForReport(remoteEpisode, searchCriteria); TODO: Rewrite this for movies!
decision = new DownloadDecision(remoteEpisode);
}
}
}
}

View File

@ -28,6 +28,8 @@ public class QualityParser
)\b",
RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
private static readonly Regex HardcodedSubsRegex = new Regex(@"\b(?<hcsub>(\w+SUB))|(?<hc>(HC))\b", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
private static readonly Regex RawHDRegex = new Regex(@"\b(?<rawhd>RawHD|1080i[-_. ]HDTV|Raw[-_. ]HD|MPEG[-_. ]?2)\b",
RegexOptions.Compiled | RegexOptions.IgnoreCase);
@ -59,6 +61,19 @@ public static QualityModel ParseQuality(string name)
name = name.Trim();
var normalizedName = name.Replace('_', ' ').Trim().ToLower();
var result = ParseQualityModifiers(name, normalizedName);
var subMatch = HardcodedSubsRegex.Matches(normalizedName).OfType<Match>().LastOrDefault();
if (subMatch != null && subMatch.Success)
{
if (subMatch.Groups["hcsub"].Success)
{
result.HardcodedSubs = subMatch.Groups["hcsub"].Value;
}
else if (subMatch.Groups["hc"].Success)
{
result.HardcodedSubs = "Generic Hardcoded Subs";
}
}
if (RawHDRegex.IsMatch(normalizedName))
{
@ -69,6 +84,7 @@ public static QualityModel ParseQuality(string name)
var sourceMatch = SourceRegex.Matches(normalizedName).OfType<Match>().LastOrDefault();
var resolution = ParseResolution(normalizedName);
var codecRegex = CodecRegex.Match(normalizedName);
if (sourceMatch != null && sourceMatch.Success)
{
@ -201,6 +217,8 @@ public static QualityModel ParseQuality(string name)
}
}
//Anime Bluray matching
if (AnimeBlurayRegex.Match(normalizedName).Success)

View File

@ -8,6 +8,7 @@ public class QualityModel : IEmbeddedDocument, IEquatable<QualityModel>
{
public Quality Quality { get; set; }
public Revision Revision { get; set; }
public string HardcodedSubs { get; set; }
[JsonIgnore]
public QualitySource QualitySource { get; set; }