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

pull/4/head
Mark McDowall 12 years ago
parent dbc20a3c31
commit 8a5bd31da7

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

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

Loading…
Cancel
Save