FoxxMD / multi-scrobbler

Scrobble plays from multiple sources to multiple clients
https://foxxmd.github.io/multi-scrobbler
MIT License
299 stars 14 forks source link

multiple lastfm users with jellyfin leads to log spam #85

Closed AverageHoarder closed 11 months ago

AverageHoarder commented 11 months ago

Please check the FAQ before submitting a bug report.

Describe the bug I've configured lastfm.json and jellyfin.json with 2 users and scrobbling works for both. However ever since I added a second user the log is constantly being spammed.

To Reproduce Add 2 users to lastfm.json and jellyfin.json and play something.

Maybe there's something wrong with my config, here's how my .jsons look: lastfm.json:

[
  {
    "name": "LastFmUser1",
    "configureAs": "client",
    "data": {
      "apiKey": "REDACTED",
      "secret": "REDACTED",
      "redirectUri": "http://localhost:9078/lastfm/callback"
    }
  },
  {
    "name": "LastFmUser2",
    "configureAs": "client",
    "data": {
      "apiKey": "REDACTED",
      "secret": "REDACTED",
      "redirectUri": "http://localhost:9078/lastfm/callback"
    }
  }
]

jellyfin.json:

[
  {
    "name": "JellyUser1",
    "clients": [LastFmUser1],
    "data": {
      "users": ["User1"],
      "servers": ["jellyfin"],
      "options": {
        "logPayload": false
      }
    }
  },
  {
    "name": "JellyUser2",
    "clients": [LastFmUser2],
    "data": {
      "users": ["User2"],
      "servers": ["jellyfin"],
      "options": {
        "logPayload": false
      }
    }
  }
]

Expected behavior A way to either prevent those from being logged (as it's expected behaviour to not scrobble for a user who is not allowed) or at least to hide them from the log. It spams so many lines per second that the log is becoming unusable.

Logs If possible reproduce the issue with debug logging ON

2023-07-13T14:38:46+02:00 warn : [Sources] [Jellyfin - JellyUser2] Will not scrobble event because author was not an allowed user: User1 {"artists":["Coldplay"],"track":"X&Y"}
2023-07-13T14:38:46+02:00 warn : [Sources] [Jellyfin - JellyUser1] Will not scrobble event because author was not an allowed user: User2 {"artists":["Fleet Foxes"],"track":"Helplessness Blues"}
2023-07-13T14:38:46+02:00 warn : [Sources] [Jellyfin - JellyUser2] Will not scrobble event because author was not an allowed user: User1 {"artists":["Coldplay"],"track":"X&Y"}
2023-07-13T14:38:46+02:00 warn : [Sources] [Jellyfin - JellyUser1] Will not scrobble event because author was not an allowed user: User2 {"artists":["Fleet Foxes"],"track":"Helplessness Blues"}
2023-07-13T14:38:46+02:00 warn : [Sources] [Jellyfin - JellyUser2] Will not scrobble event because author was not an allowed user: User1 {"artists":["Coldplay"],"track":"X&Y"}
2023-07-13T14:38:46+02:00 warn : [Sources] [Jellyfin - JellyUser1] Will not scrobble event because author was not an allowed user: User2 {"artists":["Fleet Foxes"],"track":"Helplessness Blues"}
2023-07-13T14:38:46+02:00 warn : [Sources] [Jellyfin - JellyUser2] Will not scrobble event because author was not an allowed user: User1 {"artists":["Coldplay"],"track":"X&Y"}
2023-07-13T14:38:41+02:00 warn : [Sources] [Jellyfin - JellyUser1] Will not scrobble event because author was not an allowed user: User2 {"artists":["Fleet Foxes"],"track":"Helplessness Blues"}
2023-07-13T14:38:41+02:00 warn : [Sources] [Jellyfin - JellyUser2] Will not scrobble event because author was not an allowed user: User1 {"artists":["Coldplay"],"track":"X&Y"}

Versions (please complete the following information):

FoxxMD commented 11 months ago

Thanks for the writeup and logs! I've added another option for jellyfin that can suppress these log statements: logFilterFailure. This is available in the develop branch or docker image foxxmd/multi-scrobbler:develop.

If you still want to log these warnings for debugging purposes (when using LOG_LEVEL=debug) set

"logFilterFailure ": "debug"

otherwise they can be turned off completely by setting to false like this in your config:

[
  {
    "name": "JellyUser1",
    "clients": [
      "LastFmUser1"
    ],
    "data": {
      "users": [
        "User1"
      ],
      "servers": [
        "jellyfin"
      ],
      "options": {
        "logPayload": false,
        "logFilterFailure": false
      }
    }
  },
  {
    "name": "JellyUser2",
    "clients": [
      "LastFmUser2"
    ],
    "data": {
      "users": [
        "User2"
      ],
      "servers": [
        "jellyfin"
      ],
      "options": {
        "logPayload": false,
        "logFilterFailure": false
      }
    }
  }
]

Please let me know if this fixes your issue.

AverageHoarder commented 11 months ago

That did indeed fix my issue. Thanks, now the logs no longer give me anxiety!

Quick question before you close this issue (if that's alright): If I want to use LastFM both as source and client, the docs say:

"See lastfm.json.example, change configureAs to source."

Does that mean that lastfm can only act as source OR client? Or does it mean that I copy the existing lastfm config dictionary within the .json, paste it and only change configureAs to "source" instead of "client" while leaving api key etc. identical? I'm a bit confused.

My goal is to scrobble from MusicBee to Lastfm directly and let multi-scrobbler then use LastFM as a source for Maloja to sync those scrobbels between LastFM and Maloja. At the same time I want to scrobble from Jellyfin and Plex to Lastfm and Maloja at the same time. Is that feasible?

FoxxMD commented 11 months ago

You can use as many lastfm configs as you want, as source or client. Yes your setup is valid.

Or does it mean that I copy the existing lastfm config dictionary within the .json, paste it and only change configureAs to "source" instead of "client" while leaving api key etc. identical?

Basically this. The only other change would be to make sure that when set as a source you have also specified clients, like this:

[
  {
    "name": "myLastFmSource",
    "configureAs": "source",
    "clients": ["MyMalojaClient"],
    "data": {
      "apiKey": "a89cba1569901a0671d5a9875fed4be1",
      "secret": "ec42e09d5ae0ee0f0816ca151008412a",
      "redirectUri": "http://localhost:9078/lastfm/callback"
    }
  },
  {
    "name": "myLastFmClient",
    "configureAs": "client",
    "data": {
      "apiKey": "a89cba1569901a0671d5a9875fed4be1",
      "secret": "ec42e09d5ae0ee0f0816ca151008412a",
      "redirectUri": "http://localhost:9078/lastfm/callback"
    }
  }
]
AverageHoarder commented 11 months ago

nvm I'm stupid. I typed "client" instead of "clients" in the lastFM source in lastfm.json, which is why it probably scrobbled to more than the intended client. Sorry for wasting your time if you had already read what I wrote before.

The way you suggested works well so far. Thanks a lot!

Feel free to close the issue and thanks again!