From 9b339d7caea199ddf3f3f53812830010799eace1 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 2 Apr 2016 17:08:35 -0400 Subject: [PATCH] resolve issue with querying by multiple item ids --- .../ImageMagick/StripCollageBuilder.cs | 12 ++++++------ MediaBrowser.Controller/Channels/Channel.cs | 2 +- .../Channels/ChannelFolderItem.cs | 2 +- MediaBrowser.Controller/Entities/Folder.cs | 19 ++++++++++++++----- MediaBrowser.Controller/Entities/TV/Season.cs | 2 +- MediaBrowser.Controller/Entities/TV/Series.cs | 2 +- .../Entities/UserRootFolder.cs | 3 ++- MediaBrowser.Controller/Entities/UserView.cs | 2 +- .../Configuration/ServerConfiguration.cs | 2 -- 9 files changed, 27 insertions(+), 19 deletions(-) diff --git a/Emby.Drawing/ImageMagick/StripCollageBuilder.cs b/Emby.Drawing/ImageMagick/StripCollageBuilder.cs index 8c50fb5eb..c9e291a5e 100644 --- a/Emby.Drawing/ImageMagick/StripCollageBuilder.cs +++ b/Emby.Drawing/ImageMagick/StripCollageBuilder.cs @@ -295,9 +295,9 @@ namespace Emby.Drawing.ImageMagick wand.OpenImage("gradient:#111111-#111111"); using (var draw = new DrawingWand()) { - var iSlice = Convert.ToInt32(width * .1166666667 * 2); + var iSlice = Convert.ToInt32(width * 0.24125); int iTrans = Convert.ToInt32(height * .25); - int iHeight = Convert.ToInt32(height * .62); + int iHeight = Convert.ToInt32(height * .70); var horizontalImagePadding = Convert.ToInt32(width * 0.0125); foreach (var element in wandImages.ImageList) @@ -339,7 +339,7 @@ namespace Emby.Drawing.ImageMagick wandList.AddImage(mwr); int ex = (int)(wand.CurrentImage.Width - mwg.CurrentImage.Width) / 2; - wand.CurrentImage.CompositeImage(wandList.AppendImages(true), CompositeOperator.AtopCompositeOp, ex, Convert.ToInt32(height * .085)); + wand.CurrentImage.CompositeImage(wandList.AppendImages(true), CompositeOperator.AtopCompositeOp, ex, Convert.ToInt32(height * .045)); } } } @@ -360,9 +360,9 @@ namespace Emby.Drawing.ImageMagick wand.OpenImage("gradient:#111111-#111111"); using (var draw = new DrawingWand()) { - var iSlice = Convert.ToInt32(width * .3); + var iSlice = Convert.ToInt32(width * .32); int iTrans = Convert.ToInt32(height * .25); - int iHeight = Convert.ToInt32(height * .63); + int iHeight = Convert.ToInt32(height * .68); var horizontalImagePadding = Convert.ToInt32(width * 0.02); foreach (var element in wandImages.ImageList) @@ -404,7 +404,7 @@ namespace Emby.Drawing.ImageMagick wandList.AddImage(mwr); int ex = (int)(wand.CurrentImage.Width - mwg.CurrentImage.Width) / 2; - wand.CurrentImage.CompositeImage(wandList.AppendImages(true), CompositeOperator.AtopCompositeOp, ex, Convert.ToInt32(height * .07)); + wand.CurrentImage.CompositeImage(wandList.AppendImages(true), CompositeOperator.AtopCompositeOp, ex, Convert.ToInt32(height * .03)); } } } diff --git a/MediaBrowser.Controller/Channels/Channel.cs b/MediaBrowser.Controller/Channels/Channel.cs index 43f7b6637..718a0d878 100644 --- a/MediaBrowser.Controller/Channels/Channel.cs +++ b/MediaBrowser.Controller/Channels/Channel.cs @@ -38,7 +38,7 @@ namespace MediaBrowser.Controller.Channels set { } } - public override async Task> GetItems(InternalItemsQuery query) + protected override async Task> GetItemsInternal(InternalItemsQuery query) { try { diff --git a/MediaBrowser.Controller/Channels/ChannelFolderItem.cs b/MediaBrowser.Controller/Channels/ChannelFolderItem.cs index da5d60863..62e0d694e 100644 --- a/MediaBrowser.Controller/Channels/ChannelFolderItem.cs +++ b/MediaBrowser.Controller/Channels/ChannelFolderItem.cs @@ -44,7 +44,7 @@ namespace MediaBrowser.Controller.Channels return ExternalId; } - public override async Task> GetItems(InternalItemsQuery query) + protected override async Task> GetItemsInternal(InternalItemsQuery query) { try { diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index af1cbdf2c..f4cdc8fa1 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -111,7 +111,7 @@ namespace MediaBrowser.Controller.Entities [IgnoreDataMember] protected virtual bool SupportsShortcutChildren { - get { return ConfigurationManager.Configuration.EnableWindowsShortcuts; } + get { return false; } } /// @@ -1122,7 +1122,18 @@ namespace MediaBrowser.Controller.Entities return false; } - public virtual async Task> GetItems(InternalItemsQuery query) + public Task> GetItems(InternalItemsQuery query) + { + if (query.ItemIds.Length > 0) + { + var specificItems = query.ItemIds.Select(LibraryManager.GetItemById).Where(i => i != null).ToList(); + return Task.FromResult(PostFilterAndSort(specificItems, query)); + } + + return GetItemsInternal(query); + } + + protected virtual async Task> GetItemsInternal(InternalItemsQuery query) { if (SourceType == SourceType.Channel) { @@ -1175,9 +1186,7 @@ namespace MediaBrowser.Controller.Entities : GetChildren(user, true).Where(filter); } - var result = PostFilterAndSort(items, query); - - return result; + return PostFilterAndSort(items, query); } protected QueryResult PostFilterAndSort(IEnumerable items, InternalItemsQuery query) diff --git a/MediaBrowser.Controller/Entities/TV/Season.cs b/MediaBrowser.Controller/Entities/TV/Season.cs index 9efa609ef..5e067afd4 100644 --- a/MediaBrowser.Controller/Entities/TV/Season.cs +++ b/MediaBrowser.Controller/Entities/TV/Season.cs @@ -129,7 +129,7 @@ namespace MediaBrowser.Controller.Entities.TV get { return (IndexNumber ?? -1) == 0; } } - public override Task> GetItems(InternalItemsQuery query) + protected override Task> GetItemsInternal(InternalItemsQuery query) { var user = query.User; diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.cs index aa07ab378..9eeb89a1f 100644 --- a/MediaBrowser.Controller/Entities/TV/Series.cs +++ b/MediaBrowser.Controller/Entities/TV/Series.cs @@ -157,7 +157,7 @@ namespace MediaBrowser.Controller.Entities.TV return GetSeasons(user, config.DisplayMissingEpisodes, config.DisplayUnairedEpisodes); } - public override Task> GetItems(InternalItemsQuery query) + protected override Task> GetItemsInternal(InternalItemsQuery query) { var user = query.User; diff --git a/MediaBrowser.Controller/Entities/UserRootFolder.cs b/MediaBrowser.Controller/Entities/UserRootFolder.cs index 104408860..8ce39c697 100644 --- a/MediaBrowser.Controller/Entities/UserRootFolder.cs +++ b/MediaBrowser.Controller/Entities/UserRootFolder.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Controller.Library; namespace MediaBrowser.Controller.Entities { @@ -17,7 +18,7 @@ namespace MediaBrowser.Controller.Entities /// public class UserRootFolder : Folder { - public override async Task> GetItems(InternalItemsQuery query) + protected override async Task> GetItemsInternal(InternalItemsQuery query) { if (query.Recursive) { diff --git a/MediaBrowser.Controller/Entities/UserView.cs b/MediaBrowser.Controller/Entities/UserView.cs index 41c19f11d..40fec3e28 100644 --- a/MediaBrowser.Controller/Entities/UserView.cs +++ b/MediaBrowser.Controller/Entities/UserView.cs @@ -45,7 +45,7 @@ namespace MediaBrowser.Controller.Entities return list; } - public override Task> GetItems(InternalItemsQuery query) + protected override Task> GetItemsInternal(InternalItemsQuery query) { var parent = this as Folder; diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs index 041f51a89..ba3362332 100644 --- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs +++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs @@ -196,8 +196,6 @@ namespace MediaBrowser.Model.Configuration public int SharingExpirationDays { get; set; } - public bool EnableWindowsShortcuts { get; set; } - public bool EnableDateLastRefresh { get; set; } public string[] Migrations { get; set; }