diff options
Diffstat (limited to 'MediaBrowser.Server.Implementations/Dto/DtoService.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/Dto/DtoService.cs | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs index 8086033eb..3280cf264 100644 --- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs +++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs @@ -504,7 +504,6 @@ namespace MediaBrowser.Server.Implementations.Dto } dto.Album = item.Album; - dto.Artists = item.Artists; } private void SetGameProperties(BaseItemDto dto, Game item) @@ -1142,7 +1141,6 @@ namespace MediaBrowser.Server.Implementations.Dto if (audio != null) { dto.Album = audio.Album; - dto.Artists = audio.Artists; var albumParent = audio.FindParent<MusicAlbum>(); @@ -1163,15 +1161,40 @@ namespace MediaBrowser.Server.Implementations.Dto if (album != null) { - dto.Artists = album.Artists; - dto.SoundtrackIds = album.SoundtrackIds .Select(i => i.ToString("N")) .ToArray(); } - var hasAlbumArtist = item as IHasAlbumArtist; + var hasArtist = item as IHasArtist; + if (hasArtist != null) + { + dto.Artists = hasArtist.Artists; + + dto.ArtistItems = hasArtist + .Artists + .Select(i => + { + try + { + var artist = _libraryManager.GetArtist(i); + return new NameIdPair + { + Name = artist.Name, + Id = artist.Id.ToString("N") + }; + } + catch (Exception ex) + { + _logger.ErrorException("Error getting artist", ex); + return null; + } + }) + .Where(i => i != null) + .ToList(); + } + var hasAlbumArtist = item as IHasAlbumArtist; if (hasAlbumArtist != null) { dto.AlbumArtist = hasAlbumArtist.AlbumArtists.FirstOrDefault(); @@ -1253,7 +1276,6 @@ namespace MediaBrowser.Server.Implementations.Dto // Add MovieInfo var movie = item as Movie; - if (movie != null) { if (fields.Contains(ItemFields.TmdbCollectionName)) @@ -1263,7 +1285,6 @@ namespace MediaBrowser.Server.Implementations.Dto } var hasSpecialFeatures = item as IHasSpecialFeatures; - if (hasSpecialFeatures != null) { var specialFeatureCount = hasSpecialFeatures.SpecialFeatureIds.Count; @@ -1276,7 +1297,6 @@ namespace MediaBrowser.Server.Implementations.Dto // Add EpisodeInfo var episode = item as Episode; - if (episode != null) { dto.IndexNumberEnd = episode.IndexNumberEnd; @@ -1318,7 +1338,6 @@ namespace MediaBrowser.Server.Implementations.Dto // Add SeriesInfo var series = item as Series; - if (series != null) { dto.AirDays = series.AirDays; @@ -1368,7 +1387,6 @@ namespace MediaBrowser.Server.Implementations.Dto // Add SeasonInfo var season = item as Season; - if (season != null) { series = season.Series; @@ -1402,7 +1420,6 @@ namespace MediaBrowser.Server.Implementations.Dto } var musicVideo = item as MusicVideo; - if (musicVideo != null) { SetMusicVideoProperties(dto, musicVideo); |
