|
|
|
@ -341,95 +341,43 @@ namespace MediaBrowser.Controller.Entities
|
|
|
|
|
var items = GetRecursiveChildren(queryParent, user, new[] { CollectionType.Music, CollectionType.MusicVideos })
|
|
|
|
|
.Where(i => !i.IsFolder)
|
|
|
|
|
.Where(i => i.Genres.Contains(displayParent.Name, StringComparer.OrdinalIgnoreCase))
|
|
|
|
|
.OfType<IHasAlbumArtist>()
|
|
|
|
|
.SelectMany(i => i.AlbumArtists)
|
|
|
|
|
.DistinctNames()
|
|
|
|
|
.Select(i =>
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
return _libraryManager.GetArtist(i);
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
// Already logged at lower levels
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.Where(i => i != null);
|
|
|
|
|
.OfType<IHasAlbumArtist>();
|
|
|
|
|
|
|
|
|
|
return GetResult(items, queryParent, query);
|
|
|
|
|
var artists = _libraryManager.GetAlbumArtists(items);
|
|
|
|
|
|
|
|
|
|
return GetResult(artists, queryParent, query);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private QueryResult<BaseItem> GetMusicAlbumArtists(Folder parent, User user, InternalItemsQuery query)
|
|
|
|
|
{
|
|
|
|
|
var artists = GetRecursiveChildren(parent, user, new[] { CollectionType.Music, CollectionType.MusicVideos })
|
|
|
|
|
var items = GetRecursiveChildren(parent, user, new[] { CollectionType.Music, CollectionType.MusicVideos })
|
|
|
|
|
.Where(i => !i.IsFolder)
|
|
|
|
|
.OfType<IHasAlbumArtist>()
|
|
|
|
|
.SelectMany(i => i.AlbumArtists)
|
|
|
|
|
.DistinctNames()
|
|
|
|
|
.Select(i =>
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
return _libraryManager.GetArtist(i);
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
// Already logged at lower levels
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.Where(i => i != null);
|
|
|
|
|
.OfType<IHasAlbumArtist>();
|
|
|
|
|
|
|
|
|
|
var artists = _libraryManager.GetAlbumArtists(items);
|
|
|
|
|
|
|
|
|
|
return GetResult(artists, parent, query);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private QueryResult<BaseItem> GetMusicArtists(Folder parent, User user, InternalItemsQuery query)
|
|
|
|
|
{
|
|
|
|
|
var artists = GetRecursiveChildren(parent, user, new[] { CollectionType.Music, CollectionType.MusicVideos })
|
|
|
|
|
var items = GetRecursiveChildren(parent, user, new[] { CollectionType.Music, CollectionType.MusicVideos })
|
|
|
|
|
.Where(i => !i.IsFolder)
|
|
|
|
|
.OfType<IHasArtist>()
|
|
|
|
|
.SelectMany(i => i.Artists)
|
|
|
|
|
.DistinctNames()
|
|
|
|
|
.Select(i =>
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
return _libraryManager.GetArtist(i);
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
// Already logged at lower levels
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.Where(i => i != null);
|
|
|
|
|
.OfType<IHasArtist>();
|
|
|
|
|
|
|
|
|
|
var artists = _libraryManager.GetArtists(items);
|
|
|
|
|
|
|
|
|
|
return GetResult(artists, parent, query);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private QueryResult<BaseItem> GetFavoriteArtists(Folder parent, User user, InternalItemsQuery query)
|
|
|
|
|
{
|
|
|
|
|
var artists = GetRecursiveChildren(parent, user, new[] { CollectionType.Music, CollectionType.MusicVideos })
|
|
|
|
|
var items = GetRecursiveChildren(parent, user, new[] { CollectionType.Music, CollectionType.MusicVideos })
|
|
|
|
|
.Where(i => !i.IsFolder)
|
|
|
|
|
.OfType<IHasAlbumArtist>()
|
|
|
|
|
.SelectMany(i => i.AlbumArtists)
|
|
|
|
|
.DistinctNames()
|
|
|
|
|
.Select(i =>
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
return _libraryManager.GetArtist(i);
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
// Already logged at lower levels
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.Where(i => i != null && _userDataManager.GetUserData(user.Id, i.GetUserDataKey()).IsFavorite);
|
|
|
|
|
.OfType<IHasAlbumArtist>();
|
|
|
|
|
|
|
|
|
|
var artists = _libraryManager.GetAlbumArtists(items).Where(i => _userDataManager.GetUserData(user.Id, i.GetUserDataKey()).IsFavorite);
|
|
|
|
|
|
|
|
|
|
return GetResult(artists, parent, query);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|