|
|
@ -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);
|
|
|
|
|
|
|
|
|
|
|
|