mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Fixed: Remove Static/Dynamic Settings, Allow Folder Move from Editor
This commit is contained in:
@@ -18,7 +18,6 @@ namespace NzbDrone.Core.Organizer
|
||||
{
|
||||
string BuildFileName(Movie movie, MovieFile movieFile, NamingConfig namingConfig = null);
|
||||
string BuildFilePath(Movie movie, string fileName, string extension);
|
||||
string BuildMoviePath(Movie movie, NamingConfig namingConfig = null);
|
||||
BasicNamingConfig GetBasicNamingConfig(NamingConfig nameSpec);
|
||||
string GetMovieFolder(Movie movie, NamingConfig namingConfig = null);
|
||||
}
|
||||
@@ -110,59 +109,11 @@ namespace NzbDrone.Core.Organizer
|
||||
{
|
||||
Ensure.That(extension, () => extension).IsNotNullOrWhiteSpace();
|
||||
|
||||
var path = "";
|
||||
|
||||
if (movie.PathState > 0)
|
||||
{
|
||||
path = movie.Path;
|
||||
}
|
||||
else
|
||||
{
|
||||
path = BuildMoviePath(movie);
|
||||
}
|
||||
var path = movie.Path;
|
||||
|
||||
return Path.Combine(path, fileName + extension);
|
||||
}
|
||||
|
||||
public string BuildMoviePath(Movie movie, NamingConfig namingConfig = null)
|
||||
{
|
||||
if (namingConfig == null)
|
||||
{
|
||||
namingConfig = _namingConfigService.GetConfig();
|
||||
}
|
||||
|
||||
var path = movie.Path;
|
||||
var directory = new DirectoryInfo(path).Name;
|
||||
var parentDirectoryPath = new DirectoryInfo(path).Parent.FullName;
|
||||
|
||||
var movieFile = movie.MovieFile;
|
||||
|
||||
var pattern = namingConfig.MovieFolderFormat;
|
||||
var tokenHandlers = new Dictionary<string, Func<TokenMatch, string>>(FileNameBuilderTokenEqualityComparer.Instance);
|
||||
|
||||
AddMovieTokens(tokenHandlers, movie);
|
||||
AddReleaseDateTokens(tokenHandlers, movie.Year);
|
||||
AddIdTokens(tokenHandlers, movie);
|
||||
|
||||
if (movie.MovieFile != null)
|
||||
{
|
||||
AddQualityTokens(tokenHandlers, movie, movieFile);
|
||||
AddMediaInfoTokens(tokenHandlers, movieFile);
|
||||
AddMovieFileTokens(tokenHandlers, movieFile);
|
||||
AddTagsTokens(tokenHandlers, movieFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddMovieFileTokens(tokenHandlers, new MovieFile { SceneName = $"{movie.Title} {movie.Year}", RelativePath = $"{movie.Title} {movie.Year}" });
|
||||
}
|
||||
|
||||
var directoryName = ReplaceTokens(pattern, tokenHandlers, namingConfig).Trim();
|
||||
directoryName = FileNameCleanupRegex.Replace(directoryName, match => match.Captures[0].Value[0].ToString());
|
||||
directoryName = TrimSeparatorsRegex.Replace(directoryName, string.Empty);
|
||||
|
||||
return Path.Combine(parentDirectoryPath, directoryName);
|
||||
}
|
||||
|
||||
public BasicNamingConfig GetBasicNamingConfig(NamingConfig nameSpec)
|
||||
{
|
||||
return new BasicNamingConfig(); //For now let's be lazy
|
||||
|
Reference in New Issue
Block a user