diff --git a/MediaBrowser.Providers/Plugins/MusicBrainz/Configuration/PluginConfiguration.cs b/MediaBrowser.Providers/Plugins/MusicBrainz/Configuration/PluginConfiguration.cs
index 1d4b88087..22229e377 100644
--- a/MediaBrowser.Providers/Plugins/MusicBrainz/Configuration/PluginConfiguration.cs
+++ b/MediaBrowser.Providers/Plugins/MusicBrainz/Configuration/PluginConfiguration.cs
@@ -23,11 +23,7 @@ public class PluginConfiguration : BasePluginConfiguration
{
get => _server;
- set
- {
- _server = value.TrimEnd('/');
- Query.DefaultServer = _server;
- }
+ set => _server = value.TrimEnd('/');
}
///
@@ -46,8 +42,6 @@ public class PluginConfiguration : BasePluginConfiguration
{
_rateLimit = value;
}
-
- Query.DelayBetweenRequests = _rateLimit;
}
}
diff --git a/MediaBrowser.Providers/Plugins/MusicBrainz/MusicBrainzAlbumProvider.cs b/MediaBrowser.Providers/Plugins/MusicBrainz/MusicBrainzAlbumProvider.cs
index e88a51c19..4d9feca6d 100644
--- a/MediaBrowser.Providers/Plugins/MusicBrainz/MusicBrainzAlbumProvider.cs
+++ b/MediaBrowser.Providers/Plugins/MusicBrainz/MusicBrainzAlbumProvider.cs
@@ -28,6 +28,12 @@ public class MusicBrainzAlbumProvider : IRemoteMetadataProvider
public MusicBrainzAlbumProvider()
{
+ MusicBrainz.Plugin.Instance!.ConfigurationChanged += (_, _) =>
+ {
+ Query.DefaultServer = MusicBrainz.Plugin.Instance.Configuration.Server;
+ Query.DelayBetweenRequests = MusicBrainz.Plugin.Instance.Configuration.RateLimit;
+ };
+
_musicBrainzQuery = new Query();
}
@@ -45,14 +51,14 @@ public class MusicBrainzAlbumProvider : IRemoteMetadataProvider 0)
{
- return GetResultsFromResponse(releaseSearchResults.Results);
+ return GetReleaseSearchResult(releaseSearchResults.Results);
}
}
else
@@ -77,14 +83,14 @@ public class MusicBrainzAlbumProvider : IRemoteMetadataProvider 0)
{
- return GetResultsFromResponse(releaseSearchResults.Results);
+ return GetReleaseSearchResult(releaseSearchResults.Results);
}
}
return Enumerable.Empty();
}
- private IEnumerable GetResultsFromResponse(IEnumerable>? releaseSearchResults)
+ private IEnumerable GetReleaseSearchResult(IEnumerable>? releaseSearchResults)
{
if (releaseSearchResults is null)
{
@@ -93,11 +99,11 @@ public class MusicBrainzAlbumProvider : IRemoteMetadataProvider GetResultsFromResponse(IEnumerable? releaseSearchResults)
+ private IEnumerable GetReleaseGroupResult(IEnumerable? releaseSearchResults)
{
if (releaseSearchResults is null)
{
@@ -106,11 +112,11 @@ public class MusicBrainzAlbumProvider : IRemoteMetadataProvider 0 ? releaseGroup.Releases[0] : null;
- releaseId = release?.Id.ToString();
- result.HasMetadata = true;
+ if (release != null)
+ {
+ releaseId = release.Id.ToString();
+ result.HasMetadata = true;
+ }
}
// If there is no release ID, lookup a release with the info we have
diff --git a/MediaBrowser.Providers/Plugins/MusicBrainz/MusicBrainzArtistExternalId.cs b/MediaBrowser.Providers/Plugins/MusicBrainz/MusicBrainzArtistExternalId.cs
index e2fb5621b..b89e67270 100644
--- a/MediaBrowser.Providers/Plugins/MusicBrainz/MusicBrainzArtistExternalId.cs
+++ b/MediaBrowser.Providers/Plugins/MusicBrainz/MusicBrainzArtistExternalId.cs
@@ -6,7 +6,7 @@ using MediaBrowser.Model.Providers;
namespace MediaBrowser.Providers.Plugins.MusicBrainz;
///
-/// MusicBrains Artist ExternalId.
+/// MusicBrainz artist external id.
///
public class MusicBrainzArtistExternalId : IExternalId
{
diff --git a/MediaBrowser.Providers/Plugins/MusicBrainz/MusicBrainzArtistProvider.cs b/MediaBrowser.Providers/Plugins/MusicBrainz/MusicBrainzArtistProvider.cs
index 1d2c9c2c8..2cc3a13be 100644
--- a/MediaBrowser.Providers/Plugins/MusicBrainz/MusicBrainzArtistProvider.cs
+++ b/MediaBrowser.Providers/Plugins/MusicBrainz/MusicBrainzArtistProvider.cs
@@ -29,6 +29,12 @@ public class MusicBrainzArtistProvider : IRemoteMetadataProvider
public MusicBrainzArtistProvider()
{
+ MusicBrainz.Plugin.Instance!.ConfigurationChanged += (_, _) =>
+ {
+ Query.DefaultServer = MusicBrainz.Plugin.Instance.Configuration.Server;
+ Query.DelayBetweenRequests = MusicBrainz.Plugin.Instance.Configuration.RateLimit;
+ };
+
_musicBrainzQuery = new Query();
}
@@ -42,7 +48,7 @@ public class MusicBrainzArtistProvider : IRemoteMetadataProvider GetResultsFromResponse(IEnumerable? releaseSearchResults)
- {
- if (releaseSearchResults is null)
- {
- yield break;
- }
-
- foreach (var result in releaseSearchResults)
- {
- yield return GetResultFromResponse(result);
- }
- }
-
private RemoteSearchResult GetResultFromResponse(IArtist artist)
{
var searchResult = new RemoteSearchResult
diff --git a/MediaBrowser.Providers/Plugins/MusicBrainz/Plugin.cs b/MediaBrowser.Providers/Plugins/MusicBrainz/Plugin.cs
index 270d76e6d..39cfd727f 100644
--- a/MediaBrowser.Providers/Plugins/MusicBrainz/Plugin.cs
+++ b/MediaBrowser.Providers/Plugins/MusicBrainz/Plugin.cs
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.Net.Http.Headers;
-using System.Reflection;
+using MediaBrowser.Common;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Plugins;
using MediaBrowser.Model.Plugins;
@@ -21,14 +21,15 @@ public class Plugin : BasePlugin, IHasWebPages
///
/// Instance of the interface.
/// Instance of the interface.
- public Plugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer)
+ /// Instance of the interface.
+ public Plugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer, IApplicationHost applicationHost)
: base(applicationPaths, xmlSerializer)
{
Instance = this;
// TODO: Change this to "JellyfinMusicBrainzPlugin" once we take it out of the server repo.
- Query.DefaultUserAgent.Add(new ProductInfoHeaderValue("Jellyfin", Assembly.GetExecutingAssembly().GetName().Version?.ToString(3)));
- Query.DefaultUserAgent.Add(new ProductInfoHeaderValue("(apps@jellyfin.org)"));
+ Query.DefaultUserAgent.Add(new ProductInfoHeaderValue(applicationHost.Name.Replace(' ', '-'), applicationHost.ApplicationVersionString));
+ Query.DefaultUserAgent.Add(new ProductInfoHeaderValue($"({applicationHost.ApplicationUserAgentAddress})"));
Query.DelayBetweenRequests = Instance.Configuration.RateLimit;
Query.DefaultServer = Instance.Configuration.Server;
}