diff options
| author | LogicalPhallacy <44458166+LogicalPhallacy@users.noreply.github.com> | 2019-10-28 21:54:40 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-10-28 21:54:40 -0700 |
| commit | 8edb1c49d8d1835566bd30d8bf5460ab707b1ede (patch) | |
| tree | 03c6b38523efcc4f29691cea3cdc4def0e8d26d8 /MediaBrowser.Api/UserLibrary/UserLibraryService.cs | |
| parent | 984e415c66cbd995d12ea95a3a9d3e2561ce4869 (diff) | |
| parent | c9f4a74af02e08b895cd6a8b8a408b1c0edfb6c4 (diff) | |
Merge pull request #6 from jellyfin/master
Bringing my branch up to sync
Diffstat (limited to 'MediaBrowser.Api/UserLibrary/UserLibraryService.cs')
| -rw-r--r-- | MediaBrowser.Api/UserLibrary/UserLibraryService.cs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/MediaBrowser.Api/UserLibrary/UserLibraryService.cs b/MediaBrowser.Api/UserLibrary/UserLibraryService.cs index a9b06095d..45694a678 100644 --- a/MediaBrowser.Api/UserLibrary/UserLibraryService.cs +++ b/MediaBrowser.Api/UserLibrary/UserLibraryService.cs @@ -2,6 +2,7 @@ using System; using System.Linq; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Common.Extensions; using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; @@ -366,11 +367,21 @@ namespace MediaBrowser.Api.UserLibrary var dtoOptions = GetDtoOptions(_authContext, request); - var dtos = item.GetExtras(new[] { ExtraType.Trailer }) + var dtosExtras = item.GetExtras(new[] { ExtraType.Trailer }) .Select(i => _dtoService.GetBaseItemDto(i, dtoOptions, user, item)) .ToArray(); - return ToOptimizedResult(dtos); + if (item is IHasTrailers hasTrailers) + { + var trailers = hasTrailers.GetTrailers(); + var dtosTrailers = _dtoService.GetBaseItemDtos(trailers, dtoOptions, user, item); + var allTrailers = new BaseItemDto[dtosExtras.Length + dtosTrailers.Count]; + dtosExtras.CopyTo(allTrailers, 0); + dtosTrailers.CopyTo(allTrailers, dtosExtras.Length); + return ToOptimizedResult(allTrailers); + } + + return ToOptimizedResult(dtosExtras); } /// <summary> |
