diff options
| author | Luke <luke.pulverenti@gmail.com> | 2016-06-20 02:50:05 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-06-20 02:50:05 -0400 |
| commit | 365f6f957ddea650acf99eb09b0356939cf15a7c (patch) | |
| tree | f6ed019d7eb3e3bb84b6b7b4816b662b071bff58 /MediaBrowser.Server.Implementations/Dto/DtoService.cs | |
| parent | d6b5adba5afc2f45bb8ee47c661274a2af337039 (diff) | |
| parent | 39ed3696ad783765b083b4a99fa4d7d91f0fa32c (diff) | |
Merge pull request #1862 from MediaBrowser/dev
Dev
Diffstat (limited to 'MediaBrowser.Server.Implementations/Dto/DtoService.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/Dto/DtoService.cs | 58 |
1 files changed, 25 insertions, 33 deletions
diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs index 388dfd515..a4cf90e5b 100644 --- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs +++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs @@ -1276,26 +1276,22 @@ namespace MediaBrowser.Server.Implementations.Dto { dto.Artists = hasArtist.Artists; - dto.ArtistItems = hasArtist - .Artists + var artistItems = _libraryManager.GetArtists(new InternalItemsQuery + { + EnableTotalRecordCount = false, + ItemIds = new[] { item.Id.ToString("N") } + }); + + dto.ArtistItems = artistItems.Items .Select(i => { - try - { - var artist = _libraryManager.GetArtist(i); - return new NameIdPair - { - Name = artist.Name, - Id = artist.Id.ToString("N") - }; - } - catch (Exception ex) + var artist = i.Item1; + return new NameIdPair { - _logger.ErrorException("Error getting artist", ex); - return null; - } + Name = artist.Name, + Id = artist.Id.ToString("N") + }; }) - .Where(i => i != null) .ToList(); } @@ -1304,26 +1300,22 @@ namespace MediaBrowser.Server.Implementations.Dto { dto.AlbumArtist = hasAlbumArtist.AlbumArtists.FirstOrDefault(); - dto.AlbumArtists = hasAlbumArtist - .AlbumArtists + var artistItems = _libraryManager.GetAlbumArtists(new InternalItemsQuery + { + EnableTotalRecordCount = false, + ItemIds = new[] { item.Id.ToString("N") } + }); + + dto.ArtistItems = artistItems.Items .Select(i => { - try - { - var artist = _libraryManager.GetArtist(i); - return new NameIdPair - { - Name = artist.Name, - Id = artist.Id.ToString("N") - }; - } - catch (Exception ex) + var artist = i.Item1; + return new NameIdPair { - _logger.ErrorException("Error getting album artist", ex); - return null; - } + Name = artist.Name, + Id = artist.Id.ToString("N") + }; }) - .Where(i => i != null) .ToList(); } @@ -1604,7 +1596,7 @@ namespace MediaBrowser.Server.Implementations.Dto { IsFolder = false, Recursive = true, - ExcludeLocationTypes = new[] {LocationType.Virtual}, + ExcludeLocationTypes = new[] { LocationType.Virtual }, User = user }).ConfigureAwait(false); |
