mirror of https://github.com/lidarr/Lidarr
New: Add additional logging when renaming extra files
(cherry picked from commit 1ae0dc81f73ef74078f07fd5536a7d9058df649d) Closes #3983
This commit is contained in:
parent
366a2e685f
commit
118220b42c
|
@ -12,5 +12,10 @@ namespace NzbDrone.Core.Extras.Files
|
||||||
public DateTime Added { get; set; }
|
public DateTime Added { get; set; }
|
||||||
public DateTime LastUpdated { get; set; }
|
public DateTime LastUpdated { get; set; }
|
||||||
public string Extension { get; set; }
|
public string Extension { get; set; }
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return $"[{Id}] {RelativePath}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,6 +83,8 @@ namespace NzbDrone.Core.Extras.Files
|
||||||
|
|
||||||
protected TExtraFile MoveFile(Artist artist, TrackFile trackFile, TExtraFile extraFile, string fileNameSuffix = null)
|
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 newFolder = Path.GetDirectoryName(trackFile.Path);
|
||||||
var filenameBuilder = new StringBuilder(Path.GetFileNameWithoutExtension(trackFile.Path));
|
var filenameBuilder = new StringBuilder(Path.GetFileNameWithoutExtension(trackFile.Path));
|
||||||
|
|
||||||
|
@ -100,9 +102,13 @@ namespace NzbDrone.Core.Extras.Files
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
_logger.Trace("Renaming extra file: {0} to {1}", extraFile, newFileName);
|
||||||
|
|
||||||
_diskProvider.MoveFile(existingFileName, newFileName);
|
_diskProvider.MoveFile(existingFileName, newFileName);
|
||||||
extraFile.RelativePath = artist.Path.GetRelativePath(newFileName);
|
extraFile.RelativePath = artist.Path.GetRelativePath(newFileName);
|
||||||
|
|
||||||
|
_logger.Trace("Renamed extra file from: {0}", extraFile);
|
||||||
|
|
||||||
return extraFile;
|
return extraFile;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
Loading…
Reference in New Issue