Unmapped folders now get all series up front (much faster)

This commit is contained in:
Mark McDowall 2013-05-22 21:29:10 -07:00
parent dbc20a3c31
commit 8a5bd31da7
2 changed files with 3 additions and 1 deletions

View File

@ -202,6 +202,7 @@
<Compile Include="Datastore\IWriteModels.cs" />
<Compile Include="Datastore\LazyList.cs" />
<Compile Include="Datastore\MappingExtensions.cs" />
<Compile Include="Datastore\Migration\Migration20130522.cs" />
<Compile Include="Datastore\Migration\Framework\MigrationController.cs" />
<Compile Include="Datastore\Migration\Framework\MigrationExtension.cs" />
<Compile Include="Datastore\Migration\Framework\MigrationOptions.cs" />

View File

@ -87,6 +87,7 @@ namespace NzbDrone.Core.RootFolders
throw new ArgumentException("Invalid path provided", "path");
var results = new List<UnmappedFolder>();
var series = _seriesRepository.All();
if (!_diskProvider.FolderExists(path))
{
@ -96,7 +97,7 @@ namespace NzbDrone.Core.RootFolders
foreach (string seriesFolder in _diskProvider.GetDirectories(path))
{
if (!_seriesRepository.SeriesPathExists(seriesFolder))
if (!series.Any(s => s.Path == seriesFolder))
{
var di = new DirectoryInfo(seriesFolder.Normalize());
results.Add(new UnmappedFolder{ Name = di.Name, Path = di.FullName });