DiskScanProvider.Scan() will log a warning if the path doesn't exist.

This commit is contained in:
Mark McDowall 2011-10-22 12:03:54 -07:00
parent 0cce31cbc8
commit bb5febaade
2 changed files with 33 additions and 3 deletions

View File

@ -14,7 +14,6 @@ namespace NzbDrone.Core.Test.ProviderTests
// ReSharper disable InconsistentNaming
public class DiskScanProviderTest : TestBase
{
[Test]
public void scan_series_should_update_last_scan_date()
{
@ -38,7 +37,6 @@ namespace NzbDrone.Core.Test.ProviderTests
}
[Test]
public void cleanup_should_skip_existing_files()
{
@ -89,7 +87,6 @@ namespace NzbDrone.Core.Test.ProviderTests
}
[Test]
public void cleanup_should_delete_none_existing_files_remove_links_to_episodes()
{
@ -131,7 +128,34 @@ namespace NzbDrone.Core.Test.ProviderTests
}
[Test]
public void scan_series_should_log_warning_if_path_doesnt_exist_on_disk()
{
//Setup
var mocker = new AutoMoqer(MockBehavior.Strict);
var series = Builder<Series>.CreateNew()
.With(s => s.Path = @"C:\Test\TV\SeriesName\")
.Build();
mocker.GetMock<MediaFileProvider>()
.Setup(c => c.DeleteOrphaned())
.Returns(0);
mocker.GetMock<MediaFileProvider>()
.Setup(c => c.RepairLinks())
.Returns(0);
mocker.GetMock<DiskProvider>()
.Setup(c => c.FolderExists(series.Path))
.Returns(false);
//Act
mocker.Resolve<DiskScanProvider>().Scan(series, series.Path);
//Assert
mocker.VerifyAllMocks();
ExceptionVerification.ExcpectedWarns(1);
}
}
}

View File

@ -58,6 +58,12 @@ namespace NzbDrone.Core.Providers
_mediaFileProvider.DeleteOrphaned();
_mediaFileProvider.RepairLinks();
if (!_diskProvider.FolderExists(path))
{
Logger. Warn("Series folder doesn't exist: {0}", path);
return new List<EpisodeFile>();
}
if (_episodeProvider.GetEpisodeBySeries(series.SeriesId).Count == 0)
{
Logger.Debug("Series {0} has no episodes. skipping", series.Title);