use a dictionary for quicker comparison
This commit is contained in:
parent
8035fe19a6
commit
5791524090
|
@ -75,11 +75,11 @@ namespace MediaBrowser.Controller.Entities
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
ItemResolveArgs resolveArgs;
|
Dictionary<string, string> locationsDicionary;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
resolveArgs = ResolveArgs;
|
locationsDicionary = ResolveArgs.PhysicalLocations.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
|
@ -89,7 +89,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
|
|
||||||
return LibraryManager.RootFolder.RecursiveChildren
|
return LibraryManager.RootFolder.RecursiveChildren
|
||||||
.OfType<Folder>()
|
.OfType<Folder>()
|
||||||
.Where(i => i.Path != null && resolveArgs.PhysicalLocations.Contains(i.Path, StringComparer.OrdinalIgnoreCase))
|
.Where(i => i.Path != null && locationsDicionary.ContainsKey(i.Path))
|
||||||
.SelectMany(c => c.LinkedChildren).ToList();
|
.SelectMany(c => c.LinkedChildren).ToList();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -107,11 +107,11 @@ namespace MediaBrowser.Controller.Entities
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
ItemResolveArgs resolveArgs;
|
Dictionary<string, string> locationsDicionary;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
resolveArgs = ResolveArgs;
|
locationsDicionary = ResolveArgs.PhysicalLocations.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
|
@ -122,7 +122,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
var ourChildren =
|
var ourChildren =
|
||||||
LibraryManager.RootFolder.RecursiveChildren
|
LibraryManager.RootFolder.RecursiveChildren
|
||||||
.OfType<Folder>()
|
.OfType<Folder>()
|
||||||
.Where(i => i.Path != null && resolveArgs.PhysicalLocations.Contains(i.Path, StringComparer.OrdinalIgnoreCase))
|
.Where(i => i.Path != null && locationsDicionary.ContainsKey(i.Path))
|
||||||
.SelectMany(c => c.Children);
|
.SelectMany(c => c.Children);
|
||||||
|
|
||||||
return new ConcurrentDictionary<Guid, BaseItem>(ourChildren.ToDictionary(i => i.Id));
|
return new ConcurrentDictionary<Guid, BaseItem>(ourChildren.ToDictionary(i => i.Id));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user