New: Add additional logging when renaming extra files

(cherry picked from commit 1ae0dc81f73ef74078f07fd5536a7d9058df649d)

Closes #3983
This commit is contained in:
Mark McDowall 2023-08-09 17:42:09 -07:00 committed by Bogdan
parent 366a2e685f
commit 118220b42c
2 changed files with 11 additions and 0 deletions

View File

@ -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}";
}
}
}

View File

@ -83,6 +83,8 @@ namespace NzbDrone.Core.Extras.Files
protected TExtraFile MoveFile(Artist artist, TrackFile trackFile, TExtraFile extraFile, string fileNameSuffix = null)
{
_logger.Trace("Renaming extra file: {0}", extraFile);
var newFolder = Path.GetDirectoryName(trackFile.Path);
var filenameBuilder = new StringBuilder(Path.GetFileNameWithoutExtension(trackFile.Path));
@ -100,9 +102,13 @@ namespace NzbDrone.Core.Extras.Files
{
try
{
_logger.Trace("Renaming extra file: {0} to {1}", extraFile, newFileName);
_diskProvider.MoveFile(existingFileName, newFileName);
extraFile.RelativePath = artist.Path.GetRelativePath(newFileName);
_logger.Trace("Renamed extra file from: {0}", extraFile);
return extraFile;
}
catch (Exception ex)