lyarenei / jellyfin-plugin-listenbrainz

ListenBrainz plugin for Jellyfin.
MIT License
75 stars 3 forks source link

[Bug]: Unable to save listenbrainz api key to config #107

Open Titaniumtown opened 3 weeks ago

Titaniumtown commented 3 weeks ago

Bug description

Plugin doesn't save listenbrainz api key, which prevents scrobbling of any sort.

Steps to reproduce

  1. Have jellyfin on nixos
  2. Try and save api key like so: image
  3. Reload the page, previously saved settings are no longer there
  4. try and scrobble, nothing shows up in listenbrainz

Expected behavior

Api keys should be saved and scrobbling should occur.

Actual behavior

contents of plugins/configurations/Jellyfin.Plugin.ListenBrainz.xml:

<?xml version="1.0" encoding="utf-8"?>
<PluginConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ListenBrainzApiUrl>https://api.listenbrainz.org</ListenBrainzApiUrl>
  <MusicBrainzApiUrl>https://musicbrainz.org</MusicBrainzApiUrl>
  <IsMusicBrainzEnabled>true</IsMusicBrainzEnabled>
  <IsAlternativeModeEnabled>false</IsAlternativeModeEnabled>
  <IsImmediateFavoriteSyncEnabled>true</IsImmediateFavoriteSyncEnabled>
  <ShouldEmitUserRatingEvent>false</ShouldEmitUserRatingEvent>
  <UserConfigs />
  <LibraryConfigs>
    <LibraryConfig>
      <Id>7e64e319-657a-9516-ec78-490da03edccb</Id>
      <IsAllowed>true</IsAllowed>
    </LibraryConfig>
    <LibraryConfig>
      <Id>f137a2dd-21bb-c1b9-9aa5-c0f6bf02a805</Id>
      <IsAllowed>false</IsAllowed>
    </LibraryConfig>
    <LibraryConfig>
      <Id>a656b907-eb3a-7353-2e40-e44b968d0225</Id>
      <IsAllowed>false</IsAllowed>
    </LibraryConfig>
  </LibraryConfigs>
</PluginConfiguration>

Jellyfin logs

No logs are outputted from jellyfin.

Plugin version

4.0.2.0

Jellyfin Version

10.9.11

Additional info

No response

lyarenei commented 3 weeks ago

I can only reproduce this behavior when I start with no config file (first run) and click on the save button in the general section. But that is expected. If I click on save button in the user config section, then the configuration is saved correctly. I have verified this on macOS, archlinux and whatever is the base for the official docker image (I think it's debian?).

But from your screenshot, it looks like you are clicking on the save button in the user config, right? It's weird that the general plugin config is saved though, maybe the values from user input fields are not gathered from the form. Or maybe something breaks in the meantime and JS crashes? Do you see a Settings saved notification after clicking on the save button?

You can also check the browser console for errors. In network tab, you should also see a POST request with JSON body containing the plugin configuration: POST /Plugins/59B20823-AAFE-454C-A393-17427F518631/Configuration HTTP/1.1


If there is not anything, then I guess the only workaround would be to manually edit the config file and restart the server. The user config should like this

<UserConfigs>
  <UserConfig>
    <JellyfinUserId>849cd48c-492b-400b-8171-ca30b263d6e0</JellyfinUserId>
    <ApiToken>...</ApiToken>
    <IsListenSubmitEnabled>true</IsListenSubmitEnabled>
    <IsFavoritesSyncEnabled>true</IsFavoritesSyncEnabled>
    <UserName>Foobar</UserName>
  </UserConfig>
</UserConfigs>
Titaniumtown commented 3 weeks ago

Do you see a Settings saved notification after clicking on the save button?

No, but when I refresh the page, Error saving settings (or smth similar) shows up briefly. I cannot find anything in the browser console logs. I did see those post requests though, which were indeed being sent. Very perplexing. I'll try and manually edit the config.

Titaniumtown commented 3 weeks ago

Manually editing the config file works perfectly. Very strange :confused:

Titaniumtown commented 3 weeks ago

Nope, I was wrong. Manually editing the config file does "work" as in the listenbrainz plugin sees the api key, but nothing is scrobbled. :(

Titaniumtown commented 3 weeks ago

I got console output!

[12:31:18] [INF] [29] Emby.Server.Implementations.Session.SessionManager: Playback stopped reported by app Finamp 0.9.11 playing Froot. Stopped at 331333 ms
[12:31:18] [INF] [20] Jellyfin.Plugin.ListenBrainz: Processing playback stop event for item Froot associated with user admin
[12:31:18] [INF] [20] Jellyfin.Plugin.ListenBrainz: Getting additional metadata...
[12:31:19] [INF] [29] Jellyfin.Plugin.ListenBrainz: Processing playback start event for item Primadonna associated with user admin
[12:31:19] [INF] [29] Jellyfin.Plugin.ListenBrainz: Getting additional metadata...
[12:32:58] [WRN] [27] Jellyfin.Plugin.ListenBrainz.MusicBrainzApi: Request has been cancelled
[12:32:58] [WRN] [27] Jellyfin.Plugin.ListenBrainz.MusicBrainzApi: Request failed, will retry after 3 seconds