mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 13:33:34 -07:00
Parser now recognizes Hardcoded subs. By default these releases are rejected. However, they can still be manually downloaded.
This commit is contained in:
parent
145c2ca4a4
commit
cd310626e9
3 changed files with 31 additions and 3 deletions
|
@ -80,11 +80,20 @@ namespace NzbDrone.Core.DecisionEngine
|
||||||
decision = new DownloadDecision(remoteEpisode, new Rejection("Unknown release. Movie not Found."));
|
decision = new DownloadDecision(remoteEpisode, new Rejection("Unknown release. Movie not Found."));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (parsedEpisodeInfo.Quality.HardcodedSubs.IsNotNullOrWhiteSpace())
|
||||||
|
{
|
||||||
|
remoteEpisode.DownloadAllowed = true;
|
||||||
|
decision = new DownloadDecision(remoteEpisode, new Rejection("Hardcoded subs found: " + parsedEpisodeInfo.Quality.HardcodedSubs));
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
remoteEpisode.DownloadAllowed = true;
|
remoteEpisode.DownloadAllowed = true;
|
||||||
//decision = GetDecisionForReport(remoteEpisode, searchCriteria); TODO: Rewrite this for movies!
|
//decision = GetDecisionForReport(remoteEpisode, searchCriteria); TODO: Rewrite this for movies!
|
||||||
decision = new DownloadDecision(remoteEpisode);
|
decision = new DownloadDecision(remoteEpisode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|
|
@ -28,6 +28,8 @@ namespace NzbDrone.Core.Parser
|
||||||
)\b",
|
)\b",
|
||||||
RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
|
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",
|
private static readonly Regex RawHDRegex = new Regex(@"\b(?<rawhd>RawHD|1080i[-_. ]HDTV|Raw[-_. ]HD|MPEG[-_. ]?2)\b",
|
||||||
RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||||
|
|
||||||
|
@ -59,6 +61,19 @@ namespace NzbDrone.Core.Parser
|
||||||
name = name.Trim();
|
name = name.Trim();
|
||||||
var normalizedName = name.Replace('_', ' ').Trim().ToLower();
|
var normalizedName = name.Replace('_', ' ').Trim().ToLower();
|
||||||
var result = ParseQualityModifiers(name, normalizedName);
|
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))
|
if (RawHDRegex.IsMatch(normalizedName))
|
||||||
{
|
{
|
||||||
|
@ -70,6 +85,7 @@ namespace NzbDrone.Core.Parser
|
||||||
var resolution = ParseResolution(normalizedName);
|
var resolution = ParseResolution(normalizedName);
|
||||||
var codecRegex = CodecRegex.Match(normalizedName);
|
var codecRegex = CodecRegex.Match(normalizedName);
|
||||||
|
|
||||||
|
|
||||||
if (sourceMatch != null && sourceMatch.Success)
|
if (sourceMatch != null && sourceMatch.Success)
|
||||||
{
|
{
|
||||||
if (sourceMatch.Groups["bluray"].Success)
|
if (sourceMatch.Groups["bluray"].Success)
|
||||||
|
@ -202,6 +218,8 @@ namespace NzbDrone.Core.Parser
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Anime Bluray matching
|
//Anime Bluray matching
|
||||||
if (AnimeBlurayRegex.Match(normalizedName).Success)
|
if (AnimeBlurayRegex.Match(normalizedName).Success)
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,6 +8,7 @@ namespace NzbDrone.Core.Qualities
|
||||||
{
|
{
|
||||||
public Quality Quality { get; set; }
|
public Quality Quality { get; set; }
|
||||||
public Revision Revision { get; set; }
|
public Revision Revision { get; set; }
|
||||||
|
public string HardcodedSubs { get; set; }
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public QualitySource QualitySource { get; set; }
|
public QualitySource QualitySource { get; set; }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue