aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/automation.yml1
-rw-r--r--.github/workflows/codeql-analysis.yml6
-rw-r--r--.github/workflows/commands.yml4
-rw-r--r--.github/workflows/openapi.yml7
-rw-r--r--.github/workflows/repo-stale.yaml1
-rw-r--r--Directory.Build.props4
-rw-r--r--Emby.Server.Implementations/Data/SqliteItemRepository.cs7
-rw-r--r--Emby.Server.Implementations/Localization/Core/ca.json22
-rw-r--r--Emby.Server.Implementations/Localization/Core/fr.json2
-rw-r--r--Emby.Server.Implementations/Localization/Core/ka.json31
-rw-r--r--Jellyfin.Api/Controllers/LibraryController.cs18
-rw-r--r--Jellyfin.Drawing.Skia/PlayedIndicatorDrawer.cs2
-rw-r--r--Jellyfin.Server.Implementations/Jellyfin.Server.Implementations.csproj2
-rw-r--r--Jellyfin.Server/Jellyfin.Server.csproj2
-rw-r--r--MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs4
-rw-r--r--MediaBrowser.Model/Querying/ItemSortBy.cs5
-rw-r--r--MediaBrowser.Providers/Plugins/MusicBrainz/MusicBrainzAlbumProvider.cs25
-rw-r--r--MediaBrowser.Providers/Plugins/MusicBrainz/MusicBrainzArtistProvider.cs26
18 files changed, 126 insertions, 43 deletions
diff --git a/.github/workflows/automation.yml b/.github/workflows/automation.yml
index 0989df64b..2dc7fb5a3 100644
--- a/.github/workflows/automation.yml
+++ b/.github/workflows/automation.yml
@@ -7,6 +7,7 @@ on:
pull_request_target:
issue_comment:
+permissions: {}
jobs:
label:
name: Labeling
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index adca9680f..677bfc3df 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -27,11 +27,11 @@ jobs:
dotnet-version: '6.0.x'
- name: Initialize CodeQL
- uses: github/codeql-action/init@312e093a1892bd801f026f1090904ee8e460b9b6 # v2
+ uses: github/codeql-action/init@b2a92eb56d8cb930006a1c6ed86b0782dd8a4297 # v2
with:
languages: ${{ matrix.language }}
queries: +security-extended
- name: Autobuild
- uses: github/codeql-action/autobuild@312e093a1892bd801f026f1090904ee8e460b9b6 # v2
+ uses: github/codeql-action/autobuild@b2a92eb56d8cb930006a1c6ed86b0782dd8a4297 # v2
- name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@312e093a1892bd801f026f1090904ee8e460b9b6 # v2
+ uses: github/codeql-action/analyze@b2a92eb56d8cb930006a1c6ed86b0782dd8a4297 # v2
diff --git a/.github/workflows/commands.yml b/.github/workflows/commands.yml
index a29519b29..f7fbc4706 100644
--- a/.github/workflows/commands.yml
+++ b/.github/workflows/commands.yml
@@ -9,6 +9,7 @@ on:
- labeled
- synchronize
+permissions: {}
jobs:
rebase:
name: Rebase
@@ -34,6 +35,9 @@ jobs:
GITHUB_TOKEN: ${{ secrets.JF_BOT_TOKEN }}
check-backport:
+ permissions:
+ contents: read
+
name: Check Backport
if: ${{ ( github.event.issue.pull_request && contains(github.event.comment.body, '@jellyfin-bot check backport') ) || github.event.label.name == 'stable backport' || contains(github.event.pull_request.labels.*.name, 'stable backport' ) }}
runs-on: ubuntu-latest
diff --git a/.github/workflows/openapi.yml b/.github/workflows/openapi.yml
index ca710fe83..a82579f1b 100644
--- a/.github/workflows/openapi.yml
+++ b/.github/workflows/openapi.yml
@@ -5,6 +5,8 @@ on:
- master
pull_request_target:
+permissions: {}
+
jobs:
openapi-head:
name: OpenAPI - HEAD
@@ -55,6 +57,9 @@ jobs:
path: tests/Jellyfin.Server.Integration.Tests/bin/Release/net6.0/openapi.json
openapi-diff:
+ permissions:
+ pull-requests: write # to create or update comment (peter-evans/create-or-update-comment)
+
name: OpenAPI - Difference
if: ${{ github.event_name == 'pull_request_target' }}
runs-on: ubuntu-latest
@@ -90,7 +95,7 @@ jobs:
body="${body//$'\r'/'%0D'}"
echo ::set-output name=body::$body
- name: Find difference comment
- uses: peter-evans/find-comment@b657a70ff16d17651703a84bee1cb9ad9d2be2ea # tag=v2
+ uses: peter-evans/find-comment@f4499a714d59013c74a08789b48abe4b704364a0 # v2
id: find-comment
with:
issue-number: ${{ github.event.pull_request.number }}
diff --git a/.github/workflows/repo-stale.yaml b/.github/workflows/repo-stale.yaml
index f7a77f02b..1c6fe1492 100644
--- a/.github/workflows/repo-stale.yaml
+++ b/.github/workflows/repo-stale.yaml
@@ -5,6 +5,7 @@ on:
- cron: '30 1 * * *'
workflow_dispatch:
+permissions: {}
jobs:
stale:
runs-on: ubuntu-latest
diff --git a/Directory.Build.props b/Directory.Build.props
index f812f4419..44a60ffb5 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -15,8 +15,8 @@
</PropertyGroup>
<ItemGroup>
- <AdditionalFiles Include="$(SolutionDir)/BannedSymbols.txt" />
- <AdditionalFiles Include="$(SolutionDir)/stylecop.json" />
+ <AdditionalFiles Include="$(MSBuildThisFileDirectory)/BannedSymbols.txt" />
+ <AdditionalFiles Include="$(MSBuildThisFileDirectory)/stylecop.json" />
</ItemGroup>
</Project>
diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs
index 371111dff..4f0a15df1 100644
--- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs
+++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs
@@ -2456,6 +2456,8 @@ namespace Emby.Server.Implementations.Data
builder.Append('(');
builder.Append("((CleanName like @SearchTermStartsWith or (OriginalTitle not null and OriginalTitle like @SearchTermStartsWith)) * 10)");
+ builder.Append("+ ((CleanName = @SearchTermStartsWith COLLATE NOCASE or (OriginalTitle not null and OriginalTitle = @SearchTermStartsWith COLLATE NOCASE)) * 10)");
+
if (query.SearchTerm.Length > 1)
{
@@ -3154,6 +3156,11 @@ namespace Emby.Server.Implementations.Data
return ItemSortBy.SimilarityScore;
}
+ if (string.Equals(name, ItemSortBy.SearchScore, StringComparison.OrdinalIgnoreCase))
+ {
+ return ItemSortBy.SearchScore;
+ }
+
// Unknown SortBy, just sort by the SortName.
return ItemSortBy.SortName;
}
diff --git a/Emby.Server.Implementations/Localization/Core/ca.json b/Emby.Server.Implementations/Localization/Core/ca.json
index ab04693cc..c0ed01fdf 100644
--- a/Emby.Server.Implementations/Localization/Core/ca.json
+++ b/Emby.Server.Implementations/Localization/Core/ca.json
@@ -40,16 +40,16 @@
"Movies": "Pel·lícules",
"Music": "Música",
"MusicVideos": "Vídeos Musicals",
- "NameInstallFailed": "Instalació de {0} fallida",
+ "NameInstallFailed": "Instal·lació de {0} fallida",
"NameSeasonNumber": "Temporada {0}",
"NameSeasonUnknown": "Temporada Desconeguda",
"NewVersionIsAvailable": "Una nova versió del Servidor Jellyfin està disponible per descarregar.",
"NotificationOptionApplicationUpdateAvailable": "Actualització d'aplicació disponible",
"NotificationOptionApplicationUpdateInstalled": "Actualització d'aplicació instal·lada",
- "NotificationOptionAudioPlayback": "Reproducció d'audio iniciada",
- "NotificationOptionAudioPlaybackStopped": "Reproducció d'audio aturada",
+ "NotificationOptionAudioPlayback": "Reproducció d'àudio iniciada",
+ "NotificationOptionAudioPlaybackStopped": "Reproducció d'àudio aturada",
"NotificationOptionCameraImageUploaded": "Imatge de càmera pujada",
- "NotificationOptionInstallationFailed": "Instalació fallida",
+ "NotificationOptionInstallationFailed": "Instal·lació fallida",
"NotificationOptionNewLibraryContent": "Nou contingut afegit",
"NotificationOptionPluginError": "Un connector ha fallat",
"NotificationOptionPluginInstalled": "Connector instal·lat",
@@ -72,13 +72,13 @@
"ServerNameNeedsToBeRestarted": "{0} necessita ser reiniciat",
"Shows": "Sèries",
"Songs": "Cançons",
- "StartupEmbyServerIsLoading": "El Servidor d'Jellyfin est&agrave; carregant. Si et plau, prova de nou en breus.",
+ "StartupEmbyServerIsLoading": "El Servidor de Jellyfin està carregant. Si et plau, prova de nou ben aviat.",
"SubtitleDownloadFailureForItem": "Subtitles failed to download for {0}",
"SubtitleDownloadFailureFromForItem": "Els subtítols no s'han pogut baixar de {0} per {1}",
"Sync": "Sincronitzar",
"System": "Sistema",
- "TvShows": "Espectacles de TV",
- "User": "User",
+ "TvShows": "Sèries de TV",
+ "User": "Usuari",
"UserCreatedWithName": "S'ha creat l'usuari {0}",
"UserDeletedWithName": "L'usuari {0} ha estat eliminat",
"UserDownloadingItemWithValues": "{0} està descarregant {1}",
@@ -89,12 +89,12 @@
"UserPolicyUpdatedWithName": "La política d'usuari s'ha actualitzat per {0}",
"UserStartedPlayingItemWithValues": "{0} ha començat a reproduir {1}",
"UserStoppedPlayingItemWithValues": "{0} ha parat de reproduir {1}",
- "ValueHasBeenAddedToLibrary": "{0} ha sigut afegit a la teva llibreria",
+ "ValueHasBeenAddedToLibrary": "{0} ha sigut afegit a la teva biblioteca",
"ValueSpecialEpisodeName": "Especial - {0}",
"VersionNumber": "Versió {0}",
"TaskDownloadMissingSubtitlesDescription": "Cerca a internet els subtítols que faltin a partir de la configuració de metadades.",
"TaskDownloadMissingSubtitles": "Descarrega els subtítols que faltin",
- "TaskRefreshChannelsDescription": "Actualitza la informació dels canals d'internet.",
+ "TaskRefreshChannelsDescription": "Actualitza la informació dels canals d'Internet.",
"TaskRefreshChannels": "Actualitza Canals",
"TaskCleanTranscodeDescription": "Elimina els arxius temporals de transcodificacions que tinguin més d'un dia.",
"TaskCleanTranscode": "Neteja les transcodificacions",
@@ -110,7 +110,7 @@
"TaskRefreshChapterImages": "Extreure les imatges dels capítols",
"TaskCleanCacheDescription": "Elimina els arxius temporals que ja no són necessaris per al servidor.",
"TaskCleanCache": "Elimina arxius temporals",
- "TasksChannelsCategory": "Canals d'internet",
+ "TasksChannelsCategory": "Canals d'Internet",
"TasksApplicationCategory": "Aplicació",
"TasksLibraryCategory": "Biblioteca",
"TasksMaintenanceCategory": "Manteniment",
@@ -118,7 +118,7 @@
"TaskCleanActivityLog": "Buidar Registre d'Activitat",
"Undefined": "Indefinit",
"Forced": "Forçat",
- "Default": "Defecto",
+ "Default": "Defecte",
"TaskOptimizeDatabaseDescription": "Compacta la base de dades i trunca l'espai lliure. Executar aquesta tasca després d’escanejar la biblioteca o fer altres canvis que impliquin modificacions a la base de dades pot millorar el rendiment.",
"TaskOptimizeDatabase": "Optimitzar la base de dades",
"TaskKeyframeExtractorDescription": "Extreu fotogrames clau dels fitxers de vídeo per crear llistes de reproducció HLS més precises. Aquesta tasca pot durar molt de temps.",
diff --git a/Emby.Server.Implementations/Localization/Core/fr.json b/Emby.Server.Implementations/Localization/Core/fr.json
index 768245a09..4877bcd7a 100644
--- a/Emby.Server.Implementations/Localization/Core/fr.json
+++ b/Emby.Server.Implementations/Localization/Core/fr.json
@@ -15,7 +15,7 @@
"Favorites": "Favoris",
"Folders": "Dossiers",
"Genres": "Genres",
- "HeaderAlbumArtists": "Artistes d'album",
+ "HeaderAlbumArtists": "Artistes de l'album",
"HeaderContinueWatching": "Reprendre le visionnage",
"HeaderFavoriteAlbums": "Albums favoris",
"HeaderFavoriteArtists": "Artistes préférés",
diff --git a/Emby.Server.Implementations/Localization/Core/ka.json b/Emby.Server.Implementations/Localization/Core/ka.json
new file mode 100644
index 000000000..78cfda3bd
--- /dev/null
+++ b/Emby.Server.Implementations/Localization/Core/ka.json
@@ -0,0 +1,31 @@
+{
+ "Genres": "ჟანრები",
+ "HeaderAlbumArtists": "ალბომის შემსრულებლები",
+ "HeaderFavoriteAlbums": "რჩეული ალბომები",
+ "TasksApplicationCategory": "აპლიკაცია",
+ "Albums": "ალბომები",
+ "AppDeviceValues": "აპი: {0}, მოწყობილობა: {1}",
+ "Application": "აპლიკაცია",
+ "Artists": "შემსრულებლები",
+ "AuthenticationSucceededWithUserName": "{0} -ის ავთენტიკაცია წარმატებულია",
+ "Books": "წიგნები",
+ "Forced": "ძალით",
+ "Inherit": "მემკვიდრეობით",
+ "Latest": "უახლესი",
+ "Movies": "ფილმები",
+ "Music": "მუსიკა",
+ "Photos": "ფოტოები",
+ "Playlists": "დასაკრავი სიები",
+ "Plugin": "დამატება",
+ "Shows": "სერიალები",
+ "Songs": "სიმღერები",
+ "Sync": "სინქრონიზაცია",
+ "System": "სისტემა",
+ "Undefined": "აღუწერელი",
+ "User": "მომხმარებელი",
+ "TasksMaintenanceCategory": "რემონტი",
+ "TasksLibraryCategory": "ბიბლიოთეკა",
+ "ChapterNameValue": "თავი {0}",
+ "HeaderContinueWatching": "ყურების გაგრძელება",
+ "HeaderFavoriteArtists": "რჩეული შემსრულებლები"
+}
diff --git a/Jellyfin.Api/Controllers/LibraryController.cs b/Jellyfin.Api/Controllers/LibraryController.cs
index 7a57bf1a2..7d5cfc7ae 100644
--- a/Jellyfin.Api/Controllers/LibraryController.cs
+++ b/Jellyfin.Api/Controllers/LibraryController.cs
@@ -637,22 +637,10 @@ namespace Jellyfin.Api.Controllers
await LogDownloadAsync(item, user).ConfigureAwait(false);
}
- var path = item.Path;
+ // Quotes are valid in linux. They'll possibly cause issues here.
+ var filename = Path.GetFileName(item.Path)?.Replace("\"", string.Empty, StringComparison.Ordinal);
- // Quotes are valid in linux. They'll possibly cause issues here
- var filename = (Path.GetFileName(path) ?? string.Empty).Replace("\"", string.Empty, StringComparison.Ordinal);
- if (!string.IsNullOrWhiteSpace(filename))
- {
- // Kestrel doesn't support non-ASCII characters in headers
- if (Regex.IsMatch(filename, @"[^\p{IsBasicLatin}]"))
- {
- // Manually encoding non-ASCII characters, following https://tools.ietf.org/html/rfc5987#section-3.2.2
- filename = WebUtility.UrlEncode(filename);
- }
- }
-
- // TODO determine non-ASCII validity.
- return PhysicalFile(path, MimeTypes.GetMimeType(path), filename, true);
+ return PhysicalFile(item.Path, MimeTypes.GetMimeType(item.Path), filename, true);
}
/// <summary>
diff --git a/Jellyfin.Drawing.Skia/PlayedIndicatorDrawer.cs b/Jellyfin.Drawing.Skia/PlayedIndicatorDrawer.cs
index db4f78398..2a3729942 100644
--- a/Jellyfin.Drawing.Skia/PlayedIndicatorDrawer.cs
+++ b/Jellyfin.Drawing.Skia/PlayedIndicatorDrawer.cs
@@ -42,7 +42,7 @@ namespace Jellyfin.Drawing.Skia
// ask the font manager for a font with that character
paint.Typeface = SKFontManager.Default.MatchCharacter(emojiChar);
- canvas.DrawText(Text, (float)x - 20, OffsetFromTopRightCorner + 12, paint);
+ canvas.DrawText(Text, (float)x - 12, OffsetFromTopRightCorner + 12, paint);
}
}
}
diff --git a/Jellyfin.Server.Implementations/Jellyfin.Server.Implementations.csproj b/Jellyfin.Server.Implementations/Jellyfin.Server.Implementations.csproj
index 8c7eee505..73e9a5882 100644
--- a/Jellyfin.Server.Implementations/Jellyfin.Server.Implementations.csproj
+++ b/Jellyfin.Server.Implementations/Jellyfin.Server.Implementations.csproj
@@ -26,7 +26,7 @@
</ItemGroup>
<ItemGroup>
- <PackageReference Include="EFCoreSecondLevelCacheInterceptor" Version="3.7.5" />
+ <PackageReference Include="EFCoreSecondLevelCacheInterceptor" Version="3.8.0" />
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.11" />
diff --git a/Jellyfin.Server/Jellyfin.Server.csproj b/Jellyfin.Server/Jellyfin.Server.csproj
index 44f92cf83..4cb83cdf0 100644
--- a/Jellyfin.Server/Jellyfin.Server.csproj
+++ b/Jellyfin.Server/Jellyfin.Server.csproj
@@ -48,7 +48,7 @@
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Serilog.Sinks.Graylog" Version="2.3.0" />
- <PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.1.2" />
+ <PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.1.3" />
</ItemGroup>
<ItemGroup>
diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
index 74abb91b2..5e924e4bf 100644
--- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
+++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
@@ -977,7 +977,7 @@ namespace MediaBrowser.Controller.MediaEncoding
// Disable auto inserted SW scaler for HW decoders in case of changed resolution.
var isSwDecoder = string.IsNullOrEmpty(GetHardwareVideoDecoder(state, options));
- if (!isSwDecoder)
+ if (!isSwDecoder && _mediaEncoder.EncoderVersion >= new Version(4, 4))
{
arg.Append(" -autoscale 0");
}
@@ -5569,7 +5569,7 @@ namespace MediaBrowser.Controller.MediaEncoding
&& state.BaseRequest.Context == EncodingContext.Streaming)
{
// Comparison: https://github.com/jansmolders86/mediacenterjs/blob/master/lib/transcoding/desktop.js
- format = " -f mp4 -movflags frag_keyframe+empty_moov";
+ format = " -f mp4 -movflags frag_keyframe+empty_moov+delay_moov";
}
var threads = GetNumberOfThreads(state, encodingOptions, videoCodec);
diff --git a/MediaBrowser.Model/Querying/ItemSortBy.cs b/MediaBrowser.Model/Querying/ItemSortBy.cs
index 470507c53..1a7c9a63b 100644
--- a/MediaBrowser.Model/Querying/ItemSortBy.cs
+++ b/MediaBrowser.Model/Querying/ItemSortBy.cs
@@ -154,5 +154,10 @@ namespace MediaBrowser.Model.Querying
/// The similarity score.
/// </summary>
public const string SimilarityScore = "SimilarityScore";
+
+ /// <summary>
+ /// The search score.
+ /// </summary>
+ public const string SearchScore = "SearchScore";
}
}
diff --git a/MediaBrowser.Providers/Plugins/MusicBrainz/MusicBrainzAlbumProvider.cs b/MediaBrowser.Providers/Plugins/MusicBrainz/MusicBrainzAlbumProvider.cs
index 4d9feca6d..2b0c43d05 100644
--- a/MediaBrowser.Providers/Plugins/MusicBrainz/MusicBrainzAlbumProvider.cs
+++ b/MediaBrowser.Providers/Plugins/MusicBrainz/MusicBrainzAlbumProvider.cs
@@ -13,6 +13,7 @@ using MediaBrowser.Providers.Music;
using MetaBrainz.MusicBrainz;
using MetaBrainz.MusicBrainz.Interfaces.Entities;
using MetaBrainz.MusicBrainz.Interfaces.Searches;
+using Microsoft.Extensions.Logging;
namespace MediaBrowser.Providers.Plugins.MusicBrainz;
@@ -21,16 +22,36 @@ namespace MediaBrowser.Providers.Plugins.MusicBrainz;
/// </summary>
public class MusicBrainzAlbumProvider : IRemoteMetadataProvider<MusicAlbum, AlbumInfo>, IHasOrder, IDisposable
{
+ private readonly ILogger<MusicBrainzAlbumProvider> _logger;
private readonly Query _musicBrainzQuery;
+ private readonly string _musicBrainzDefaultUri = "https://musicbrainz.org";
/// <summary>
/// Initializes a new instance of the <see cref="MusicBrainzAlbumProvider"/> class.
/// </summary>
- public MusicBrainzAlbumProvider()
+ /// <param name="logger">The logger.</param>
+ public MusicBrainzAlbumProvider(ILogger<MusicBrainzAlbumProvider> logger)
{
+ _logger = logger;
+
MusicBrainz.Plugin.Instance!.ConfigurationChanged += (_, _) =>
{
- Query.DefaultServer = MusicBrainz.Plugin.Instance.Configuration.Server;
+ if (Uri.TryCreate(MusicBrainz.Plugin.Instance.Configuration.Server, UriKind.Absolute, out var server))
+ {
+ Query.DefaultServer = server.Host;
+ Query.DefaultPort = server.Port;
+ Query.DefaultUrlScheme = server.Scheme;
+ }
+ else
+ {
+ // Fallback to official server
+ _logger.LogWarning("Invalid MusicBrainz server specified, falling back to official server");
+ var defaultServer = new Uri(_musicBrainzDefaultUri);
+ Query.DefaultServer = defaultServer.Host;
+ Query.DefaultPort = defaultServer.Port;
+ Query.DefaultUrlScheme = defaultServer.Scheme;
+ }
+
Query.DelayBetweenRequests = MusicBrainz.Plugin.Instance.Configuration.RateLimit;
};
diff --git a/MediaBrowser.Providers/Plugins/MusicBrainz/MusicBrainzArtistProvider.cs b/MediaBrowser.Providers/Plugins/MusicBrainz/MusicBrainzArtistProvider.cs
index 2cc3a13be..2b1515426 100644
--- a/MediaBrowser.Providers/Plugins/MusicBrainz/MusicBrainzArtistProvider.cs
+++ b/MediaBrowser.Providers/Plugins/MusicBrainz/MusicBrainzArtistProvider.cs
@@ -4,7 +4,6 @@ using System.Linq;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
-using System.Xml;
using Jellyfin.Extensions;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Providers;
@@ -14,6 +13,7 @@ using MediaBrowser.Providers.Music;
using MetaBrainz.MusicBrainz;
using MetaBrainz.MusicBrainz.Interfaces.Entities;
using MetaBrainz.MusicBrainz.Interfaces.Searches;
+using Microsoft.Extensions.Logging;
namespace MediaBrowser.Providers.Plugins.MusicBrainz;
@@ -22,16 +22,36 @@ namespace MediaBrowser.Providers.Plugins.MusicBrainz;
/// </summary>
public class MusicBrainzArtistProvider : IRemoteMetadataProvider<MusicArtist, ArtistInfo>, IDisposable
{
+ private readonly ILogger<MusicBrainzArtistProvider> _logger;
private readonly Query _musicBrainzQuery;
+ private readonly string _musicBrainzDefaultUri = "https://musicbrainz.org";
/// <summary>
/// Initializes a new instance of the <see cref="MusicBrainzArtistProvider"/> class.
/// </summary>
- public MusicBrainzArtistProvider()
+ /// <param name="logger">The logger.</param>
+ public MusicBrainzArtistProvider(ILogger<MusicBrainzArtistProvider> logger)
{
+ _logger = logger;
+
MusicBrainz.Plugin.Instance!.ConfigurationChanged += (_, _) =>
{
- Query.DefaultServer = MusicBrainz.Plugin.Instance.Configuration.Server;
+ if (Uri.TryCreate(MusicBrainz.Plugin.Instance.Configuration.Server, UriKind.Absolute, out var server))
+ {
+ Query.DefaultServer = server.Host;
+ Query.DefaultPort = server.Port;
+ Query.DefaultUrlScheme = server.Scheme;
+ }
+ else
+ {
+ // Fallback to official server
+ _logger.LogWarning("Invalid MusicBrainz server specified, falling back to official server");
+ var defaultServer = new Uri(_musicBrainzDefaultUri);
+ Query.DefaultServer = defaultServer.Host;
+ Query.DefaultPort = defaultServer.Port;
+ Query.DefaultUrlScheme = defaultServer.Scheme;
+ }
+
Query.DelayBetweenRequests = MusicBrainz.Plugin.Instance.Configuration.RateLimit;
};