add filters to item by name query
This commit is contained in:
parent
a3a658e820
commit
14d8f48f31
|
@ -345,8 +345,6 @@ namespace MediaBrowser.Api
|
|||
var songs = items.OfType<Audio>().ToList();
|
||||
var series = items.OfType<Series>().ToList();
|
||||
|
||||
|
||||
|
||||
var counts = new ItemCounts
|
||||
{
|
||||
AlbumCount = albums.Count,
|
||||
|
@ -377,6 +375,54 @@ namespace MediaBrowser.Api
|
|||
counts.FavoriteBookCount = FavoriteCount(books, request.UserId.Value);
|
||||
counts.FavoriteSongCount = FavoriteCount(songs, request.UserId.Value);
|
||||
counts.FavoriteSeriesCount = FavoriteCount(series, request.UserId.Value);
|
||||
|
||||
var people = items.SelectMany(i => i.People)
|
||||
.Select(i => i.Name)
|
||||
.Distinct(StringComparer.OrdinalIgnoreCase)
|
||||
.Select(i =>
|
||||
{
|
||||
try
|
||||
{
|
||||
return _libraryManager.GetPerson(i);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.Where(i => i != null)
|
||||
.ToList();
|
||||
|
||||
counts.FavoritePersonCount = FavoriteCount(people, request.UserId.Value);
|
||||
|
||||
var artists = songs.SelectMany(i =>
|
||||
{
|
||||
var list = new List<string>();
|
||||
|
||||
if (!string.IsNullOrEmpty(i.AlbumArtist))
|
||||
{
|
||||
list.Add(i.AlbumArtist);
|
||||
}
|
||||
list.AddRange(i.Artists);
|
||||
|
||||
return list;
|
||||
})
|
||||
.Distinct(StringComparer.OrdinalIgnoreCase)
|
||||
.Select(i =>
|
||||
{
|
||||
try
|
||||
{
|
||||
return _libraryManager.GetArtist(i);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.Where(i => i != null)
|
||||
.ToList();
|
||||
|
||||
counts.FavoriteArtistCount = FavoriteCount(artists, request.UserId.Value);
|
||||
}
|
||||
|
||||
return ToOptimizedResult(counts);
|
||||
|
@ -617,7 +663,7 @@ namespace MediaBrowser.Api
|
|||
}
|
||||
|
||||
private static readonly CultureInfo UsCulture = new CultureInfo("en-US");
|
||||
|
||||
|
||||
public object Get(GetYearIndex request)
|
||||
{
|
||||
IEnumerable<BaseItem> items = GetAllLibraryItems(request.UserId, _userManager, _libraryManager);
|
||||
|
@ -627,7 +673,7 @@ namespace MediaBrowser.Api
|
|||
var vals = request.IncludeItemTypes.Split(',');
|
||||
items = items.Where(f => vals.Contains(f.GetType().Name, StringComparer.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
|
||||
var lookup = items
|
||||
.ToLookup(i => i.ProductionYear ?? -1)
|
||||
.OrderBy(i => i.Key)
|
||||
|
|
|
@ -48,13 +48,6 @@ namespace MediaBrowser.Controller.Library
|
|||
/// <value>The root folder.</value>
|
||||
AggregateFolder RootFolder { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the person sync.
|
||||
/// </summary>
|
||||
/// <param name="name">The name.</param>
|
||||
/// <returns>Person.</returns>
|
||||
Person GetPersonSync(string name);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a Person
|
||||
/// </summary>
|
||||
|
|
|
@ -43,6 +43,12 @@ namespace MediaBrowser.Model.Querying
|
|||
/// <value>The fields.</value>
|
||||
public ItemFields[] Fields { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the filters.
|
||||
/// </summary>
|
||||
/// <value>The filters.</value>
|
||||
public ItemFilter[] Filters { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the exclude item types.
|
||||
/// </summary>
|
||||
|
@ -91,6 +97,7 @@ namespace MediaBrowser.Model.Querying
|
|||
public ItemsByNameQuery()
|
||||
{
|
||||
ImageTypes = new ImageType[] { };
|
||||
Filters = new ItemFilter[] { };
|
||||
Fields = new ItemFields[] { };
|
||||
Recursive = true;
|
||||
MediaTypes = new string[] { };
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Common.Internal</id>
|
||||
<version>3.0.228</version>
|
||||
<version>3.0.229</version>
|
||||
<title>MediaBrowser.Common.Internal</title>
|
||||
<authors>Luke</authors>
|
||||
<owners>ebr,Luke,scottisafool</owners>
|
||||
|
@ -12,7 +12,7 @@
|
|||
<description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description>
|
||||
<copyright>Copyright © Media Browser 2013</copyright>
|
||||
<dependencies>
|
||||
<dependency id="MediaBrowser.Common" version="3.0.228" />
|
||||
<dependency id="MediaBrowser.Common" version="3.0.229" />
|
||||
<dependency id="NLog" version="2.1.0" />
|
||||
<dependency id="ServiceStack.Text" version="3.9.58" />
|
||||
<dependency id="SimpleInjector" version="2.3.2" />
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Common</id>
|
||||
<version>3.0.228</version>
|
||||
<version>3.0.229</version>
|
||||
<title>MediaBrowser.Common</title>
|
||||
<authors>Media Browser Team</authors>
|
||||
<owners>ebr,Luke,scottisafool</owners>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Server.Core</id>
|
||||
<version>3.0.228</version>
|
||||
<version>3.0.229</version>
|
||||
<title>Media Browser.Server.Core</title>
|
||||
<authors>Media Browser Team</authors>
|
||||
<owners>ebr,Luke,scottisafool</owners>
|
||||
|
@ -12,7 +12,7 @@
|
|||
<description>Contains core components required to build plugins for Media Browser Server.</description>
|
||||
<copyright>Copyright © Media Browser 2013</copyright>
|
||||
<dependencies>
|
||||
<dependency id="MediaBrowser.Common" version="3.0.228" />
|
||||
<dependency id="MediaBrowser.Common" version="3.0.229" />
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
|
|
Loading…
Reference in New Issue
Block a user