diff --git a/src/NzbDrone.Core/Extras/Files/ExtraFile.cs b/src/NzbDrone.Core/Extras/Files/ExtraFile.cs index 036eaec33..ee12a9c30 100644 --- a/src/NzbDrone.Core/Extras/Files/ExtraFile.cs +++ b/src/NzbDrone.Core/Extras/Files/ExtraFile.cs @@ -1,4 +1,4 @@ -using System; +using System; using NzbDrone.Core.Datastore; namespace NzbDrone.Core.Extras.Files @@ -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}"; + } } } diff --git a/src/NzbDrone.Core/Extras/Files/ExtraFileManager.cs b/src/NzbDrone.Core/Extras/Files/ExtraFileManager.cs index 0f0c01a19..4ea272f67 100644 --- a/src/NzbDrone.Core/Extras/Files/ExtraFileManager.cs +++ b/src/NzbDrone.Core/Extras/Files/ExtraFileManager.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Text; @@ -86,6 +86,8 @@ namespace NzbDrone.Core.Extras.Files protected TExtraFile MoveFile(Series series, EpisodeFile episodeFile, TExtraFile extraFile, string fileNameSuffix = null) { + _logger.Trace("Renaming extra file: {0}", extraFile); + var newFolder = Path.GetDirectoryName(Path.Combine(series.Path, episodeFile.RelativePath)); var filenameBuilder = new StringBuilder(Path.GetFileNameWithoutExtension(episodeFile.RelativePath)); @@ -103,9 +105,13 @@ namespace NzbDrone.Core.Extras.Files { try { + _logger.Trace("Renaming extra file: {0} to {1}", extraFile, newFileName); + _diskProvider.MoveFile(existingFileName, newFileName); extraFile.RelativePath = series.Path.GetRelativePath(newFileName); + _logger.Trace("Renamed extra file from: {0}", extraFile); + return extraFile; } catch (Exception ex) diff --git a/src/NzbDrone.Core/Extras/Subtitles/SubtitleFile.cs b/src/NzbDrone.Core/Extras/Subtitles/SubtitleFile.cs index 7d6fa5ea6..41a28ef4a 100644 --- a/src/NzbDrone.Core/Extras/Subtitles/SubtitleFile.cs +++ b/src/NzbDrone.Core/Extras/Subtitles/SubtitleFile.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using NzbDrone.Core.Extras.Files; using NzbDrone.Core.Languages; @@ -18,5 +18,10 @@ namespace NzbDrone.Core.Extras.Subtitles public List LanguageTags { get; set; } private string LanguageTagsAsString => string.Join(".", LanguageTags); + + public override string ToString() + { + return $"[{Id}] {RelativePath} ({Language}{(LanguageTags.Count > 0 ? "." : "")}{LanguageTagsAsString}{Extension})"; + } } } diff --git a/src/NzbDrone.Core/Extras/Subtitles/SubtitleService.cs b/src/NzbDrone.Core/Extras/Subtitles/SubtitleService.cs index a984c2d34..0b3a4e557 100644 --- a/src/NzbDrone.Core/Extras/Subtitles/SubtitleService.cs +++ b/src/NzbDrone.Core/Extras/Subtitles/SubtitleService.cs @@ -82,6 +82,7 @@ namespace NzbDrone.Core.Extras.Subtitles foreach (var subtitleFile in group) { var suffix = GetSuffix(subtitleFile.Language, copy, subtitleFile.LanguageTags, groupCount > 1); + movedFiles.AddIfNotNull(MoveFile(series, episodeFile, subtitleFile, suffix)); copy++;