aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/Library/LibraryService.cs
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2015-04-28 11:03:34 -0400
committerLuke <luke.pulverenti@gmail.com>2015-04-28 11:03:34 -0400
commit23da60856958e1a219cccafeb002ae182b3f812a (patch)
tree52dfd1706f6ae3c8a6d133a105cc09d07d470db1 /MediaBrowser.Api/Library/LibraryService.cs
parente14fa7d8e5b8c97eafec6670797958593e4506f8 (diff)
parent0442de79f4d2ad5d577cb7a5220386f23a7b3f12 (diff)
Merge pull request #1089 from MediaBrowser/dev
3.0.5597.0
Diffstat (limited to 'MediaBrowser.Api/Library/LibraryService.cs')
-rw-r--r--MediaBrowser.Api/Library/LibraryService.cs50
1 files changed, 1 insertions, 49 deletions
diff --git a/MediaBrowser.Api/Library/LibraryService.cs b/MediaBrowser.Api/Library/LibraryService.cs
index 4d9afa260..f89a70340 100644
--- a/MediaBrowser.Api/Library/LibraryService.cs
+++ b/MediaBrowser.Api/Library/LibraryService.cs
@@ -591,7 +591,7 @@ namespace MediaBrowser.Api.Library
ThemeSongsResult = themeSongs,
ThemeVideosResult = themeVideos,
- SoundtrackSongsResult = GetSoundtrackSongs(request, request.Id, request.UserId, request.InheritFromParent)
+ SoundtrackSongsResult = new ThemeMediaResult()
});
}
@@ -789,53 +789,5 @@ namespace MediaBrowser.Api.Library
return ToOptimizedSerializedResultUsingCache(lookup);
}
-
- public ThemeMediaResult GetSoundtrackSongs(GetThemeMedia request, string id, Guid? userId, bool inheritFromParent)
- {
- var user = userId.HasValue ? _userManager.GetUserById(userId.Value) : null;
-
- var item = string.IsNullOrEmpty(id)
- ? (userId.HasValue
- ? user.RootFolder
- : _libraryManager.RootFolder)
- : _libraryManager.GetItemById(id);
-
- var dtoOptions = GetDtoOptions(request);
-
- var dtos = GetSoundtrackSongIds(item, inheritFromParent)
- .Select(_libraryManager.GetItemById)
- .OfType<MusicAlbum>()
- .SelectMany(i => i.GetRecursiveChildren(a => a is Audio))
- .OrderBy(i => i.SortName)
- .Select(i => _dtoService.GetBaseItemDto(i, dtoOptions, user, item));
-
- var items = dtos.ToArray();
-
- return new ThemeMediaResult
- {
- Items = items,
- TotalRecordCount = items.Length,
- OwnerId = _dtoService.GetDtoId(item)
- };
- }
-
- private IEnumerable<Guid> GetSoundtrackSongIds(BaseItem item, bool inherit)
- {
- var hasSoundtracks = item as IHasSoundtracks;
-
- if (hasSoundtracks != null)
- {
- return hasSoundtracks.SoundtrackIds;
- }
-
- if (!inherit)
- {
- return new List<Guid>();
- }
-
- hasSoundtracks = item.Parents.OfType<IHasSoundtracks>().FirstOrDefault();
-
- return hasSoundtracks != null ? hasSoundtracks.SoundtrackIds : new List<Guid>();
- }
}
}