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

pull/2/head
Mark McDowall 13 years ago
parent 0cce31cbc8
commit bb5febaade

@ -14,7 +14,6 @@ namespace NzbDrone.Core.Test.ProviderTests
// ReSharper disable InconsistentNaming // ReSharper disable InconsistentNaming
public class DiskScanProviderTest : TestBase public class DiskScanProviderTest : TestBase
{ {
[Test] [Test]
public void scan_series_should_update_last_scan_date() public void scan_series_should_update_last_scan_date()
{ {
@ -38,7 +37,6 @@ namespace NzbDrone.Core.Test.ProviderTests
} }
[Test] [Test]
public void cleanup_should_skip_existing_files() public void cleanup_should_skip_existing_files()
{ {
@ -89,7 +87,6 @@ namespace NzbDrone.Core.Test.ProviderTests
} }
[Test] [Test]
public void cleanup_should_delete_none_existing_files_remove_links_to_episodes() 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);
}
} }
} }

@ -58,6 +58,12 @@ namespace NzbDrone.Core.Providers
_mediaFileProvider.DeleteOrphaned(); _mediaFileProvider.DeleteOrphaned();
_mediaFileProvider.RepairLinks(); _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) if (_episodeProvider.GetEpisodeBySeries(series.SeriesId).Count == 0)
{ {
Logger.Debug("Series {0} has no episodes. skipping", series.Title); Logger.Debug("Series {0} has no episodes. skipping", series.Title);

Loading…
Cancel
Save