|
|
@ -54,9 +54,6 @@ namespace NzbDrone.Core.Organizer
|
|
|
|
public static readonly Regex SeriesTitleRegex = new Regex(@"(?<token>\{(?:Series)(?<separator>[- ._])(Clean)?Title\})",
|
|
|
|
public static readonly Regex SeriesTitleRegex = new Regex(@"(?<token>\{(?:Series)(?<separator>[- ._])(Clean)?Title\})",
|
|
|
|
RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
|
|
|
RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
|
|
|
|
|
|
|
|
|
|
|
private static readonly Regex OriginalTitleRegex = new Regex(@"(\^{original[- ._]title\}$)",
|
|
|
|
|
|
|
|
RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static readonly Regex FileNameCleanupRegex = new Regex(@"([- ._])(\1)+", RegexOptions.Compiled);
|
|
|
|
private static readonly Regex FileNameCleanupRegex = new Regex(@"([- ._])(\1)+", RegexOptions.Compiled);
|
|
|
|
private static readonly Regex TrimSeparatorsRegex = new Regex(@"[- ._]$", RegexOptions.Compiled);
|
|
|
|
private static readonly Regex TrimSeparatorsRegex = new Regex(@"[- ._]$", RegexOptions.Compiled);
|
|
|
|
|
|
|
|
|
|
|
@ -420,6 +417,7 @@ namespace NzbDrone.Core.Organizer
|
|
|
|
private void AddEpisodeFileTokens(Dictionary<String, Func<TokenMatch, String>> tokenHandlers, Series series, EpisodeFile episodeFile)
|
|
|
|
private void AddEpisodeFileTokens(Dictionary<String, Func<TokenMatch, String>> tokenHandlers, Series series, EpisodeFile episodeFile)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
tokenHandlers["{Original Title}"] = m => GetOriginalTitle(episodeFile);
|
|
|
|
tokenHandlers["{Original Title}"] = m => GetOriginalTitle(episodeFile);
|
|
|
|
|
|
|
|
tokenHandlers["{Original Filename}"] = m => GetOriginalFileName(episodeFile);
|
|
|
|
tokenHandlers["{Release Group}"] = m => episodeFile.ReleaseGroup ?? "DRONE";
|
|
|
|
tokenHandlers["{Release Group}"] = m => episodeFile.ReleaseGroup ?? "DRONE";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -649,7 +647,7 @@ namespace NzbDrone.Core.Organizer
|
|
|
|
}).ToArray());
|
|
|
|
}).ToArray());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private String GetEpisodeTitle(List<Episode> episodes)
|
|
|
|
private string GetEpisodeTitle(List<Episode> episodes)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (episodes.Count == 1)
|
|
|
|
if (episodes.Count == 1)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -664,7 +662,7 @@ namespace NzbDrone.Core.Organizer
|
|
|
|
return String.Join(" + ", titles);
|
|
|
|
return String.Join(" + ", titles);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private String GetQualityProper(Series series, QualityModel quality)
|
|
|
|
private string GetQualityProper(Series series, QualityModel quality)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (quality.Revision.Version > 1)
|
|
|
|
if (quality.Revision.Version > 1)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -679,20 +677,25 @@ namespace NzbDrone.Core.Organizer
|
|
|
|
return String.Empty;
|
|
|
|
return String.Empty;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private String GetOriginalTitle(EpisodeFile episodeFile)
|
|
|
|
private string GetOriginalTitle(EpisodeFile episodeFile)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (episodeFile.SceneName.IsNullOrWhiteSpace())
|
|
|
|
if (episodeFile.SceneName.IsNullOrWhiteSpace())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (episodeFile.RelativePath.IsNullOrWhiteSpace())
|
|
|
|
return GetOriginalFileName(episodeFile);
|
|
|
|
{
|
|
|
|
|
|
|
|
return Path.GetFileNameWithoutExtension(episodeFile.Path);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Path.GetFileNameWithoutExtension(episodeFile.RelativePath);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return episodeFile.SceneName;
|
|
|
|
return episodeFile.SceneName;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private string GetOriginalFileName(EpisodeFile episodeFile)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (episodeFile.RelativePath.IsNullOrWhiteSpace())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return Path.GetFileNameWithoutExtension(episodeFile.Path);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Path.GetFileNameWithoutExtension(episodeFile.RelativePath);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
internal sealed class TokenMatch
|
|
|
|
internal sealed class TokenMatch
|
|
|
|