mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-17 15:02:34 +02:00
Added: Dynamic paths cleanup old folders now!
Old folder is now only left behind if extra files are also present in new dir and cannot be overwritten. Generally Dynamic Paths should be more stable now. Fixes #2048
This commit is contained in:
parent
a5dd426dd7
commit
b1f76082b2
File diff suppressed because it is too large
Load Diff
7
src/.idea/.idea.NzbDrone/.idea/indexLayout.xml
Normal file
7
src/.idea/.idea.NzbDrone/.idea/indexLayout.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ContentModelUserStore">
|
||||||
|
<explicitIncludes />
|
||||||
|
<explicitExcludes />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -1,103 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<module type="RIDER_MODULE" version="4">
|
<module type="RIDER_MODULE" version="4">
|
||||||
<component name="NewModuleRootManager">
|
<component name="NewModuleRootManager">
|
||||||
<content url="file://$MODULE_DIR$/../../../Logo/1024.png">
|
<content url="file://$MODULE_DIR$/../../../Logo/1024.png" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../../Logo/1024.png" isTestSource="false" />
|
<content url="file://$MODULE_DIR$/../../../Logo/64.png" />
|
||||||
</content>
|
<content url="file://$MODULE_DIR$/../.." />
|
||||||
<content url="file://$MODULE_DIR$/../../../Logo/64.png">
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../../Logo/64.png" isTestSource="false" />
|
|
||||||
</content>
|
|
||||||
<content url="file://$MODULE_DIR$/../..">
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../.nuget/NuGet.exe" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../Common/CommonAssemblyInfo.cs" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../Common/CommonVersionInfo.cs" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../Common/GlobalSuppressions.cs" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../ExternalModules/CurlSharp/CurlSharp" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../Libraries/MediaInfo/libmediainfo.0.dylib" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../Libraries/MediaInfo/MediaInfo.dll" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../Libraries/Sqlite/libsqlite3.0.dylib" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../Libraries/Sqlite/sqlite3.dll" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../LogentriesCore" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../LogentriesNLog" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../Marr.Data" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../Microsoft.AspNet.SignalR.Core" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../Microsoft.AspNet.SignalR.Owin" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../MonoTorrent" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../NzbDrone" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../NzbDrone.Api" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../NzbDrone.Api.Test" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../NzbDrone.App.Test" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../NzbDrone.Automation.Test" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../NzbDrone.Common" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../NzbDrone.Common.Test" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../NzbDrone.Console" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../NzbDrone.Core" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../NzbDrone.Core.Test" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../NzbDrone.Host" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../NzbDrone.Integration.Test" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../NzbDrone.Libraries.Test" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../NzbDrone.Mono" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../NzbDrone.Mono.Test" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../NzbDrone.SignalR" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../NzbDrone.Test.Common" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../NzbDrone.Test.Dummy" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../NzbDrone.Update" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../NzbDrone.Update.Test" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../NzbDrone.Windows" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../NzbDrone.Windows.Test" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../ServiceHelpers/ServiceInstall" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../ServiceHelpers/ServiceUninstall" isTestSource="false" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../ExternalModules/CurlSharp/CurlSharp/bin" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../ExternalModules/CurlSharp/CurlSharp/obj" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../LogentriesCore/bin" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../LogentriesCore/obj" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../LogentriesNLog/bin" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../LogentriesNLog/obj" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../Marr.Data/obj" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../Microsoft.AspNet.SignalR.Core/bin" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../Microsoft.AspNet.SignalR.Core/obj" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../Microsoft.AspNet.SignalR.Owin/bin" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../Microsoft.AspNet.SignalR.Owin/obj" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../MonoTorrent/obj" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../NzbDrone.Api.Test/bin" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../NzbDrone.Api.Test/obj" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../NzbDrone.Api/obj" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../NzbDrone.App.Test/bin" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../NzbDrone.App.Test/obj" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../NzbDrone.Automation.Test/bin" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../NzbDrone.Automation.Test/obj" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../NzbDrone.Common.Test/bin" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../NzbDrone.Common.Test/obj" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../NzbDrone.Common/obj" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../NzbDrone.Console/obj" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../NzbDrone.Core.Test/bin" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../NzbDrone.Core.Test/obj" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../NzbDrone.Core/obj" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../NzbDrone.Host/obj" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../NzbDrone.Integration.Test/bin" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../NzbDrone.Integration.Test/obj" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../NzbDrone.Libraries.Test/bin" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../NzbDrone.Libraries.Test/obj" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../NzbDrone.Mono.Test/bin" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../NzbDrone.Mono.Test/obj" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../NzbDrone.Mono/obj" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../NzbDrone.SignalR/obj" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../NzbDrone.Test.Common/bin" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../NzbDrone.Test.Common/obj" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../NzbDrone.Test.Dummy/bin" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../NzbDrone.Test.Dummy/obj" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../NzbDrone.Update.Test/bin" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../NzbDrone.Update.Test/obj" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../NzbDrone.Update/obj" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../NzbDrone.Windows.Test/bin" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../NzbDrone.Windows.Test/obj" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../NzbDrone.Windows/obj" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../NzbDrone/obj" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../ServiceHelpers/ServiceInstall/obj" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../ServiceHelpers/ServiceUninstall/obj" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../_ReSharper.Caches/ReSharperHost8.NzbDrone.00" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../packages" />
|
|
||||||
</content>
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
@ -245,6 +245,25 @@ public void MoveFile(string source, string destination, bool overwrite = false)
|
|||||||
File.Move(source, destination);
|
File.Move(source, destination);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void MoveFolder(string source, string destination, bool overwrite = false)
|
||||||
|
{
|
||||||
|
Ensure.That(source, () => source).IsValidPath();
|
||||||
|
Ensure.That(destination, () => destination).IsValidPath();
|
||||||
|
|
||||||
|
if (source.PathEquals(destination))
|
||||||
|
{
|
||||||
|
throw new IOException(string.Format("Source and destination can't be the same {0}", source));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FolderExists(destination) && overwrite)
|
||||||
|
{
|
||||||
|
DeleteFolder(destination, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
RemoveReadOnlyFolder(source);
|
||||||
|
Directory.Move(source, destination);
|
||||||
|
}
|
||||||
|
|
||||||
public abstract bool TryCreateHardLink(string source, string destination);
|
public abstract bool TryCreateHardLink(string source, string destination);
|
||||||
|
|
||||||
public void DeleteFolder(string path, bool recursive)
|
public void DeleteFolder(string path, bool recursive)
|
||||||
@ -371,6 +390,20 @@ private static void RemoveReadOnly(string path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void RemoveReadOnlyFolder(string path)
|
||||||
|
{
|
||||||
|
if (Directory.Exists(path))
|
||||||
|
{
|
||||||
|
var dirInfo = new DirectoryInfo(path);
|
||||||
|
|
||||||
|
if (dirInfo.Attributes.HasFlag(FileAttributes.ReadOnly))
|
||||||
|
{
|
||||||
|
var newAttributes = dirInfo.Attributes & ~(FileAttributes.ReadOnly);
|
||||||
|
dirInfo.Attributes = newAttributes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public FileAttributes GetFileAttributes(string path)
|
public FileAttributes GetFileAttributes(string path)
|
||||||
{
|
{
|
||||||
return File.GetAttributes(path);
|
return File.GetAttributes(path);
|
||||||
|
@ -30,6 +30,7 @@ public interface IDiskProvider
|
|||||||
void DeleteFile(string path);
|
void DeleteFile(string path);
|
||||||
void CopyFile(string source, string destination, bool overwrite = false);
|
void CopyFile(string source, string destination, bool overwrite = false);
|
||||||
void MoveFile(string source, string destination, bool overwrite = false);
|
void MoveFile(string source, string destination, bool overwrite = false);
|
||||||
|
void MoveFolder(string source, string destination, bool overwrite = false);
|
||||||
bool TryCreateHardLink(string source, string destination);
|
bool TryCreateHardLink(string source, string destination);
|
||||||
void DeleteFolder(string path, bool recursive);
|
void DeleteFolder(string path, bool recursive);
|
||||||
string ReadAllText(string filePath);
|
string ReadAllText(string filePath);
|
||||||
|
@ -66,7 +66,7 @@ public MovieFile MoveMovieFile(MovieFile movieFile, Movie movie)
|
|||||||
EnsureMovieFolder(movieFile, movie, filePath);
|
EnsureMovieFolder(movieFile, movie, filePath);
|
||||||
|
|
||||||
_logger.Debug("Renaming movie file: {0} to {1}", movieFile, filePath);
|
_logger.Debug("Renaming movie file: {0} to {1}", movieFile, filePath);
|
||||||
|
|
||||||
return TransferFile(movieFile, movie, filePath, TransferMode.Move);
|
return TransferFile(movieFile, movie, filePath, TransferMode.Move);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ public MovieFile MoveMovieFile(MovieFile movieFile, LocalMovie localMovie)
|
|||||||
EnsureMovieFolder(movieFile, localMovie, filePath);
|
EnsureMovieFolder(movieFile, localMovie, filePath);
|
||||||
|
|
||||||
_logger.Debug("Moving movie file: {0} to {1}", movieFile.Path, filePath);
|
_logger.Debug("Moving movie file: {0} to {1}", movieFile.Path, filePath);
|
||||||
|
|
||||||
return TransferFile(movieFile, localMovie.Movie, filePath, TransferMode.Move);
|
return TransferFile(movieFile, localMovie.Movie, filePath, TransferMode.Move);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ public MovieFile CopyMovieFile(MovieFile movieFile, LocalMovie localMovie)
|
|||||||
_logger.Debug("Copying movie file: {0} to {1}", movieFile.Path, filePath);
|
_logger.Debug("Copying movie file: {0} to {1}", movieFile.Path, filePath);
|
||||||
return TransferFile(movieFile, localMovie.Movie, filePath, TransferMode.Copy);
|
return TransferFile(movieFile, localMovie.Movie, filePath, TransferMode.Copy);
|
||||||
}
|
}
|
||||||
|
|
||||||
private MovieFile TransferFile(MovieFile movieFile, Movie movie, string destinationFilePath, TransferMode mode)
|
private MovieFile TransferFile(MovieFile movieFile, Movie movie, string destinationFilePath, TransferMode mode)
|
||||||
{
|
{
|
||||||
Ensure.That(movieFile, () => movieFile).IsNotNull();
|
Ensure.That(movieFile, () => movieFile).IsNotNull();
|
||||||
@ -122,11 +122,8 @@ private MovieFile TransferFile(MovieFile movieFile, Movie movie, string destinat
|
|||||||
var oldMoviePath = movie.Path;
|
var oldMoviePath = movie.Path;
|
||||||
|
|
||||||
var newMoviePath = new OsPath(destinationFilePath).Directory.FullPath.TrimEnd(Path.DirectorySeparatorChar);
|
var newMoviePath = new OsPath(destinationFilePath).Directory.FullPath.TrimEnd(Path.DirectorySeparatorChar);
|
||||||
movie.Path = newMoviePath;
|
|
||||||
if (oldMoviePath != newMoviePath)
|
movie.Path = newMoviePath; //We update it when everything went well!
|
||||||
{
|
|
||||||
_movieService.UpdateMovie(movie);
|
|
||||||
}
|
|
||||||
|
|
||||||
movieFile.RelativePath = movie.Path.GetRelativePath(destinationFilePath);
|
movieFile.RelativePath = movie.Path.GetRelativePath(destinationFilePath);
|
||||||
|
|
||||||
@ -146,12 +143,35 @@ private MovieFile TransferFile(MovieFile movieFile, Movie movie, string destinat
|
|||||||
|
|
||||||
if(oldMoviePath != newMoviePath)
|
if(oldMoviePath != newMoviePath)
|
||||||
{
|
{
|
||||||
|
//Let's move the old files before deleting the old folder. We could just do move folder, but the main file (movie file) is already moved, so eh.
|
||||||
|
var files = _diskProvider.GetFiles(oldMoviePath, SearchOption.AllDirectories);
|
||||||
|
|
||||||
|
foreach (var file in files)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var destFile = Path.Combine(newMoviePath, oldMoviePath.GetRelativePath(file));
|
||||||
|
_diskProvider.EnsureFolder(Path.GetDirectoryName(destFile));
|
||||||
|
_diskProvider.MoveFile(file, destFile);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
_logger.Warn(e, "Error while trying to move extra file {0} to new folder. Maybe it already exists? (Manual cleanup necessary!).", oldMoviePath.GetRelativePath(file));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (_diskProvider.GetFiles(oldMoviePath, SearchOption.AllDirectories).Count() == 0)
|
if (_diskProvider.GetFiles(oldMoviePath, SearchOption.AllDirectories).Count() == 0)
|
||||||
{
|
{
|
||||||
_recycleBinProvider.DeleteFolder(oldMoviePath);
|
_recycleBinProvider.DeleteFolder(oldMoviePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Only update the movie path if we were successfull!
|
||||||
|
if (oldMoviePath != newMoviePath)
|
||||||
|
{
|
||||||
|
_movieService.UpdateMovie(movie);
|
||||||
|
}
|
||||||
|
|
||||||
return movieFile;
|
return movieFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +183,7 @@ private void EnsureMovieFolder(MovieFile movieFile, LocalMovie localMovie, strin
|
|||||||
private void EnsureMovieFolder(MovieFile movieFile, Movie movie, string filePath)
|
private void EnsureMovieFolder(MovieFile movieFile, Movie movie, string filePath)
|
||||||
{
|
{
|
||||||
var movieFolder = Path.GetDirectoryName(filePath);
|
var movieFolder = Path.GetDirectoryName(filePath);
|
||||||
movie.Path = movieFolder;
|
//movie.Path = movieFolder;
|
||||||
var rootFolder = new OsPath(movieFolder).Directory.FullPath;
|
var rootFolder = new OsPath(movieFolder).Directory.FullPath;
|
||||||
var fileName = Path.GetFileName(filePath);
|
var fileName = Path.GetFileName(filePath);
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ public class RenameMovieFileService : IRenameMovieFileService,
|
|||||||
private readonly IDiskProvider _diskProvider;
|
private readonly IDiskProvider _diskProvider;
|
||||||
private readonly IRecycleBinProvider _recycleBinProvider;
|
private readonly IRecycleBinProvider _recycleBinProvider;
|
||||||
private readonly Logger _logger;
|
private readonly Logger _logger;
|
||||||
|
|
||||||
public RenameMovieFileService(IMovieService movieService,
|
public RenameMovieFileService(IMovieService movieService,
|
||||||
IMediaFileService mediaFileService,
|
IMediaFileService mediaFileService,
|
||||||
IMoveMovieFiles movieFileMover,
|
IMoveMovieFiles movieFileMover,
|
||||||
@ -91,7 +91,7 @@ private IEnumerable<RenameMovieFilePreview> GetPreviews(Movie movie, List<MovieF
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RenameFiles(List<MovieFile> movieFiles, Movie movie, string oldMoviePath = null)
|
private void RenameFiles(List<MovieFile> movieFiles, Movie movie, string oldMoviePath = null)
|
||||||
@ -136,23 +136,25 @@ public void RenameMoviePath(Movie movie, bool shouldRenameFiles = true)
|
|||||||
var newFolder = _filenameBuilder.BuildMoviePath(movie);
|
var newFolder = _filenameBuilder.BuildMoviePath(movie);
|
||||||
if (newFolder != movie.Path && movie.PathState == MoviePathState.Dynamic)
|
if (newFolder != movie.Path && movie.PathState == MoviePathState.Dynamic)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!_configService.AutoRenameFolders)
|
if (!_configService.AutoRenameFolders)
|
||||||
{
|
{
|
||||||
_logger.Info("{0}'s movie should be {1} according to your naming config.", movie, newFolder);
|
_logger.Info("{0}'s movie should be {1} according to your naming config.", movie, newFolder);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.Info("{0}'s movie folder changed to: {1}", movie, newFolder);
|
_logger.Info("{0}'s movie folder changed to: {1}", movie, newFolder);
|
||||||
var oldFolder = movie.Path;
|
var oldFolder = movie.Path;
|
||||||
movie.Path = newFolder;
|
movie.Path = newFolder;
|
||||||
|
|
||||||
if (shouldRenameFiles)
|
_diskProvider.MoveFolder(oldFolder, movie.Path);
|
||||||
|
|
||||||
|
if (false)
|
||||||
{
|
{
|
||||||
var movieFiles = _mediaFileService.GetFilesByMovie(movie.Id);
|
var movieFiles = _mediaFileService.GetFilesByMovie(movie.Id);
|
||||||
_logger.ProgressInfo("Renaming movie files for {0}", movie.Title);
|
_logger.ProgressInfo("Renaming movie files for {0}", movie.Title);
|
||||||
RenameFiles(movieFiles, movie, oldFolder);
|
RenameFiles(movieFiles, movie, oldFolder);
|
||||||
_logger.ProgressInfo("All movie files renamed for {0}", movie.Title);
|
_logger.ProgressInfo("All movie files renamed for {0}", movie.Title);
|
||||||
}
|
}
|
||||||
|
|
||||||
_movieService.UpdateMovie(movie);
|
_movieService.UpdateMovie(movie);
|
||||||
@ -162,7 +164,7 @@ public void RenameMoviePath(Movie movie, bool shouldRenameFiles = true)
|
|||||||
_recycleBinProvider.DeleteFolder(oldFolder);
|
_recycleBinProvider.DeleteFolder(oldFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (movie.PathState == MoviePathState.StaticOnce)
|
if (movie.PathState == MoviePathState.StaticOnce)
|
||||||
@ -194,7 +196,7 @@ public void Execute(RenameMovieCommand message)
|
|||||||
RenameFiles(movieFiles, movie);
|
RenameFiles(movieFiles, movie);
|
||||||
_logger.ProgressInfo("All movie files renamed for {0}", movie.Title);
|
_logger.ProgressInfo("All movie files renamed for {0}", movie.Title);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Execute(RenameMovieFolderCommand message)
|
public void Execute(RenameMovieFolderCommand message)
|
||||||
@ -206,7 +208,7 @@ public void Execute(RenameMovieFolderCommand message)
|
|||||||
foreach(var movie in moviesToRename)
|
foreach(var movie in moviesToRename)
|
||||||
{
|
{
|
||||||
var movieFiles = _mediaFileService.GetFilesByMovie(movie.Id);
|
var movieFiles = _mediaFileService.GetFilesByMovie(movie.Id);
|
||||||
_logger.ProgressInfo("Renaming movie folder for {0}", movie.Title);
|
//_logger.ProgressInfo("Renaming movie folder for {0}", movie.Title);
|
||||||
RenameMoviePath(movie);
|
RenameMoviePath(movie);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -214,7 +216,7 @@ public void Execute(RenameMovieFolderCommand message)
|
|||||||
{
|
{
|
||||||
_logger.Warn(ex, "wtf: {0}, {1}", ex.ResultCode, ex.Data);
|
_logger.Warn(ex, "wtf: {0}, {1}", ex.ResultCode, ex.Data);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,9 +27,13 @@
|
|||||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_WHILE_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
|
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_WHILE_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
|
||||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_NESTED_FIXED_STMT/@EntryValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_NESTED_FIXED_STMT/@EntryValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_NESTED_USINGS_STMT/@EntryValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_NESTED_USINGS_STMT/@EntryValue">True</s:Boolean>
|
||||||
|
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_ACCESSOR_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">NEVER</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_ACCESSORHOLDER_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">NEVER</s:String>
|
||||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_FIELD_ATTRIBUTE_ON_SAME_LINE/@EntryValue">False</s:Boolean>
|
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_FIELD_ATTRIBUTE_ON_SAME_LINE/@EntryValue">False</s:Boolean>
|
||||||
|
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_FIELD_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">NEVER</s:String>
|
||||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_ACCESSOR_ATTRIBUTE_ON_SAME_LINE/@EntryValue">False</s:Boolean>
|
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_ACCESSOR_ATTRIBUTE_ON_SAME_LINE/@EntryValue">False</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_ACCESSOR_ON_SINGLE_LINE/@EntryValue">False</s:Boolean>
|
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_ACCESSOR_ON_SINGLE_LINE/@EntryValue">False</s:Boolean>
|
||||||
|
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_EMBEDDED_STATEMENT_ON_SAME_LINE/@EntryValue">ALWAYS</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SIMPLE_EMBEDDED_STATEMENT_STYLE/@EntryValue">ON_SINGLE_LINE</s:String>
|
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SIMPLE_EMBEDDED_STATEMENT_STYLE/@EntryValue">ON_SINGLE_LINE</s:String>
|
||||||
<s:Boolean x:Key="/Default/CodeStyle/CSharpUsing/AllowAlias/@EntryValue">False</s:Boolean>
|
<s:Boolean x:Key="/Default/CodeStyle/CSharpUsing/AllowAlias/@EntryValue">False</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/CodeStyle/CSharpUsing/CanUseGlobalAlias/@EntryValue">False</s:Boolean>
|
<s:Boolean x:Key="/Default/CodeStyle/CSharpUsing/CanUseGlobalAlias/@EntryValue">False</s:Boolean>
|
||||||
@ -66,7 +70,12 @@
|
|||||||
<s:Boolean x:Key="/Default/Environment/InjectedLayers/InjectedLayerCustomization/=File_003A_003AC_003A_005CDropbox_005CGit_005CNzbDrone_005CNzbDrone_002Esln_002EDotSettings/@KeyIndexDefined">True</s:Boolean>
|
<s:Boolean x:Key="/Default/Environment/InjectedLayers/InjectedLayerCustomization/=File_003A_003AC_003A_005CDropbox_005CGit_005CNzbDrone_005CNzbDrone_002Esln_002EDotSettings/@KeyIndexDefined">True</s:Boolean>
|
||||||
<s:Double x:Key="/Default/Environment/InjectedLayers/InjectedLayerCustomization/=File_003A_003AC_003A_005CDropbox_005CGit_005CNzbDrone_005CNzbDrone_002Esln_002EDotSettings/RelativePriority/@EntryValue">2</s:Double>
|
<s:Double x:Key="/Default/Environment/InjectedLayers/InjectedLayerCustomization/=File_003A_003AC_003A_005CDropbox_005CGit_005CNzbDrone_005CNzbDrone_002Esln_002EDotSettings/RelativePriority/@EntryValue">2</s:Double>
|
||||||
<s:Boolean x:Key="/Default/Environment/MemoryUsageIndicator/IsVisible/@EntryValue">False</s:Boolean>
|
<s:Boolean x:Key="/Default/Environment/MemoryUsageIndicator/IsVisible/@EntryValue">False</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpAttributeForSingleLineMethodUpgrade/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpRenamePlacementToArrangementMigration/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002ECSharpPlaceAttributeOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/Environment/TextControl/HighlightCurrentLine/@EntryValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/Environment/TextControl/HighlightCurrentLine/@EntryValue">True</s:Boolean>
|
||||||
|
Loading…
Reference in New Issue
Block a user