From 9758adb8a57e3b43013d9feabdf413af6c964a0f Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 12 Nov 2013 10:36:08 -0500 Subject: add soundtracks to theme media result --- .../Dto/DtoService.cs | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'MediaBrowser.Server.Implementations') diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs index d327796f92..31b0c1a6a5 100644 --- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs +++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs @@ -102,9 +102,14 @@ namespace MediaBrowser.Server.Implementations.Dto if (fields.Contains(ItemFields.SoundtrackIds)) { - dto.SoundtrackIds = item.SoundtrackIds - .Select(i => i.ToString("N")) - .ToArray(); + var hasSoundtracks = item as IHasSoundtracks; + + if (hasSoundtracks != null) + { + dto.SoundtrackIds = hasSoundtracks.SoundtrackIds + .Select(i => i.ToString("N")) + .ToArray(); + } } var itemByName = item as IItemByName; @@ -131,12 +136,9 @@ namespace MediaBrowser.Server.Implementations.Dto //counts = item.ItemCounts; return; } - else + if (!item.UserItemCounts.TryGetValue(user.Id, out counts)) { - if (!item.UserItemCounts.TryGetValue(user.Id, out counts)) - { - counts = new ItemByNameCounts(); - } + counts = new ItemByNameCounts(); } dto.ChildCount = counts.TotalCount; @@ -967,6 +969,10 @@ 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; -- cgit v1.2.3