From c25b92955f0fd68ba66d6b235db8823488eab172 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Thu, 29 Aug 2013 23:41:49 -0700 Subject: [PATCH] moveepisode is less side-effecty! --- NzbDrone.Core/MediaFiles/RenameEpisodeFileService.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/NzbDrone.Core/MediaFiles/RenameEpisodeFileService.cs b/NzbDrone.Core/MediaFiles/RenameEpisodeFileService.cs index f6737a9ef..7912039e7 100644 --- a/NzbDrone.Core/MediaFiles/RenameEpisodeFileService.cs +++ b/NzbDrone.Core/MediaFiles/RenameEpisodeFileService.cs @@ -34,14 +34,12 @@ namespace NzbDrone.Core.MediaFiles { var renamed = new List(); - foreach (var file in episodeFiles) + foreach (var episodeFile in episodeFiles) { try { - var episodeFile = file; - _logger.Trace("Renaming episode file: {0}", episodeFile); - episodeFile = _episodeFileMover.MoveEpisodeFile(episodeFile, series); + episodeFile.Path = _episodeFileMover.MoveEpisodeFile(episodeFile, series); _mediaFileService.Update(episodeFile); renamed.Add(episodeFile); @@ -54,7 +52,7 @@ namespace NzbDrone.Core.MediaFiles } catch (Exception ex) { - _logger.ErrorException("Failed to rename file: " + file.Path, ex); + _logger.ErrorException("Failed to rename file: " + episodeFile.Path, ex); } }