aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Dto/DtoService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Server.Implementations/Dto/DtoService.cs')
-rw-r--r--MediaBrowser.Server.Implementations/Dto/DtoService.cs61
1 files changed, 50 insertions, 11 deletions
diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs
index f9b7470b2..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,18 +1161,65 @@ 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();
+
+ dto.AlbumArtists = hasAlbumArtist
+ .AlbumArtists
+ .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 album artist", ex);
+ return null;
+ }
+ })
+ .Where(i => i != null)
+ .ToList();
}
// Add video info
@@ -1231,7 +1276,6 @@ namespace MediaBrowser.Server.Implementations.Dto
// Add MovieInfo
var movie = item as Movie;
-
if (movie != null)
{
if (fields.Contains(ItemFields.TmdbCollectionName))
@@ -1241,7 +1285,6 @@ namespace MediaBrowser.Server.Implementations.Dto
}
var hasSpecialFeatures = item as IHasSpecialFeatures;
-
if (hasSpecialFeatures != null)
{
var specialFeatureCount = hasSpecialFeatures.SpecialFeatureIds.Count;
@@ -1254,7 +1297,6 @@ namespace MediaBrowser.Server.Implementations.Dto
// Add EpisodeInfo
var episode = item as Episode;
-
if (episode != null)
{
dto.IndexNumberEnd = episode.IndexNumberEnd;
@@ -1296,7 +1338,6 @@ namespace MediaBrowser.Server.Implementations.Dto
// Add SeriesInfo
var series = item as Series;
-
if (series != null)
{
dto.AirDays = series.AirDays;
@@ -1346,7 +1387,6 @@ namespace MediaBrowser.Server.Implementations.Dto
// Add SeasonInfo
var season = item as Season;
-
if (season != null)
{
series = season.Series;
@@ -1380,7 +1420,6 @@ namespace MediaBrowser.Server.Implementations.Dto
}
var musicVideo = item as MusicVideo;
-
if (musicVideo != null)
{
SetMusicVideoProperties(dto, musicVideo);