jellyfin icon indicating copy to clipboard operation
jellyfin copied to clipboard

Migrate MusicBrainz plugin to MetaBrainz.MusicBrainz

Open Shadowghost opened this issue 2 years ago • 11 comments

Rebased the original commits onto master, updated the library and adapted the code where necessary.

Supersedes #6369

Shadowghost avatar Apr 15 '22 18:04 Shadowghost

No changes to OpenAPI specification found. See history of this comment for previous changes.

github-actions[bot] avatar Apr 27 '22 11:04 github-actions[bot]

Are there any chances to see this PR in upcoming 10.8.1 release? Looks like it fixes a bunch of subtle issues with metadata provider :)

Orhideous avatar Jun 17 '22 12:06 Orhideous

Sadly not. The changes are too sever for a maintenance/bugfix release.

Shadowghost avatar Jun 17 '22 13:06 Shadowghost

Sadly not. The changes are too sever for a maintenance/bugfix release.

Does this mean that it breaks compatibility with current APIs? In that case we have to wait until 10.9.0 right? According to Versioning on this page.

CluelessTechnologist avatar Jun 20 '22 14:06 CluelessTechnologist

This PR will hopefully soon be merged into master and therefore be part of 10.9.

Shadowghost avatar Jun 20 '22 14:06 Shadowghost

Well, I rebased this two commits on top of 10.8.x branch and tested on my library. So, by now:

Broken default server

Default server doesn't work with protocol, only as bare hostname. With protocol I got this error:

jellyfin    | System.UriFormatException: Invalid URI: The hostname could not be parsed.
jellyfin    |    at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind, UriCreationOptions& creationOptions)
jellyfin    |    at System.Uri..ctor(String uriString)
jellyfin    |    at System.UriBuilder.get_Uri()
jellyfin    |    at MetaBrainz.MusicBrainz.Query.BuildUri(String path, String extra)
jellyfin    |    at MetaBrainz.MusicBrainz.Query.<>c__DisplayClass706_0.<PerformRequestAsync>b__0()
jellyfin    |    at MetaBrainz.MusicBrainz.Query.ApplyDelayAsync[T](Func`1 request, CancellationToken cancellationToken)
jellyfin    |    at MetaBrainz.MusicBrainz.Query.PerformRequestAsync(String entity, String id, String extra, CancellationToken cancellationToken)
jellyfin    |    at MetaBrainz.MusicBrainz.Objects.PagedQueryResults`3.PerformRequestAsync(CancellationToken cancellationToken)
jellyfin    |    at MetaBrainz.MusicBrainz.Objects.PagedQueryResults`3.NextAsync(CancellationToken cancellationToken)
jellyfin    |    at MediaBrowser.Providers.Plugins.MusicBrainz.MusicBrainzAlbumProvider.GetMetadata(AlbumInfo info, CancellationToken cancellationToken)
jellyfin    |    at MediaBrowser.Providers.Manager.MetadataService`2.ExecuteRemoteProviders(MetadataResult`1 temp, String logName, TIdType id, IEnumerable`1 providers, CancellationToken cancellationToken)

Slightly broken(?) search

Search by release id (album) AND release group simultaneously fails with error:

jellyfin    | MetaBrainz.MusicBrainz.QueryException: releases is not a valid inc parameter for the release resource. (For usage, please see: https://musicbrainz.org/development/mmd)
jellyfin    |    at MetaBrainz.MusicBrainz.Query.PerformRequestAsync(Uri uri, HttpMethod method, HttpContent body, CancellationToken cancellationToken)
jellyfin    |    at MetaBrainz.MusicBrainz.Query.ApplyDelayAsync[T](Func`1 request, CancellationToken cancellationToken)
jellyfin    |    at MetaBrainz.MusicBrainz.Query.PerformRequestAsync(String entity, String id, String extra, CancellationToken cancellationToken)
jellyfin    |    at MetaBrainz.MusicBrainz.Query.PerformRequestAsync[T](String entity, String id, String extra, CancellationToken cancellationToken)
jellyfin    |    at MetaBrainz.MusicBrainz.Query.LookupReleaseAsync(Guid mbid, Include inc, CancellationToken cancellationToken)
jellyfin    |    at MediaBrowser.Providers.Plugins.MusicBrainz.MusicBrainzAlbumProvider.GetSearchResults(AlbumInfo searchInfo, CancellationToken cancellationToken)
jellyfin    |    at MediaBrowser.Providers.Manager.ProviderManager.GetSearchResults[TLookupType](IRemoteSearchProvider`1 provider, TLookupType searchInfo, CancellationToken cancellationToken)
jellyfin    |    at MediaBrowser.Providers.Manager.ProviderManager.GetRemoteSearchResults[TItemType,TLookupType](RemoteSearchQuery`1 searchInfo, BaseItem referenceItem, CancellationToken cancellationToken)

I used UUIDs for this album:

https://musicbrainz.org/release/c8c3a48a-2209-4474-b689-1bf74987ad9a https://musicbrainz.org/release-group/c3009a4b-d532-4bff-8510-01eb2cee8c3b

image

Also, search just by release hangs forever.

Orhideous avatar Jun 21 '22 17:06 Orhideous

Also thanks a lot for your work, @Shadowghost :) The code is really cleaner now. I'll help test this feature on my music library.

Orhideous avatar Jun 21 '22 17:06 Orhideous

Your first issue is a known one from the original PR: https://github.com/jellyfin/jellyfin/pull/6369

I'll take a look at the second issue if I find some time.

Shadowghost avatar Jun 21 '22 17:06 Shadowghost

@Orhideous the second issue should be fixed now. I accidentially set some options which are not supported.

Shadowghost avatar Jul 09 '22 18:07 Shadowghost

@Shadowghost Thanks! I'll test this PR ASAP.

Orhideous avatar Jul 09 '22 18:07 Orhideous

@Orhideous what's your verdict on this and the other PR?

Shadowghost avatar Aug 22 '22 06:08 Shadowghost