@ -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 ) ;