From f9384d48dd8eefdad9a25cb367339b2624a6ddfb Mon Sep 17 00:00:00 2001 From: Eric Yen Date: Sat, 28 Sep 2013 11:05:40 -0400 Subject: [PATCH] Implement https://trello.com/c/a1il1sTd modified: NzbDrone.Core/MediaFiles/EpisodeFileMovingService.cs -modified: DiskProvider.cs added SetFolderAccessTime to the interface added SetFolderAccessTime function -modified MoveEpisodeFile.cs call SetFolderAccessTime from both MoveEpisodeFile --- NzbDrone.Common/DiskProvider.cs | 5 +++++ NzbDrone.Core/MediaFiles/EpisodeFileMovingService.cs | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/NzbDrone.Common/DiskProvider.cs b/NzbDrone.Common/DiskProvider.cs index 56180cdda..e83604017 100644 --- a/NzbDrone.Common/DiskProvider.cs +++ b/NzbDrone.Common/DiskProvider.cs @@ -39,6 +39,7 @@ namespace NzbDrone.Common string GetPathRoot(string path); void SetPermissions(string filename, WellKnownSidType accountSid, FileSystemRights rights, AccessControlType controlType); bool IsParent(string parentPath, string childPath); + void SetFolderAccessTime(string path, DateTime time){ FileAttributes GetFileAttributes(string path); void EmptyFolder(string path); } @@ -451,6 +452,10 @@ namespace NzbDrone.Common } } + private void SetFolderAccessTime(string path, DateTime time){ + Directory.SetLastWriteTimeUtc(path,time); + } + public FileAttributes GetFileAttributes(string path) { return File.GetAttributes(path); diff --git a/NzbDrone.Core/MediaFiles/EpisodeFileMovingService.cs b/NzbDrone.Core/MediaFiles/EpisodeFileMovingService.cs index f14a0ae44..afa34a1c1 100644 --- a/NzbDrone.Core/MediaFiles/EpisodeFileMovingService.cs +++ b/NzbDrone.Core/MediaFiles/EpisodeFileMovingService.cs @@ -43,6 +43,8 @@ namespace NzbDrone.Core.MediaFiles var newFileName = _buildFileNames.BuildFilename(episodes, series, episodeFile); var filePath = _buildFileNames.BuildFilePath(series, episodes.First().SeasonNumber, newFileName, Path.GetExtension(episodeFile.Path)); MoveFile(episodeFile, filePath); + _diskProvider.SetFolderAccessTime( Path.GetDirectoryName(filePath), episodeFile.DateAdded); + _diskProvider.SetFolderAccessTime( series.Path, episodeFile.DateAdded); return filePath; } @@ -52,6 +54,8 @@ namespace NzbDrone.Core.MediaFiles var newFileName = _buildFileNames.BuildFilename(localEpisode.Episodes, localEpisode.Series, episodeFile); var filePath = _buildFileNames.BuildFilePath(localEpisode.Series, localEpisode.SeasonNumber, newFileName, Path.GetExtension(episodeFile.Path)); MoveFile(episodeFile, filePath); + _diskProvider.SetFolderAccessTime( Path.GetDirectoryName(filePath), episodeFile.DateAdded); + _diskProvider.SetFolderAccessTime( localEpisode.Series.Path, episodeFile.DateAdded); return filePath; }