mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-25 22:37:27 -04:00
New: Custom Format Updates (#8067)
This commit is contained in:
@@ -18,6 +18,9 @@ namespace NzbDrone.Core.Parser
|
||||
|
||||
private static readonly Regex ReportEditionRegex = new Regex(@"^.+?" + EditionRegex, RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
private static readonly Regex HardcodedSubsRegex = new Regex(@"\b((?<hcsub>(\w+(?<!SOFT|HORRIBLE)SUBS?))|(?<hc>(HC|SUBBED)))\b",
|
||||
RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
|
||||
|
||||
private static readonly RegexReplace[] PreSubstitutionRegex = Array.Empty<RegexReplace>();
|
||||
|
||||
private static readonly Regex[] ReportMovieTitleRegex = new[]
|
||||
@@ -295,6 +298,8 @@ namespace NzbDrone.Core.Parser
|
||||
result.ReleaseGroup = subGroup;
|
||||
}
|
||||
|
||||
result.HardcodedSubs = ParseHardcodeSubs(title);
|
||||
|
||||
Logger.Debug("Release Group parsed: {0}", result.ReleaseGroup);
|
||||
|
||||
result.Languages = LanguageParser.ParseLanguages(result.ReleaseGroup.IsNotNullOrWhiteSpace() ? simpleReleaseTitle.Replace(result.ReleaseGroup, "RlsGrp") : simpleReleaseTitle);
|
||||
@@ -491,6 +496,25 @@ namespace NzbDrone.Core.Parser
|
||||
return SimpleReleaseTitleRegex.Replace(title, string.Empty);
|
||||
}
|
||||
|
||||
public static string ParseHardcodeSubs(string title)
|
||||
{
|
||||
var subMatch = HardcodedSubsRegex.Matches(title).OfType<Match>().LastOrDefault();
|
||||
|
||||
if (subMatch != null && subMatch.Success)
|
||||
{
|
||||
if (subMatch.Groups["hcsub"].Success)
|
||||
{
|
||||
return subMatch.Groups["hcsub"].Value;
|
||||
}
|
||||
else if (subMatch.Groups["hc"].Success)
|
||||
{
|
||||
return "Generic Hardcoded Subs";
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static string ParseReleaseGroup(string title)
|
||||
{
|
||||
title = title.Trim();
|
||||
|
||||
Reference in New Issue
Block a user