mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-07 20:08:59 +02:00
add filters to item by name query
This commit is contained in:
parent
a3a658e820
commit
14d8f48f31
6 changed files with 62 additions and 16 deletions
|
@ -345,8 +345,6 @@ namespace MediaBrowser.Api
|
||||||
var songs = items.OfType<Audio>().ToList();
|
var songs = items.OfType<Audio>().ToList();
|
||||||
var series = items.OfType<Series>().ToList();
|
var series = items.OfType<Series>().ToList();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var counts = new ItemCounts
|
var counts = new ItemCounts
|
||||||
{
|
{
|
||||||
AlbumCount = albums.Count,
|
AlbumCount = albums.Count,
|
||||||
|
@ -377,6 +375,54 @@ namespace MediaBrowser.Api
|
||||||
counts.FavoriteBookCount = FavoriteCount(books, request.UserId.Value);
|
counts.FavoriteBookCount = FavoriteCount(books, request.UserId.Value);
|
||||||
counts.FavoriteSongCount = FavoriteCount(songs, request.UserId.Value);
|
counts.FavoriteSongCount = FavoriteCount(songs, request.UserId.Value);
|
||||||
counts.FavoriteSeriesCount = FavoriteCount(series, 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);
|
return ToOptimizedResult(counts);
|
||||||
|
|
|
@ -48,13 +48,6 @@ namespace MediaBrowser.Controller.Library
|
||||||
/// <value>The root folder.</value>
|
/// <value>The root folder.</value>
|
||||||
AggregateFolder RootFolder { get; }
|
AggregateFolder RootFolder { get; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the person sync.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="name">The name.</param>
|
|
||||||
/// <returns>Person.</returns>
|
|
||||||
Person GetPersonSync(string name);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a Person
|
/// Gets a Person
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -43,6 +43,12 @@ namespace MediaBrowser.Model.Querying
|
||||||
/// <value>The fields.</value>
|
/// <value>The fields.</value>
|
||||||
public ItemFields[] Fields { get; set; }
|
public ItemFields[] Fields { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the filters.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The filters.</value>
|
||||||
|
public ItemFilter[] Filters { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the exclude item types.
|
/// Gets or sets the exclude item types.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -91,6 +97,7 @@ namespace MediaBrowser.Model.Querying
|
||||||
public ItemsByNameQuery()
|
public ItemsByNameQuery()
|
||||||
{
|
{
|
||||||
ImageTypes = new ImageType[] { };
|
ImageTypes = new ImageType[] { };
|
||||||
|
Filters = new ItemFilter[] { };
|
||||||
Fields = new ItemFields[] { };
|
Fields = new ItemFields[] { };
|
||||||
Recursive = true;
|
Recursive = true;
|
||||||
MediaTypes = new string[] { };
|
MediaTypes = new string[] { };
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Common.Internal</id>
|
<id>MediaBrowser.Common.Internal</id>
|
||||||
<version>3.0.228</version>
|
<version>3.0.229</version>
|
||||||
<title>MediaBrowser.Common.Internal</title>
|
<title>MediaBrowser.Common.Internal</title>
|
||||||
<authors>Luke</authors>
|
<authors>Luke</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<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>
|
<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>
|
<copyright>Copyright © Media Browser 2013</copyright>
|
||||||
<dependencies>
|
<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="NLog" version="2.1.0" />
|
||||||
<dependency id="ServiceStack.Text" version="3.9.58" />
|
<dependency id="ServiceStack.Text" version="3.9.58" />
|
||||||
<dependency id="SimpleInjector" version="2.3.2" />
|
<dependency id="SimpleInjector" version="2.3.2" />
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Common</id>
|
<id>MediaBrowser.Common</id>
|
||||||
<version>3.0.228</version>
|
<version>3.0.229</version>
|
||||||
<title>MediaBrowser.Common</title>
|
<title>MediaBrowser.Common</title>
|
||||||
<authors>Media Browser Team</authors>
|
<authors>Media Browser Team</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<owners>ebr,Luke,scottisafool</owners>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Server.Core</id>
|
<id>MediaBrowser.Server.Core</id>
|
||||||
<version>3.0.228</version>
|
<version>3.0.229</version>
|
||||||
<title>Media Browser.Server.Core</title>
|
<title>Media Browser.Server.Core</title>
|
||||||
<authors>Media Browser Team</authors>
|
<authors>Media Browser Team</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<owners>ebr,Luke,scottisafool</owners>
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
<description>Contains core components required to build plugins for Media Browser Server.</description>
|
<description>Contains core components required to build plugins for Media Browser Server.</description>
|
||||||
<copyright>Copyright © Media Browser 2013</copyright>
|
<copyright>Copyright © Media Browser 2013</copyright>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency id="MediaBrowser.Common" version="3.0.228" />
|
<dependency id="MediaBrowser.Common" version="3.0.229" />
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</metadata>
|
</metadata>
|
||||||
<files>
|
<files>
|
||||||
|
|
Loading…
Reference in a new issue