fix albums per artist
This commit is contained in:
parent
ca308bc3c9
commit
7a014affb2
|
@ -213,8 +213,6 @@ namespace MediaBrowser.Api.Reports
|
||||||
SortBy = request.GetOrderBy(),
|
SortBy = request.GetOrderBy(),
|
||||||
SortOrder = request.SortOrder ?? SortOrder.Ascending,
|
SortOrder = request.SortOrder ?? SortOrder.Ascending,
|
||||||
|
|
||||||
Filter = i => ApplyAdditionalFilters(request, i, user, _libraryManager),
|
|
||||||
|
|
||||||
IsFavorite = request.IsFavorite,
|
IsFavorite = request.IsFavorite,
|
||||||
Limit = request.Limit,
|
Limit = request.Limit,
|
||||||
StartIndex = request.StartIndex,
|
StartIndex = request.StartIndex,
|
||||||
|
@ -350,6 +348,15 @@ namespace MediaBrowser.Api.Reports
|
||||||
query.MaxParentalRating = _localization.GetRatingLevel(request.MinOfficialRating);
|
query.MaxParentalRating = _localization.GetRatingLevel(request.MinOfficialRating);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Artists
|
||||||
|
if (!string.IsNullOrEmpty(request.ArtistIds))
|
||||||
|
{
|
||||||
|
var artistIds = request.ArtistIds.Split(new[] { '|', ',' });
|
||||||
|
|
||||||
|
var artistItems = artistIds.Select(_libraryManager.GetItemById).Where(i => i != null).ToList();
|
||||||
|
query.ArtistNames = artistItems.Select(i => i.Name).ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
// Artists
|
// Artists
|
||||||
if (!string.IsNullOrEmpty(request.Artists))
|
if (!string.IsNullOrEmpty(request.Artists))
|
||||||
{
|
{
|
||||||
|
@ -371,28 +378,6 @@ namespace MediaBrowser.Api.Reports
|
||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ApplyAdditionalFilters(BaseReportRequest request, BaseItem i, User user, ILibraryManager libraryManager)
|
|
||||||
{
|
|
||||||
// Artists
|
|
||||||
if (!string.IsNullOrEmpty(request.ArtistIds))
|
|
||||||
{
|
|
||||||
var artistIds = request.ArtistIds.Split(new[] { '|', ',' });
|
|
||||||
|
|
||||||
var audio = i as IHasArtist;
|
|
||||||
|
|
||||||
if (!(audio != null && artistIds.Any(id =>
|
|
||||||
{
|
|
||||||
var artistItem = libraryManager.GetItemById(id);
|
|
||||||
return artistItem != null && audio.HasAnyArtist(artistItem.Name);
|
|
||||||
})))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary> Gets query result. </summary>
|
/// <summary> Gets query result. </summary>
|
||||||
/// <param name="request"> The request. </param>
|
/// <param name="request"> The request. </param>
|
||||||
/// <returns> The query result. </returns>
|
/// <returns> The query result. </returns>
|
||||||
|
|
|
@ -184,8 +184,6 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
SortBy = request.GetOrderBy(),
|
SortBy = request.GetOrderBy(),
|
||||||
SortOrder = request.SortOrder ?? SortOrder.Ascending,
|
SortOrder = request.SortOrder ?? SortOrder.Ascending,
|
||||||
|
|
||||||
Filter = i => ApplyAdditionalFilters(request, i, user, _libraryManager),
|
|
||||||
|
|
||||||
IsFavorite = request.IsFavorite,
|
IsFavorite = request.IsFavorite,
|
||||||
Limit = request.Limit,
|
Limit = request.Limit,
|
||||||
StartIndex = request.StartIndex,
|
StartIndex = request.StartIndex,
|
||||||
|
@ -323,6 +321,15 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
query.MaxParentalRating = _localization.GetRatingLevel(request.MinOfficialRating);
|
query.MaxParentalRating = _localization.GetRatingLevel(request.MinOfficialRating);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Artists
|
||||||
|
if (!string.IsNullOrEmpty(request.ArtistIds))
|
||||||
|
{
|
||||||
|
var artistIds = request.ArtistIds.Split(new[] { '|', ',' });
|
||||||
|
|
||||||
|
var artistItems = artistIds.Select(_libraryManager.GetItemById).Where(i => i != null).ToList();
|
||||||
|
query.ArtistNames = artistItems.Select(i => i.Name).ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
// Artists
|
// Artists
|
||||||
if (!string.IsNullOrEmpty(request.Artists))
|
if (!string.IsNullOrEmpty(request.Artists))
|
||||||
{
|
{
|
||||||
|
@ -337,28 +344,6 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
|
|
||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ApplyAdditionalFilters(GetItems request, BaseItem i, User user, ILibraryManager libraryManager)
|
|
||||||
{
|
|
||||||
// Artists
|
|
||||||
if (!string.IsNullOrEmpty(request.ArtistIds))
|
|
||||||
{
|
|
||||||
var artistIds = request.ArtistIds.Split(new[] { '|', ',' });
|
|
||||||
|
|
||||||
var audio = i as IHasArtist;
|
|
||||||
|
|
||||||
if (!(audio != null && artistIds.Any(id =>
|
|
||||||
{
|
|
||||||
var artistItem = libraryManager.GetItemById(id);
|
|
||||||
return artistItem != null && audio.HasAnyArtist(artistItem.Name);
|
|
||||||
})))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user