mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-23 06:45:19 -07:00
This commit is contained in:
parent
d42165a93a
commit
8e8c4ff497
3 changed files with 20 additions and 5 deletions
|
@ -265,7 +265,6 @@ namespace NzbDrone.Core.DecisionEngine
|
||||||
e.Data.Add("parsed", remoteEpisode.ParsedEpisodeInfo.ToJson());
|
e.Data.Add("parsed", remoteEpisode.ParsedEpisodeInfo.ToJson());
|
||||||
_logger.Error(e, "Couldn't evaluate decision on " + remoteEpisode.Release.Title + ", with spec: " + spec.GetType().Name);
|
_logger.Error(e, "Couldn't evaluate decision on " + remoteEpisode.Release.Title + ", with spec: " + spec.GetType().Name);
|
||||||
return new Rejection(string.Format("{0}: {1}", spec.GetType().Name, e.Message));//TODO UPDATE SPECS!
|
return new Rejection(string.Format("{0}: {1}", spec.GetType().Name, e.Message));//TODO UPDATE SPECS!
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -189,7 +189,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
||||||
{
|
{
|
||||||
var lowerTitle = title.ToLower();
|
var lowerTitle = title.ToLower();
|
||||||
|
|
||||||
var parserResult = Parser.Parser.ParseMovieTitle(title);
|
var parserResult = Parser.Parser.ParseMovieTitle(title, true);
|
||||||
|
|
||||||
var yearTerm = "";
|
var yearTerm = "";
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,15 @@ namespace NzbDrone.Core.Parser
|
||||||
//PassThePopcorn Torrent names: Star.Wars[PassThePopcorn]
|
//PassThePopcorn Torrent names: Star.Wars[PassThePopcorn]
|
||||||
new Regex(@"^(?<title>.+?)?(?:(?:[-_\W](?<![()\[!]))*(?<year>(\[\w *\])))+(\W+|_|$)(?!\\)",
|
new Regex(@"^(?<title>.+?)?(?:(?:[-_\W](?<![()\[!]))*(?<year>(\[\w *\])))+(\W+|_|$)(?!\\)",
|
||||||
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
||||||
|
//That did not work? Maybe some tool uses [] for years. Who would do that?
|
||||||
|
new Regex(@"^(?<title>.+?)?(?:(?:[-_\W](?<![)!]))*(?<year>(19|20)\d{2}(?!p|i|\d+|\W\d+)))+(\W+|_|$)(?!\\)",
|
||||||
|
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
||||||
|
};
|
||||||
|
|
||||||
|
private static readonly Regex[] ReportMovieTitleFolderRegex = new[]
|
||||||
|
{
|
||||||
|
//When year comes first.
|
||||||
|
new Regex(@"^(?:(?:[-_\W](?<![)!]))*(?<year>(19|20)\d{2}(?!p|i|\d+|\W\d+)))+(\W+|_|$)(?<title>.+?)?$")
|
||||||
};
|
};
|
||||||
|
|
||||||
private static readonly Regex[] ReportTitleRegex = new[]
|
private static readonly Regex[] ReportTitleRegex = new[]
|
||||||
|
@ -327,7 +336,7 @@ namespace NzbDrone.Core.Parser
|
||||||
{
|
{
|
||||||
var fileInfo = new FileInfo(path);
|
var fileInfo = new FileInfo(path);
|
||||||
|
|
||||||
var result = ParseMovieTitle(fileInfo.Name);
|
var result = ParseMovieTitle(fileInfo.Name, true);
|
||||||
|
|
||||||
if (result == null)
|
if (result == null)
|
||||||
{
|
{
|
||||||
|
@ -345,7 +354,7 @@ namespace NzbDrone.Core.Parser
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ParsedMovieInfo ParseMovieTitle(string title)
|
public static ParsedMovieInfo ParseMovieTitle(string title, bool isDir = false)
|
||||||
{
|
{
|
||||||
|
|
||||||
ParsedMovieInfo realResult = null;
|
ParsedMovieInfo realResult = null;
|
||||||
|
@ -376,7 +385,14 @@ namespace NzbDrone.Core.Parser
|
||||||
|
|
||||||
simpleTitle = CleanTorrentSuffixRegex.Replace(simpleTitle, string.Empty);
|
simpleTitle = CleanTorrentSuffixRegex.Replace(simpleTitle, string.Empty);
|
||||||
|
|
||||||
foreach (var regex in ReportMovieTitleRegex)
|
var allRegexes = ReportMovieTitleRegex.ToList();
|
||||||
|
|
||||||
|
if (isDir)
|
||||||
|
{
|
||||||
|
allRegexes.AddRange(ReportMovieTitleFolderRegex);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var regex in allRegexes)
|
||||||
{
|
{
|
||||||
var match = regex.Matches(simpleTitle);
|
var match = regex.Matches(simpleTitle);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue