aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShadowghost <Ghost_of_Stone@web.de>2026-08-31 20:44:41 +0200
committerShadowghost <Ghost_of_Stone@web.de>2026-08-31 20:44:41 +0200
commit05844d60c1714a2f551fdcfc46b6a7ffbc9ae645 (patch)
treeba76c55f55e51af4d0e48ee2934146b1b2ca064e
parentff36560575db2e8ee866c8569e0c2fb51f80b446 (diff)
Apply review suggestions, remove Logo on config page
-rw-r--r--Jellyfin.Server/Migrations/Routines/20260831100000_EnableLocalSimilarityProviders.cs105
-rw-r--r--MediaBrowser.Providers/Plugins/ListenBrainz/Configuration/config.html13
2 files changed, 58 insertions, 60 deletions
diff --git a/Jellyfin.Server/Migrations/Routines/20260831100000_EnableLocalSimilarityProviders.cs b/Jellyfin.Server/Migrations/Routines/20260831100000_EnableLocalSimilarityProviders.cs
index 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.html
index 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;