aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/LibraryService.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-11-19 22:15:48 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-11-19 22:15:48 -0500
commitbce86c502206b016cc448afc1934101b852a1994 (patch)
tree2e6dccdd61ca138ed3237fdeee2ce70e49c33a47 /MediaBrowser.Api/LibraryService.cs
parentde339b8265f0e0da7771b02cb9d00c40dad0163f (diff)
pull person sort order from tvdb/tmdb data
Diffstat (limited to 'MediaBrowser.Api/LibraryService.cs')
-rw-r--r--MediaBrowser.Api/LibraryService.cs23
1 files changed, 15 insertions, 8 deletions
diff --git a/MediaBrowser.Api/LibraryService.cs b/MediaBrowser.Api/LibraryService.cs
index 582eb6f49..06b90b32c 100644
--- a/MediaBrowser.Api/LibraryService.cs
+++ b/MediaBrowser.Api/LibraryService.cs
@@ -681,6 +681,11 @@ namespace MediaBrowser.Api
{
var album = originalItem as MusicAlbum;
+ if (album == null)
+ {
+ album = originalItem.Parents.OfType<MusicAlbum>().FirstOrDefault();
+ }
+
if (album != null)
{
var linkedItemWithThemes = album.SoundtrackIds
@@ -744,17 +749,12 @@ namespace MediaBrowser.Api
: (Folder)_libraryManager.RootFolder)
: _dtoService.GetItemByDtoId(id, userId);
- while (GetSoundtrackSongIds(item).Count == 0 && inheritFromParent && item.Parent != null)
- {
- item = item.Parent;
- }
-
// Get everything
var fields = Enum.GetNames(typeof(ItemFields))
.Select(i => (ItemFields)Enum.Parse(typeof(ItemFields), i, true))
.ToList();
- var dtos = GetSoundtrackSongIds(item)
+ var dtos = GetSoundtrackSongIds(item, inheritFromParent)
.Select(_libraryManager.GetItemById)
.OfType<MusicAlbum>()
.SelectMany(i => i.RecursiveChildren)
@@ -772,7 +772,7 @@ namespace MediaBrowser.Api
};
}
- private List<Guid> GetSoundtrackSongIds(BaseItem item)
+ private IEnumerable<Guid> GetSoundtrackSongIds(BaseItem item, bool inherit)
{
var hasSoundtracks = item as IHasSoundtracks;
@@ -781,7 +781,14 @@ namespace MediaBrowser.Api
return hasSoundtracks.SoundtrackIds;
}
- return new List<Guid>();
+ if (!inherit)
+ {
+ return null;
+ }
+
+ hasSoundtracks = item.Parents.OfType<IHasSoundtracks>().FirstOrDefault();
+
+ return hasSoundtracks != null ? hasSoundtracks.SoundtrackIds : new List<Guid>();
}
}
}