aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/BaseApiService.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2015-01-25 01:34:50 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2015-01-25 01:34:50 -0500
commita1a56557ece84d8b726a6c06b2620fa43ff22461 (patch)
treea9b96eccbe5fd08c34174f5c5cff8e01ac822fea /MediaBrowser.Api/BaseApiService.cs
parent67559378009062a26173888ad457d0c9116bfc9a (diff)
sync updates
Diffstat (limited to 'MediaBrowser.Api/BaseApiService.cs')
-rw-r--r--MediaBrowser.Api/BaseApiService.cs34
1 files changed, 23 insertions, 11 deletions
diff --git a/MediaBrowser.Api/BaseApiService.cs b/MediaBrowser.Api/BaseApiService.cs
index 2aaec8627..dff433c9d 100644
--- a/MediaBrowser.Api/BaseApiService.cs
+++ b/MediaBrowser.Api/BaseApiService.cs
@@ -174,7 +174,7 @@ namespace MediaBrowser.Api
return libraryManager.GetPerson(DeSlugPersonName(name, libraryManager));
}
- protected IEnumerable<BaseItem> GetAllLibraryItems(Guid? userId, IUserManager userManager, ILibraryManager libraryManager, string parentId = null)
+ protected IList<BaseItem> GetAllLibraryItems(Guid? userId, IUserManager userManager, ILibraryManager libraryManager, string parentId, Func<BaseItem,bool> filter)
{
if (!string.IsNullOrEmpty(parentId))
{
@@ -189,10 +189,13 @@ namespace MediaBrowser.Api
throw new ArgumentException("User not found");
}
- return folder.GetRecursiveChildren(user);
+ return folder
+ .GetRecursiveChildren(user, filter)
+ .ToList();
}
- return folder.GetRecursiveChildren();
+ return folder
+ .GetRecursiveChildren(filter);
}
if (userId.HasValue)
{
@@ -203,10 +206,16 @@ namespace MediaBrowser.Api
throw new ArgumentException("User not found");
}
- return userManager.GetUserById(userId.Value).RootFolder.GetRecursiveChildren(user);
+ return userManager
+ .GetUserById(userId.Value)
+ .RootFolder
+ .GetRecursiveChildren(user, filter)
+ .ToList();
}
- return libraryManager.RootFolder.GetRecursiveChildren();
+ return libraryManager
+ .RootFolder
+ .GetRecursiveChildren(filter);
}
/// <summary>
@@ -222,8 +231,9 @@ namespace MediaBrowser.Api
return name;
}
- return libraryManager.RootFolder.RecursiveChildren
- .OfType<Audio>()
+ return libraryManager.RootFolder
+ .GetRecursiveChildren(i => i is IHasArtist)
+ .Cast<IHasArtist>()
.SelectMany(i => i.AllArtists)
.Distinct(StringComparer.OrdinalIgnoreCase)
.FirstOrDefault(i =>
@@ -264,8 +274,8 @@ namespace MediaBrowser.Api
return name;
}
- return libraryManager.RootFolder.GetRecursiveChildren()
- .OfType<Game>()
+ return libraryManager.RootFolder
+ .GetRecursiveChildren(i => i is Game)
.SelectMany(i => i.Genres)
.Distinct(StringComparer.OrdinalIgnoreCase)
.FirstOrDefault(i =>
@@ -287,7 +297,8 @@ namespace MediaBrowser.Api
return name;
}
- return libraryManager.RootFolder.GetRecursiveChildren()
+ return libraryManager.RootFolder
+ .GetRecursiveChildren()
.SelectMany(i => i.Studios)
.Distinct(StringComparer.OrdinalIgnoreCase)
.FirstOrDefault(i =>
@@ -309,7 +320,8 @@ namespace MediaBrowser.Api
return name;
}
- return libraryManager.RootFolder.GetRecursiveChildren()
+ return libraryManager.RootFolder
+ .GetRecursiveChildren()
.SelectMany(i => i.People)
.Select(i => i.Name)
.Distinct(StringComparer.OrdinalIgnoreCase)