mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07:00
more file naming cleanup.
This commit is contained in:
parent
f21358fce5
commit
969dff5197
9 changed files with 161 additions and 231 deletions
|
@ -192,7 +192,7 @@ namespace NzbDrone.Core.Providers
|
|||
var newFile = _buildFileNames.BuildFilePath(series, episodes.First().SeasonNumber, newFileName, Path.GetExtension(episodeFile.Path));
|
||||
|
||||
//Only rename if existing and new filenames don't match
|
||||
if (DiskProvider.PathEquals(episodeFile.Path, newFile.FullName))
|
||||
if (DiskProvider.PathEquals(episodeFile.Path, newFile))
|
||||
{
|
||||
Logger.Debug("Skipping file rename, source and destination are the same: {0}", episodeFile.Path);
|
||||
return null;
|
||||
|
@ -204,23 +204,23 @@ namespace NzbDrone.Core.Providers
|
|||
return null;
|
||||
}
|
||||
|
||||
_diskProvider.CreateDirectory(newFile.DirectoryName);
|
||||
_diskProvider.CreateDirectory(new FileInfo(newFile).DirectoryName);
|
||||
|
||||
Logger.Debug("Moving [{0}] > [{1}]", episodeFile.Path, newFile.FullName);
|
||||
_diskProvider.MoveFile(episodeFile.Path, newFile.FullName);
|
||||
Logger.Debug("Moving [{0}] > [{1}]", episodeFile.Path, newFile);
|
||||
_diskProvider.MoveFile(episodeFile.Path, newFile);
|
||||
|
||||
//Wrapped in Try/Catch to prevent this from causing issues with remote NAS boxes, the move worked, which is more important.
|
||||
try
|
||||
{
|
||||
_diskProvider.InheritFolderPermissions(newFile.FullName);
|
||||
_diskProvider.InheritFolderPermissions(newFile);
|
||||
}
|
||||
catch (UnauthorizedAccessException ex)
|
||||
{
|
||||
Logger.Debug("Unable to apply folder permissions to: ", newFile.FullName);
|
||||
Logger.Debug("Unable to apply folder permissions to: ", newFile);
|
||||
Logger.TraceException(ex.Message, ex);
|
||||
}
|
||||
|
||||
episodeFile.Path = newFile.FullName;
|
||||
episodeFile.Path = newFile;
|
||||
_mediaFileService.Update(episodeFile);
|
||||
|
||||
var parseResult = Parser.ParsePath(episodeFile.Path);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue