From a9f3b5dacbd67ac9df65c5b7bbeef159bbb40aa7 Mon Sep 17 00:00:00 2001 From: Vasily Date: Wed, 26 Feb 2020 10:54:29 +0300 Subject: [PATCH 01/13] Fix ordering of search results --- .../Data/SqliteItemRepository.cs | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs index 44f38504ab..0819379cde 100644 --- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs +++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs @@ -2914,29 +2914,29 @@ namespace Emby.Server.Implementations.Data private string GetOrderByText(InternalItemsQuery query) { var orderBy = query.OrderBy; - if (string.IsNullOrEmpty(query.SearchTerm)) + bool hasSimilar = query.SimilarTo != null; + bool hasSearch = !string.IsNullOrEmpty(query.SearchTerm); + + if (hasSimilar || hasSearch) { - int oldLen = orderBy.Count; - if (oldLen == 0 && query.SimilarTo != null) + List<(string, SortOrder)> prepend = new List<(string, SortOrder)>(4); + if (hasSearch) { - var arr = new (string, SortOrder)[oldLen + 2]; - orderBy.CopyTo(arr, 0); - arr[oldLen] = ("SimilarityScore", SortOrder.Descending); - arr[oldLen + 1] = (ItemSortBy.Random, SortOrder.Ascending); - query.OrderBy = arr; + prepend.Add(("SearchScore", SortOrder.Descending)); + prepend.Add((ItemSortBy.SortName, SortOrder.Ascending)); } - } - else - { - query.OrderBy = new[] + if (hasSimilar) { - ("SearchScore", SortOrder.Descending), - (ItemSortBy.SortName, SortOrder.Ascending) - }; - } - + prepend.Add(("SimilarityScore", SortOrder.Descending)); + prepend.Add((ItemSortBy.Random, SortOrder.Ascending)); + } - if (orderBy.Count == 0) + var arr = new (string, SortOrder)[prepend.Count + orderBy.Count]; + prepend.CopyTo(arr, 0); + orderBy.CopyTo(arr, prepend.Count); + orderBy = query.OrderBy = arr; + } + else if (orderBy.Count == 0) { return string.Empty; } From af8ad2d275e2a1ab6a0fa358ac4708c98287d1a6 Mon Sep 17 00:00:00 2001 From: Mark Monteiro Date: Tue, 10 Mar 2020 19:11:38 +0100 Subject: [PATCH 02/13] Add a template for feature request issues instructing user to not create them Also provide direction for users who are willing to contribute code for new features themselves --- .github/ISSUE_TEMPLATE/feature_request.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000000..98f1b0f738 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,13 @@ +--- +name: Feature Request +about: Request a new feature +title: '' +labels: feature +assignees: '' +--- + +**PLEASE DO NOT OPEN FEATURE REQUEST ISSUES ON GITHUB** + +**Feature requests should be opened up on our dedicated [feature request hub](https://features.jellyfin.org/) so that they can be appropriately discussed and prioritized.** + +If you are willing to contribute to the project by adding a new feature yourself, then please ensure that you first review our [documentation on contributing code](https://jellyfin.org/docs/general/contributing/development.html). Once you have reviewed the documentation feel free to come back here and open an issue here outlining your proposed approach so that it can be documented, tracked and discussed by other team members. From 6d27efe30a78da019f2f99e9281ad3c8a3b4c114 Mon Sep 17 00:00:00 2001 From: Mark Monteiro Date: Tue, 10 Mar 2020 19:18:12 +0100 Subject: [PATCH 03/13] Small text update --- .github/ISSUE_TEMPLATE/feature_request.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 98f1b0f738..8a20815041 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -10,4 +10,4 @@ assignees: '' **Feature requests should be opened up on our dedicated [feature request hub](https://features.jellyfin.org/) so that they can be appropriately discussed and prioritized.** -If you are willing to contribute to the project by adding a new feature yourself, then please ensure that you first review our [documentation on contributing code](https://jellyfin.org/docs/general/contributing/development.html). Once you have reviewed the documentation feel free to come back here and open an issue here outlining your proposed approach so that it can be documented, tracked and discussed by other team members. +However, if you are willing to contribute to the project by adding a new feature yourself, then please ensure that you first review our [documentation on contributing code](https://jellyfin.org/docs/general/contributing/development.html). Once you have reviewed the documentation feel free to come back here and open an issue here outlining your proposed approach so that it can be documented, tracked and discussed by other team members. From dc2510d5e247235f4ee34b38a98cbec4349dcb3e Mon Sep 17 00:00:00 2001 From: artiume Date: Sun, 15 Mar 2020 17:56:53 -0400 Subject: [PATCH 04/13] Update docker dependencies for Gulp --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 73ab3d7904..9c81462e79 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ ARG FFMPEG_VERSION=latest FROM node:alpine as web-builder ARG JELLYFIN_WEB_VERSION=master -RUN apk add curl git \ +RUN apk add curl git zlib zlib-dev autoconf g++ make libpng-dev gifsicle alpine-sdk automake libtool make gcc musl-dev nasm \ && curl -L https://github.com/jellyfin/jellyfin-web/archive/${JELLYFIN_WEB_VERSION}.tar.gz | tar zxf - \ && cd jellyfin-web-* \ && yarn install \ From 7d14bdd6ff09bbd6d67502a6e8160babafe64812 Mon Sep 17 00:00:00 2001 From: artiume Date: Sun, 15 Mar 2020 19:09:15 -0400 Subject: [PATCH 05/13] Update Dockerfile.arm --- Dockerfile.arm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.arm b/Dockerfile.arm index 07780e27bf..c2dcf9b495 100644 --- a/Dockerfile.arm +++ b/Dockerfile.arm @@ -7,7 +7,7 @@ ARG DOTNET_VERSION=3.1 FROM node:alpine as web-builder ARG JELLYFIN_WEB_VERSION=master -RUN apk add curl git \ +RUN apk add curl git zlib zlib-dev autoconf g++ make libpng-dev gifsicle alpine-sdk automake libtool make gcc musl-dev nasm python \ && curl -L https://github.com/jellyfin/jellyfin-web/archive/${JELLYFIN_WEB_VERSION}.tar.gz | tar zxf - \ && cd jellyfin-web-* \ && yarn install \ From d7faea073191b5fe9b924cb248b2120b48ffaf2e Mon Sep 17 00:00:00 2001 From: artiume Date: Sun, 15 Mar 2020 19:09:35 -0400 Subject: [PATCH 06/13] Update Dockerfile.arm64 --- Dockerfile.arm64 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.arm64 b/Dockerfile.arm64 index 9dc6fa7edb..459a4fbe47 100644 --- a/Dockerfile.arm64 +++ b/Dockerfile.arm64 @@ -7,7 +7,7 @@ ARG DOTNET_VERSION=3.1 FROM node:alpine as web-builder ARG JELLYFIN_WEB_VERSION=master -RUN apk add curl git \ +RUN apk add curl git zlib zlib-dev autoconf g++ make libpng-dev gifsicle alpine-sdk automake libtool make gcc musl-dev nasm python \ && curl -L https://github.com/jellyfin/jellyfin-web/archive/${JELLYFIN_WEB_VERSION}.tar.gz | tar zxf - \ && cd jellyfin-web-* \ && yarn install \ From 4c24beccb4586eec86003d0e9cb20b031d735131 Mon Sep 17 00:00:00 2001 From: Mark Monteiro Date: Fri, 20 Mar 2020 11:13:40 +0100 Subject: [PATCH 07/13] Apply suggested changes from code review --- .github/ISSUE_TEMPLATE/feature_request.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 8a20815041..80222296cb 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -8,6 +8,6 @@ assignees: '' **PLEASE DO NOT OPEN FEATURE REQUEST ISSUES ON GITHUB** -**Feature requests should be opened up on our dedicated [feature request hub](https://features.jellyfin.org/) so that they can be appropriately discussed and prioritized.** +**Feature requests should be opened on our dedicated [feature request](https://features.jellyfin.org/) hub so they can be appropriately discussed and prioritized.** -However, if you are willing to contribute to the project by adding a new feature yourself, then please ensure that you first review our [documentation on contributing code](https://jellyfin.org/docs/general/contributing/development.html). Once you have reviewed the documentation feel free to come back here and open an issue here outlining your proposed approach so that it can be documented, tracked and discussed by other team members. +However, if you are willing to contribute to the project by adding a new feature yourself, then please ensure that you first review our [documentation](https://docs.jellyfin.org/general/contributing/development.html) on contributing code. Once you have reviewed the documentation, feel free to come back here and open an issue here outlining your proposed approach so that it can be documented, tracked, and discussed by other team members. From 1da9910673bbede652f225bc4d410b8161bf2ff4 Mon Sep 17 00:00:00 2001 From: Mark Monteiro Date: Fri, 20 Mar 2020 11:18:54 +0100 Subject: [PATCH 08/13] Use a new 'feature-request' label instead of the existing 'feature' label --- .github/ISSUE_TEMPLATE/feature_request.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 80222296cb..d886c64871 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -2,7 +2,7 @@ name: Feature Request about: Request a new feature title: '' -labels: feature +labels: feature-request assignees: '' --- From 6894602dab70f7b9072fff1fd6d18fd55d1421ec Mon Sep 17 00:00:00 2001 From: Mark Monteiro Date: Fri, 20 Mar 2020 11:36:21 +0100 Subject: [PATCH 09/13] Use 'yarn build:production' instead of 'yarn:build' everywhere --- .ci/azure-pipelines-main.yml | 2 +- .ci/azure-pipelines-windows.yml | 2 +- Dockerfile | 2 +- Dockerfile.arm | 2 +- Dockerfile.arm64 | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.ci/azure-pipelines-main.yml b/.ci/azure-pipelines-main.yml index e33ab72f25..5cda81bd5e 100644 --- a/.ci/azure-pipelines-main.yml +++ b/.ci/azure-pipelines-main.yml @@ -43,7 +43,7 @@ jobs: displayName: "Build Web Client" condition: and(succeeded(), or(contains(variables['System.PullRequest.TargetBranch'], 'release'), contains(variables['System.PullRequest.TargetBranch'], 'master'), contains(variables['Build.SourceBranch'], 'release'), contains(variables['Build.SourceBranch'], 'master')), eq(variables['BuildConfiguration'], 'Release'), in(variables['Build.Reason'], 'PullRequest', 'IndividualCI', 'BatchedCI', 'BuildCompletion')) inputs: - script: yarn install && yarn build + script: yarn install && yarn build:production workingDirectory: $(Agent.TempDirectory)/jellyfin-web - task: CopyFiles@2 diff --git a/.ci/azure-pipelines-windows.yml b/.ci/azure-pipelines-windows.yml index 11856f9c82..f3e02f97fd 100644 --- a/.ci/azure-pipelines-windows.yml +++ b/.ci/azure-pipelines-windows.yml @@ -36,7 +36,7 @@ jobs: displayName: "Build Web Client" condition: and(succeeded(), or(contains(variables['System.PullRequest.TargetBranch'], 'release'), contains(variables['System.PullRequest.TargetBranch'], 'master'), contains(variables['Build.SourceBranch'], 'release'), contains(variables['Build.SourceBranch'], 'master')), in(variables['Build.Reason'], 'PullRequest', 'IndividualCI', 'BatchedCI', 'BuildCompletion')) inputs: - script: yarn install && yarn build + script: yarn install && yarn build:production workingDirectory: $(Agent.TempDirectory)/jellyfin-web - task: CopyFiles@2 diff --git a/Dockerfile b/Dockerfile index 73ab3d7904..982bfc2cb8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ RUN apk add curl git \ && curl -L https://github.com/jellyfin/jellyfin-web/archive/${JELLYFIN_WEB_VERSION}.tar.gz | tar zxf - \ && cd jellyfin-web-* \ && yarn install \ - && yarn build \ + && yarn build:production \ && mv dist /dist FROM mcr.microsoft.com/dotnet/core/sdk:${DOTNET_VERSION}-buster as builder diff --git a/Dockerfile.arm b/Dockerfile.arm index 07780e27bf..65f7800cb5 100644 --- a/Dockerfile.arm +++ b/Dockerfile.arm @@ -11,7 +11,7 @@ RUN apk add curl git \ && curl -L https://github.com/jellyfin/jellyfin-web/archive/${JELLYFIN_WEB_VERSION}.tar.gz | tar zxf - \ && cd jellyfin-web-* \ && yarn install \ - && yarn build \ + && yarn build:production \ && mv dist /dist diff --git a/Dockerfile.arm64 b/Dockerfile.arm64 index 9dc6fa7edb..df909c7722 100644 --- a/Dockerfile.arm64 +++ b/Dockerfile.arm64 @@ -11,7 +11,7 @@ RUN apk add curl git \ && curl -L https://github.com/jellyfin/jellyfin-web/archive/${JELLYFIN_WEB_VERSION}.tar.gz | tar zxf - \ && cd jellyfin-web-* \ && yarn install \ - && yarn build \ + && yarn build:production \ && mv dist /dist @@ -35,7 +35,7 @@ ARG APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn ENV NVIDIA_DRIVER_CAPABILITIES="compute,video,utility" COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin -RUN apt-get update && apt-get install --no-install-recommends --no-install-suggests -y \ +RUN apt-get update && apt-get install --no-install-recommends --no-install-suggests -y \ ffmpeg \ libssl-dev \ ca-certificates \ From 887e9c2020f0dee71d24a4464df70e620f6cc805 Mon Sep 17 00:00:00 2001 From: Mark Monteiro Date: Fri, 20 Mar 2020 11:46:51 +0100 Subject: [PATCH 10/13] Remove unnecessary execution of `yarn build:production` --- .ci/azure-pipelines-main.yml | 2 +- .ci/azure-pipelines-windows.yml | 2 +- Dockerfile | 3 +-- Dockerfile.arm | 3 +-- Dockerfile.arm64 | 3 +-- 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.ci/azure-pipelines-main.yml b/.ci/azure-pipelines-main.yml index 5cda81bd5e..09901b2a6a 100644 --- a/.ci/azure-pipelines-main.yml +++ b/.ci/azure-pipelines-main.yml @@ -43,7 +43,7 @@ jobs: displayName: "Build Web Client" condition: and(succeeded(), or(contains(variables['System.PullRequest.TargetBranch'], 'release'), contains(variables['System.PullRequest.TargetBranch'], 'master'), contains(variables['Build.SourceBranch'], 'release'), contains(variables['Build.SourceBranch'], 'master')), eq(variables['BuildConfiguration'], 'Release'), in(variables['Build.Reason'], 'PullRequest', 'IndividualCI', 'BatchedCI', 'BuildCompletion')) inputs: - script: yarn install && yarn build:production + script: yarn install workingDirectory: $(Agent.TempDirectory)/jellyfin-web - task: CopyFiles@2 diff --git a/.ci/azure-pipelines-windows.yml b/.ci/azure-pipelines-windows.yml index f3e02f97fd..32d1d1382d 100644 --- a/.ci/azure-pipelines-windows.yml +++ b/.ci/azure-pipelines-windows.yml @@ -36,7 +36,7 @@ jobs: displayName: "Build Web Client" condition: and(succeeded(), or(contains(variables['System.PullRequest.TargetBranch'], 'release'), contains(variables['System.PullRequest.TargetBranch'], 'master'), contains(variables['Build.SourceBranch'], 'release'), contains(variables['Build.SourceBranch'], 'master')), in(variables['Build.Reason'], 'PullRequest', 'IndividualCI', 'BatchedCI', 'BuildCompletion')) inputs: - script: yarn install && yarn build:production + script: yarn install workingDirectory: $(Agent.TempDirectory)/jellyfin-web - task: CopyFiles@2 diff --git a/Dockerfile b/Dockerfile index 982bfc2cb8..8fbfe9baf7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,8 +6,7 @@ ARG JELLYFIN_WEB_VERSION=master RUN apk add curl git \ && curl -L https://github.com/jellyfin/jellyfin-web/archive/${JELLYFIN_WEB_VERSION}.tar.gz | tar zxf - \ && cd jellyfin-web-* \ - && yarn install \ - && yarn build:production \ + && yarn install && mv dist /dist FROM mcr.microsoft.com/dotnet/core/sdk:${DOTNET_VERSION}-buster as builder diff --git a/Dockerfile.arm b/Dockerfile.arm index 65f7800cb5..ae442bd5bb 100644 --- a/Dockerfile.arm +++ b/Dockerfile.arm @@ -10,8 +10,7 @@ ARG JELLYFIN_WEB_VERSION=master RUN apk add curl git \ && curl -L https://github.com/jellyfin/jellyfin-web/archive/${JELLYFIN_WEB_VERSION}.tar.gz | tar zxf - \ && cd jellyfin-web-* \ - && yarn install \ - && yarn build:production \ + && yarn install && mv dist /dist diff --git a/Dockerfile.arm64 b/Dockerfile.arm64 index df909c7722..bcdd90d6e3 100644 --- a/Dockerfile.arm64 +++ b/Dockerfile.arm64 @@ -10,8 +10,7 @@ ARG JELLYFIN_WEB_VERSION=master RUN apk add curl git \ && curl -L https://github.com/jellyfin/jellyfin-web/archive/${JELLYFIN_WEB_VERSION}.tar.gz | tar zxf - \ && cd jellyfin-web-* \ - && yarn install \ - && yarn build:production \ + && yarn install && mv dist /dist From 589958d13f53d6a7153b177d633f173859f1c24d Mon Sep 17 00:00:00 2001 From: Mark Monteiro Date: Fri, 20 Mar 2020 22:41:58 +0100 Subject: [PATCH 11/13] Add missing trailing slashes --- Dockerfile | 2 +- Dockerfile.arm | 2 +- Dockerfile.arm64 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8fbfe9baf7..8ffd72dafd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ ARG JELLYFIN_WEB_VERSION=master RUN apk add curl git \ && curl -L https://github.com/jellyfin/jellyfin-web/archive/${JELLYFIN_WEB_VERSION}.tar.gz | tar zxf - \ && cd jellyfin-web-* \ - && yarn install + && yarn install \ && mv dist /dist FROM mcr.microsoft.com/dotnet/core/sdk:${DOTNET_VERSION}-buster as builder diff --git a/Dockerfile.arm b/Dockerfile.arm index ae442bd5bb..5fb34ca6f5 100644 --- a/Dockerfile.arm +++ b/Dockerfile.arm @@ -10,7 +10,7 @@ ARG JELLYFIN_WEB_VERSION=master RUN apk add curl git \ && curl -L https://github.com/jellyfin/jellyfin-web/archive/${JELLYFIN_WEB_VERSION}.tar.gz | tar zxf - \ && cd jellyfin-web-* \ - && yarn install + && yarn install \ && mv dist /dist diff --git a/Dockerfile.arm64 b/Dockerfile.arm64 index bcdd90d6e3..7fbd05cd68 100644 --- a/Dockerfile.arm64 +++ b/Dockerfile.arm64 @@ -10,7 +10,7 @@ ARG JELLYFIN_WEB_VERSION=master RUN apk add curl git \ && curl -L https://github.com/jellyfin/jellyfin-web/archive/${JELLYFIN_WEB_VERSION}.tar.gz | tar zxf - \ && cd jellyfin-web-* \ - && yarn install + && yarn install \ && mv dist /dist From 6897a1905149134499a5b199b66f0f68a5e3882f Mon Sep 17 00:00:00 2001 From: Mark Monteiro Date: Sun, 22 Mar 2020 15:09:51 +0100 Subject: [PATCH 12/13] Add missing null check when retrieving extras --- MediaBrowser.Controller/Entities/BaseItem.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 623262407f..a9ec19e2fd 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -178,6 +178,7 @@ namespace MediaBrowser.Controller.Entities [JsonIgnore] public int? TotalBitrate { get; set; } + [JsonIgnore] public ExtraType? ExtraType { get; set; } @@ -2884,7 +2885,7 @@ namespace MediaBrowser.Controller.Entities public IEnumerable GetExtras(IReadOnlyCollection extraTypes) { - return ExtraIds.Select(LibraryManager.GetItemById).Where(i => i != null && extraTypes.Contains(i.ExtraType.Value)); + return ExtraIds.Select(LibraryManager.GetItemById).Where(i => i?.ExtraType != null && extraTypes.Contains(i.ExtraType.Value)); } public IEnumerable GetTrailers() From 7270997e768a7ceec391809f8185b5d08ff249bb Mon Sep 17 00:00:00 2001 From: dkanada Date: Mon, 23 Mar 2020 00:59:22 +0900 Subject: [PATCH 13/13] add code suggestions Co-Authored-By: Mark Monteiro --- Emby.Server.Implementations/Data/SqliteItemRepository.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs index 0819379cde..0eb396af47 100644 --- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs +++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs @@ -2925,6 +2925,7 @@ namespace Emby.Server.Implementations.Data prepend.Add(("SearchScore", SortOrder.Descending)); prepend.Add((ItemSortBy.SortName, SortOrder.Ascending)); } + if (hasSimilar) { prepend.Add(("SimilarityScore", SortOrder.Descending));