add ArtistItems to api output

This commit is contained in:
Luke Pulverenti
2015-03-13 13:25:28 -04:00
parent a92723fde3
commit 96ec4cef77
21 changed files with 117 additions and 121 deletions

View File

@@ -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);