mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-18 21:34:28 -04:00
New: Add additional logging when renaming extra files
(cherry picked from commit 1ae0dc81f73ef74078f07fd5536a7d9058df649d) Closes #2782
This commit is contained in:
@@ -12,5 +12,10 @@ namespace NzbDrone.Core.Extras.Files
|
||||
public DateTime Added { get; set; }
|
||||
public DateTime LastUpdated { get; set; }
|
||||
public string Extension { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[{Id}] {RelativePath}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,6 +81,8 @@ namespace NzbDrone.Core.Extras.Files
|
||||
|
||||
protected TExtraFile MoveFile(Author author, BookFile bookFile, TExtraFile extraFile, string fileNameSuffix = null)
|
||||
{
|
||||
_logger.Trace("Renaming extra file: {0}", extraFile);
|
||||
|
||||
var newFolder = Path.GetDirectoryName(bookFile.Path);
|
||||
var filenameBuilder = new StringBuilder(Path.GetFileNameWithoutExtension(bookFile.Path));
|
||||
|
||||
@@ -98,9 +100,13 @@ namespace NzbDrone.Core.Extras.Files
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger.Trace("Renaming extra file: {0} to {1}", extraFile, newFileName);
|
||||
|
||||
_diskProvider.MoveFile(existingFileName, newFileName);
|
||||
extraFile.RelativePath = author.Path.GetRelativePath(newFileName);
|
||||
|
||||
_logger.Trace("Renamed extra file from: {0}", extraFile);
|
||||
|
||||
return extraFile;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
Reference in New Issue
Block a user