diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-07-12 15:56:40 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-07-12 15:56:40 -0400 |
| commit | dab5003d6bba57c27f4111653b36d39862b5b6fd (patch) | |
| tree | bdf7462c3718eb729f71b1245c3f651b016e8412 /MediaBrowser.Api/UserLibrary/ArtistsService.cs | |
| parent | 3370fb072e71ad93c540d50d859d6cbe85552735 (diff) | |
added collection type
Diffstat (limited to 'MediaBrowser.Api/UserLibrary/ArtistsService.cs')
| -rw-r--r-- | MediaBrowser.Api/UserLibrary/ArtistsService.cs | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/MediaBrowser.Api/UserLibrary/ArtistsService.cs b/MediaBrowser.Api/UserLibrary/ArtistsService.cs index 7a027a052..f65de2e69 100644 --- a/MediaBrowser.Api/UserLibrary/ArtistsService.cs +++ b/MediaBrowser.Api/UserLibrary/ArtistsService.cs @@ -125,15 +125,35 @@ namespace MediaBrowser.Api.UserLibrary { var name = DeSlugArtistName(request.Name, LibraryManager); - var items = GetItems(request.UserId).OfType<Audio>().Where(i => i.HasArtist(name)).ToList(); + var items = GetItems(request.UserId).Where(i => + { + var song = i as Audio; + + if (song != null) + { + return song.HasArtist(name); + } + + var musicVideo = i as MusicVideo; + + if (musicVideo != null) + { + return musicVideo.HasArtist(name); + } + + return false; + + }).ToList(); var counts = new ItemByNameCounts { TotalCount = items.Count, - SongCount = items.Count(), + SongCount = items.OfType<Audio>().Count(), + + AlbumCount = items.Select(i => i.Parent).OfType<MusicAlbum>().Distinct().Count(), - AlbumCount = items.Select(i => i.Parent).OfType<MusicAlbum>().Distinct().Count() + MusicVideoCount = items.OfType<MusicVideo>().Count(i => i.HasArtist(name)) }; return ToOptimizedResult(counts); |
