diff --git a/MediaBrowser.Api/LibraryService.cs b/MediaBrowser.Api/LibraryService.cs index f070431c61..bad3b47962 100644 --- a/MediaBrowser.Api/LibraryService.cs +++ b/MediaBrowser.Api/LibraryService.cs @@ -396,7 +396,7 @@ namespace MediaBrowser.Api var tasks = item.ThemeSongIds.Select(_itemRepo.RetrieveItem) .OrderBy(i => i.SortName) - .Select(i => dtoBuilder.GetBaseItemDto(i, fields, user)); + .Select(i => dtoBuilder.GetBaseItemDto(i, fields, user, item)); var items = await Task.WhenAll(tasks).ConfigureAwait(false); @@ -445,7 +445,7 @@ namespace MediaBrowser.Api var tasks = item.ThemeVideoIds.Select(_itemRepo.RetrieveItem) .OrderBy(i => i.SortName) - .Select(i => dtoBuilder.GetBaseItemDto(i, fields, user)); + .Select(i => dtoBuilder.GetBaseItemDto(i, fields, user, item)); var items = await Task.WhenAll(tasks).ConfigureAwait(false); diff --git a/MediaBrowser.Api/UserLibrary/UserLibraryService.cs b/MediaBrowser.Api/UserLibrary/UserLibraryService.cs index 5664a90f98..46254435fa 100644 --- a/MediaBrowser.Api/UserLibrary/UserLibraryService.cs +++ b/MediaBrowser.Api/UserLibrary/UserLibraryService.cs @@ -399,7 +399,12 @@ namespace MediaBrowser.Api.UserLibrary var dtoBuilder = new DtoBuilder(Logger, _libraryManager, _userDataRepository, _itemRepo); - var items = movie.SpecialFeatureIds.Select(_itemRepo.RetrieveItem).OrderBy(i => i.SortName).Select(i => dtoBuilder.GetBaseItemDto(i, fields, user)).Select(t => t.Result).ToList(); + var items = movie.SpecialFeatureIds + .Select(_itemRepo.RetrieveItem) + .OrderBy(i => i.SortName) + .Select(i => dtoBuilder.GetBaseItemDto(i, fields, user, movie)) + .Select(t => t.Result) + .ToList(); return ToOptimizedResult(items); } @@ -420,7 +425,12 @@ namespace MediaBrowser.Api.UserLibrary var dtoBuilder = new DtoBuilder(Logger, _libraryManager, _userDataRepository, _itemRepo); - var items = item.LocalTrailerIds.Select(_itemRepo.RetrieveItem).OrderBy(i => i.SortName).Select(i => dtoBuilder.GetBaseItemDto(i, fields, user)).Select(t => t.Result).ToList(); + var items = item.LocalTrailerIds + .Select(_itemRepo.RetrieveItem) + .OrderBy(i => i.SortName) + .Select(i => dtoBuilder.GetBaseItemDto(i, fields, user, item)) + .Select(t => t.Result) + .ToList(); return ToOptimizedResult(items); } diff --git a/MediaBrowser.Api/VideosService.cs b/MediaBrowser.Api/VideosService.cs index 881c34feec..3208ad46dc 100644 --- a/MediaBrowser.Api/VideosService.cs +++ b/MediaBrowser.Api/VideosService.cs @@ -66,7 +66,7 @@ namespace MediaBrowser.Api var items = video.AdditionalPartIds.Select(_itemRepo.RetrieveItem) .OrderBy(i => i.SortName) - .Select(i => dtoBuilder.GetBaseItemDto(i, fields, user)) + .Select(i => dtoBuilder.GetBaseItemDto(i, fields, user, video)) .Select(t => t.Result) .ToArray(); diff --git a/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs b/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs index e7af4004b5..0dc29cf4bc 100644 --- a/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs +++ b/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs @@ -310,7 +310,6 @@ namespace MediaBrowser.Common.Implementations.Updates protected IEnumerable FilterCatalog(IEnumerable catalog, bool withAutoUpdateEnabled) { - var plugins = ApplicationHost.Plugins; if (withAutoUpdateEnabled) diff --git a/MediaBrowser.Controller/Dto/DtoBuilder.cs b/MediaBrowser.Controller/Dto/DtoBuilder.cs index f9ad23f4f6..c482ae9e0b 100644 --- a/MediaBrowser.Controller/Dto/DtoBuilder.cs +++ b/MediaBrowser.Controller/Dto/DtoBuilder.cs @@ -47,9 +47,10 @@ namespace MediaBrowser.Controller.Dto /// The item. /// The fields. /// The user. + /// The owner. /// Task{DtoBaseItem}. /// item - public async Task GetBaseItemDto(BaseItem item, List fields, User user = null) + public async Task GetBaseItemDto(BaseItem item, List fields, User user = null, BaseItem owner = null) { if (item == null) { @@ -93,7 +94,7 @@ namespace MediaBrowser.Controller.Dto AttachUserSpecificInfo(dto, item, user, fields); } - AttachBasicFields(dto, item, fields); + AttachBasicFields(dto, item, owner, fields); if (fields.Contains(ItemFields.SoundtrackIds)) { @@ -378,8 +379,9 @@ namespace MediaBrowser.Controller.Dto /// /// The dto. /// The item. + /// The owner. /// The fields. - private void AttachBasicFields(BaseItemDto dto, BaseItem item, List fields) + private void AttachBasicFields(BaseItemDto dto, BaseItem item, BaseItem owner, List fields) { if (fields.Contains(ItemFields.DateCreated)) { @@ -495,7 +497,7 @@ namespace MediaBrowser.Controller.Dto // If there are no backdrops, indicate what parent has them in case the Ui wants to allow inheritance if (dto.BackdropImageTags.Count == 0) { - var parentWithBackdrop = GetParentBackdropItem(item); + var parentWithBackdrop = GetParentBackdropItem(item, owner); if (parentWithBackdrop != null) { @@ -514,7 +516,7 @@ namespace MediaBrowser.Controller.Dto // If there is no logo, indicate what parent has one in case the Ui wants to allow inheritance if (!dto.HasLogo) { - var parentWithLogo = GetParentImageItem(item, ImageType.Logo); + var parentWithLogo = GetParentImageItem(item, ImageType.Logo, owner); if (parentWithLogo != null) { @@ -527,7 +529,7 @@ namespace MediaBrowser.Controller.Dto // If there is no art, indicate what parent has one in case the Ui wants to allow inheritance if (!dto.HasArtImage) { - var parentWithImage = GetParentImageItem(item, ImageType.Art); + var parentWithImage = GetParentImageItem(item, ImageType.Art, owner); if (parentWithImage != null) { @@ -936,10 +938,11 @@ namespace MediaBrowser.Controller.Dto /// If an item does not any backdrops, this can be used to find the first parent that does have one /// /// The item. + /// The owner. /// BaseItem. - private BaseItem GetParentBackdropItem(BaseItem item) + private BaseItem GetParentBackdropItem(BaseItem item, BaseItem owner) { - var parent = item.Parent; + var parent = item.Parent ?? owner; while (parent != null) { @@ -959,10 +962,11 @@ namespace MediaBrowser.Controller.Dto /// /// The item. /// The type. + /// The owner. /// BaseItem. - private BaseItem GetParentImageItem(BaseItem item, ImageType type) + private BaseItem GetParentImageItem(BaseItem item, ImageType type, BaseItem owner) { - var parent = item.Parent; + var parent = item.Parent ?? owner; while (parent != null) {