mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-12 11:15:43 +02:00
Diskscan now updates the last scan time of the series object
This commit is contained in:
parent
45fde370d8
commit
2cd4e1649f
@ -271,5 +271,19 @@ public void import_file_with_no_episode()
|
||||
Assert.IsNull(result);
|
||||
mocker.GetMock<IRepository>().Verify(r => r.Add(result), Times.Never());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void scan_series_should_update_last_scan_date()
|
||||
{
|
||||
|
||||
var mocker = new AutoMoqer();
|
||||
mocker.GetMock<SeriesProvider>()
|
||||
.Setup(c => c.UpdateSeries(It.Is<Series>(s => s.LastDiskSync != null))).Verifiable();
|
||||
|
||||
mocker.Resolve<MediaFileProvider>().Scan(new Series());
|
||||
|
||||
mocker.VerifyAllMocks();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -15,14 +15,16 @@ public class MediaFileProvider
|
||||
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 @@ public List<EpisodeFile> Scan(Series series)
|
||||
if (file != null)
|
||||
fileList.Add(file);
|
||||
}
|
||||
|
||||
series.LastDiskSync = DateTime.Now;
|
||||
_seriesProvider.UpdateSeries(series);
|
||||
|
||||
return fileList;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user