diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-06-20 02:50:41 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-06-20 02:50:41 -0400 |
| commit | 2edaff2ad34e019774d6cdad98a41d65aeba8c88 (patch) | |
| tree | 0eb87dfa853a12f60cd30c639598437c22d1afc5 /MediaBrowser.Server.Implementations/Dto/DtoService.cs | |
| parent | 36d53b7ec0be9682ffbf31f4fca705d63d7c0c8d (diff) | |
| parent | 365f6f957ddea650acf99eb09b0356939cf15a7c (diff) | |
Merge branch 'beta' of https://github.com/MediaBrowser/Emby into beta
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); |
