From 2cd4e1649fb34382e37ca5d7ccac9643fb4e61ce Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Tue, 17 May 2011 20:18:35 -0700 Subject: [PATCH] Diskscan now updates the last scan time of the series object --- NzbDrone.Core.Test/MediaFileProviderTests.cs | 14 ++++++++++++++ NzbDrone.Core/Providers/MediaFileProvider.cs | 8 +++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/NzbDrone.Core.Test/MediaFileProviderTests.cs b/NzbDrone.Core.Test/MediaFileProviderTests.cs index becfc86b0..1b8fc1933 100644 --- a/NzbDrone.Core.Test/MediaFileProviderTests.cs +++ b/NzbDrone.Core.Test/MediaFileProviderTests.cs @@ -271,5 +271,19 @@ namespace NzbDrone.Core.Test Assert.IsNull(result); mocker.GetMock().Verify(r => r.Add(result), Times.Never()); } + + [Test] + public void scan_series_should_update_last_scan_date() + { + + var mocker = new AutoMoqer(); + mocker.GetMock() + .Setup(c => c.UpdateSeries(It.Is(s => s.LastDiskSync != null))).Verifiable(); + + mocker.Resolve().Scan(new Series()); + + mocker.VerifyAllMocks(); + + } } } \ No newline at end of file diff --git a/NzbDrone.Core/Providers/MediaFileProvider.cs b/NzbDrone.Core/Providers/MediaFileProvider.cs index a9816e527..5d353bea2 100644 --- a/NzbDrone.Core/Providers/MediaFileProvider.cs +++ b/NzbDrone.Core/Providers/MediaFileProvider.cs @@ -15,14 +15,16 @@ namespace NzbDrone.Core.Providers private static readonly string[] MediaExtentions = new[] { "*.mkv", "*.avi", "*.wmv", "*.mp4" }; private readonly DiskProvider _diskProvider; private readonly EpisodeProvider _episodeProvider; + private readonly SeriesProvider _seriesProvider; private readonly IRepository _repository; public MediaFileProvider(IRepository repository, DiskProvider diskProvider, - EpisodeProvider episodeProvider) + EpisodeProvider episodeProvider, SeriesProvider seriesProvider) { _repository = repository; _diskProvider = diskProvider; _episodeProvider = episodeProvider; + _seriesProvider = seriesProvider; } public MediaFileProvider() { } @@ -42,6 +44,10 @@ namespace NzbDrone.Core.Providers if (file != null) fileList.Add(file); } + + series.LastDiskSync = DateTime.Now; + _seriesProvider.UpdateSeries(series); + return fileList; }