The Free Software Media System - Server Backend & API
Apply review suggestions, remove Logo on config page
Shadowghost05844d60c171
diff --git a/Jellyfin.Server/Migrations/Routines/20260831100000_EnableLocalSimilarityProviders.cs b/Jellyfin.Server/Migrations/Routines/20260831100000_EnableLocalSimilarityProviders.csindex 54b9a7ef42..e665725ced 100644--- a/Jellyfin.Server/Migrations/Routines/20260831100000_EnableLocalSimilarityProviders.cs+++ b/Jellyfin.Server/Migrations/Routines/20260831100000_EnableLocalSimilarityProviders.cs@@ -9,6 +9,7 @@ using MediaBrowser.Controller.Entities;using MediaBrowser.Controller.Library;using MediaBrowser.Controller.Providers;using MediaBrowser.Model.Configuration;+using MediaBrowser.Model.Entities;using Microsoft.Extensions.Logging;namespace Jellyfin.Server.Migrations.Routines;@@ -57,59 +58,69 @@ internal class EnableLocalSimilarityProviders : IAsyncMigrationRoutine{cancellationToken.ThrowIfCancellationRequested();- var options = virtualFolder.LibraryOptions;- if (options?.TypeOptions is null || options.TypeOptions.Length == 0)- {- continue;- }+ EnableLocalProviders(virtualFolder, localProvidersByType);+ }- // Some virtual folders don't have a proper item id.- if (!Guid.TryParse(virtualFolder.ItemId, out var folderId))- {- continue;- }+ return Task.CompletedTask;+ }- var collectionFolder = _libraryManager.GetItemById<CollectionFolder>(folderId);- if (collectionFolder is null)- {- _logger.LogWarning("Could not find collection folder for virtual folder '{LibraryName}' with id '{FolderId}'. Skipping.", virtualFolder.Name, folderId);- continue;- }+ private void EnableLocalProviders(VirtualFolderInfo virtualFolder, Dictionary<string, string[]> localProvidersByType)+ {+ var options = virtualFolder.LibraryOptions;+ if (options?.TypeOptions is null || options.TypeOptions.Length == 0)+ {+ return;+ }- var changed = false;- foreach (var typeOptions in options.TypeOptions)- {- if (typeOptions.Type is null || !localProvidersByType.TryGetValue(typeOptions.Type, out var localProviders))- {- continue;- }-- var enabled = typeOptions.SimilarItemProviders ?? [];- var missing = localProviders.Where(name => !enabled.Contains(name, StringComparer.OrdinalIgnoreCase)).ToArray();- if (missing.Length == 0)- {- continue;- }-- // Local providers rank ahead of remote ones, and the enabled list doubles as the- // priority order when no explicit order was saved.- typeOptions.SimilarItemProviders = [.. missing, .. enabled];- if (typeOptions.SimilarItemProviderOrder is { Length: > 0 } order)- {- typeOptions.SimilarItemProviderOrder = [.. missing, .. order];- }-- changed = true;- _logger.LogInformation("Enabled local similarity providers {Providers} for '{ItemType}' in library '{LibraryName}'.", missing, typeOptions.Type, virtualFolder.Name);- }+ // Some virtual folders don't have a proper item id.+ if (!Guid.TryParse(virtualFolder.ItemId, out var folderId))+ {+ return;+ }- if (changed)- {- collectionFolder.UpdateLibraryOptions(options);- }+ var collectionFolder = _libraryManager.GetItemById<CollectionFolder>(folderId);+ if (collectionFolder is null)+ {+ _logger.LogWarning("Could not find collection folder for virtual folder '{LibraryName}' with id '{FolderId}'. Skipping.", virtualFolder.Name, folderId);+ return;}- return Task.CompletedTask;+ var changed = false;+ foreach (var typeOptions in options.TypeOptions)+ {+ changed |= EnableLocalProviders(typeOptions, localProvidersByType, virtualFolder.Name);+ }++ if (changed)+ {+ collectionFolder.UpdateLibraryOptions(options);+ }+ }++ private bool EnableLocalProviders(TypeOptions typeOptions, Dictionary<string, string[]> localProvidersByType, string libraryName)+ {+ if (typeOptions.Type is null || !localProvidersByType.TryGetValue(typeOptions.Type, out var localProviders))+ {+ return false;+ }++ var enabled = typeOptions.SimilarItemProviders ?? [];+ var missing = localProviders.Where(name => !enabled.Contains(name, StringComparer.OrdinalIgnoreCase)).ToArray();+ if (missing.Length == 0)+ {+ return false;+ }++ // Local providers rank ahead of remote ones, and the enabled list doubles as the+ // priority order when no explicit order was saved.+ typeOptions.SimilarItemProviders = [.. missing, .. enabled];+ if (typeOptions.SimilarItemProviderOrder is { Length: > 0 } order)+ {+ typeOptions.SimilarItemProviderOrder = [.. missing, .. order];+ }++ _logger.LogInformation("Enabled local similarity providers {Providers} for '{ItemType}' in library '{LibraryName}'.", missing, typeOptions.Type, libraryName);+ return true;}private Dictionary<string, string[]> GetLocalProvidersByItemType()diff --git a/MediaBrowser.Providers/Plugins/ListenBrainz/Configuration/config.html b/MediaBrowser.Providers/Plugins/ListenBrainz/Configuration/config.htmlindex 0f57321afb..d485fe555a 100644--- a/MediaBrowser.Providers/Plugins/ListenBrainz/Configuration/config.html+++ b/MediaBrowser.Providers/Plugins/ListenBrainz/Configuration/config.html@@ -7,7 +7,6 @@<div id="configPage" data-role="page" class="page type-interior pluginConfigurationPage configPage" data-require="emby-input,emby-button,emby-select"><div data-role="content"><div class="content-primary">- <img id="listenBrainzLogo" alt="ListenBrainz" style="max-width:240px;display:block;margin:0 auto 1em;" /><h1>ListenBrainz</h1><p>Get similar artist recommendations from ListenBrainz Labs.</p><form class="configForm">@@ -60,18 +59,6 @@.addEventListener('pageshow', function () {Dashboard.showLoadingMsg();- // The logo is served as the plugin's embedded image, which is addressed by id and version.- ApiClient.getInstalledPlugins().then(function (plugins) {- var wantedId = ListenBrainzPluginConfig.uniquePluginId.replace(/-/g, '');- var plugin = plugins.filter(function (installed) {- return (installed.Id || '').replace(/-/g, '').toLowerCase() === wantedId;- })[0];-- if (plugin) {- document.querySelector('#listenBrainzLogo').src = ApiClient.getUrl('Plugins/' + plugin.Id + '/' + plugin.Version + '/Image');- }- });-ApiClient.getPluginConfiguration(ListenBrainzPluginConfig.uniquePluginId).then(function (config) {var labsServer = document.querySelector('#labsServer');labsServer.value = config.LabsServer;