浏览代码

make sure theme song owner id is correct

Luke Pulverenti 11 年之前
父节点
当前提交
e1fb68b70c
共有 1 个文件被更改,包括 18 次插入6 次删除
  1. 18 6
      MediaBrowser.Api/LibraryService.cs

+ 18 - 6
MediaBrowser.Api/LibraryService.cs

@@ -615,9 +615,15 @@ namespace MediaBrowser.Api
 
                 if (album != null)
                 {
-                    themeSongIds = album.SoundtrackIds
-                        .SelectMany(i => _libraryManager.GetItemById(i).ThemeSongIds)
-                        .ToList();
+                    var linkedItemWithThemes = album.SoundtrackIds
+                        .Select(i => _libraryManager.GetItemById(i))
+                        .FirstOrDefault(i => i.ThemeSongIds.Count > 0);
+
+                    if (linkedItemWithThemes != null)
+                    {
+                        themeSongIds = linkedItemWithThemes.ThemeSongIds;
+                        item = linkedItemWithThemes;
+                    }
                 }
             }
 
@@ -677,9 +683,15 @@ namespace MediaBrowser.Api
 
                 if (album != null)
                 {
-                    themeVideoIds = album.SoundtrackIds
-                        .SelectMany(i => _libraryManager.GetItemById(i).ThemeVideoIds)
-                        .ToList();
+                    var linkedItemWithThemes = album.SoundtrackIds
+                        .Select(i => _libraryManager.GetItemById(i))
+                        .FirstOrDefault(i => i.ThemeVideoIds.Count > 0);
+
+                    if (linkedItemWithThemes != null)
+                    {
+                        themeVideoIds = linkedItemWithThemes.ThemeVideoIds;
+                        item = linkedItemWithThemes;
+                    }
                 }
             }