From 803ec1515061ea470f7751eb81d91a4e42e122e6 Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Fri, 6 Dec 2019 21:08:11 +0100 Subject: [PATCH 1/3] Fix ubuntu x64 docker build --- deployment/ubuntu-package-x64/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment/ubuntu-package-x64/Dockerfile b/deployment/ubuntu-package-x64/Dockerfile index 99022891b..21a536e5e 100644 --- a/deployment/ubuntu-package-x64/Dockerfile +++ b/deployment/ubuntu-package-x64/Dockerfile @@ -1,4 +1,4 @@ -FROM microsoft/dotnet:2.2-sdk-bionic +FROM microsoft/dotnet:3.0-sdk-bionic # Docker build arguments ARG SOURCE_DIR=/jellyfin ARG PLATFORM_DIR=/jellyfin/deployment/ubuntu-package-x64 From ec70f3ac75dad10b076a475bbec6d71ded9881a6 Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Fri, 6 Dec 2019 22:06:16 +0100 Subject: [PATCH 2/3] Fix plugin installation and correct api behaviour The `/Packages/{Name}` endpoint would return a package that had either the corrent name or the correct guid. In reality it shoud check if both are correct. --- .../Updates/InstallationManager.cs | 3 +-- MediaBrowser.Api/PackageService.cs | 12 ++++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Emby.Server.Implementations/Updates/InstallationManager.cs b/Emby.Server.Implementations/Updates/InstallationManager.cs index 09a5a0dca..2705e0628 100644 --- a/Emby.Server.Implementations/Updates/InstallationManager.cs +++ b/Emby.Server.Implementations/Updates/InstallationManager.cs @@ -141,8 +141,7 @@ namespace Emby.Server.Implementations.Updates if (guid != Guid.Empty) { - var strGuid = guid.ToString("N", CultureInfo.InvariantCulture); - availablePackages = availablePackages.Where(x => x.guid.Equals(strGuid, StringComparison.OrdinalIgnoreCase)); + availablePackages = availablePackages.Where(x => Guid.Parse(x.guid) == guid); } return availablePackages; diff --git a/MediaBrowser.Api/PackageService.cs b/MediaBrowser.Api/PackageService.cs index 1e5a93210..325acfb7b 100644 --- a/MediaBrowser.Api/PackageService.cs +++ b/MediaBrowser.Api/PackageService.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.Globalization; using System.Linq; -using System.Threading; using System.Threading.Tasks; using MediaBrowser.Common; using MediaBrowser.Common.Extensions; @@ -133,10 +132,11 @@ namespace MediaBrowser.Api /// System.Object. public object Get(GetPackage request) { - var packages = _installationManager.GetAvailablePackages().Result; - - var result = packages.FirstOrDefault(p => string.Equals(p.guid, request.AssemblyGuid ?? "none", StringComparison.OrdinalIgnoreCase)) - ?? packages.FirstOrDefault(p => p.name.Equals(request.Name, StringComparison.OrdinalIgnoreCase)); + var packages = _installationManager.GetAvailablePackages().GetAwaiter().GetResult(); + var result = _installationManager.FilterPackages( + packages, + request.Name, + string.IsNullOrEmpty(request.AssemblyGuid) ? default : Guid.Parse(request.AssemblyGuid)).FirstOrDefault(); return ToOptimizedResult(result); } @@ -181,7 +181,7 @@ namespace MediaBrowser.Api var package = _installationManager.GetCompatibleVersions( packages, request.Name, - new Guid(request.AssemblyGuid), + string.IsNullOrEmpty(request.AssemblyGuid) ? Guid.Empty : Guid.Parse(request.AssemblyGuid), string.IsNullOrEmpty(request.Version) ? null : Version.Parse(request.Version), request.UpdateClass).FirstOrDefault(); From b98e25a07e9b487a65019dc53b28d9337bafd1d4 Mon Sep 17 00:00:00 2001 From: chaosinnovator Date: Tue, 10 Dec 2019 09:30:44 -0800 Subject: [PATCH 3/3] Add StartIndex result to /Items API query --- MediaBrowser.Api/UserLibrary/ItemsService.cs | 8 ++++++-- MediaBrowser.Model/Querying/QueryResult.cs | 6 ++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs index b4a302648..1cddcb9c3 100644 --- a/MediaBrowser.Api/UserLibrary/ItemsService.cs +++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs @@ -127,6 +127,7 @@ namespace MediaBrowser.Api.UserLibrary var result = new QueryResult { + StartIndex = request.StartIndex.GetValueOrDefault(), TotalRecordCount = itemsResult.TotalRecordCount, Items = returnItems }; @@ -177,6 +178,7 @@ namespace MediaBrowser.Api.UserLibrary return new QueryResult { + StartIndex = request.StartIndex.GetValueOrDefault(), TotalRecordCount = result.TotalRecordCount, Items = dtoList }; @@ -237,7 +239,8 @@ namespace MediaBrowser.Api.UserLibrary return new QueryResult { Items = Array.Empty(), - TotalRecordCount = 0 + TotalRecordCount = 0, + StartIndex = 0 }; } @@ -250,7 +253,8 @@ namespace MediaBrowser.Api.UserLibrary return new QueryResult { Items = itemsArray, - TotalRecordCount = itemsArray.Length + TotalRecordCount = itemsArray.Length, + StartIndex = 0 }; } diff --git a/MediaBrowser.Model/Querying/QueryResult.cs b/MediaBrowser.Model/Querying/QueryResult.cs index c007a45d6..221645afb 100644 --- a/MediaBrowser.Model/Querying/QueryResult.cs +++ b/MediaBrowser.Model/Querying/QueryResult.cs @@ -17,6 +17,12 @@ namespace MediaBrowser.Model.Querying /// The total record count. public int TotalRecordCount { get; set; } + /// + /// The index of the first record in Items. + /// + /// First record index. + public int StartIndex { get; set; } + public QueryResult() { Items = Array.Empty();