michaelherger / lms-plugin-tidal

A TIDAL plugin to integrate with the Lyrion Music Server (fka. Logitech Media Server)
41 stars 7 forks source link

Main Menu items not updated after account switch #81

Closed renebk closed 2 months ago

renebk commented 2 months ago

Setup: Tidal family subscription with 3 accounts. Problem: When I switch Tidal account on a player, and select the main menu (menu entry with house icon), seem like items are not updated to the new account. Other content like, "My Mix", "Artists" is updated correctly. If I stop the server and deletes cache, the account is correctly switched when the server is restarted.

How to validate:

  1. Start Tidal and go to Main Menu. Validate content
  2. Change Tidal account on the player
  3. Go to Main Menu and validate content is not changed.

I´ve done a complete log of the problem, with a fresh server reboot, and then list Main before and after an account shift. server.log

philippe44 commented 2 months ago

I'll see what I can do but these are undocumented api so not easy to handle

philippe44 commented 2 months ago

I forgot to cache "by user" so you were tapping into the same cache for everybody. I think 1.3.2 should fix this

renebk commented 2 months ago

Thanks Phillippe, works :-) Initial testing did not look promising. But decided to wait some hours and try again. And now everything works really nice. I've been switching randomly between the 3 accounts several times and the information is updated immediately and correctly. Guessing the initial experiences is due to cache, refresh/time-out. Cache is some sort of black magic to me.

renebk commented 2 months ago

Update: Played more around late last evening and this morning. Unfortunately behaviour is not consistent. It's a bit random on when switch and update on information happens. Not an expert here, but looks like cache challenges.

BTW: Is it possible to disable caching and then do a test?

michaelherger commented 2 months ago

What version did you last try with? Also: could you please enable info logging (not debug!) for plugin.tidal, run your tests, then provide the resulting server.log.zip (see Settings/Advanced/Logging)?

renebk commented 2 months ago

Sure thing, Here is system information: Version: 8.5.2 - 1713971774 @ Thu 25 Apr 2024 04:17:24 AM CEST Værtsnavn: raspberrypi Serverens IP-adresse: 10.0.0.35 Styresystem: Debian - DA - utf8 Platformarkitektur: armv7l-linux Perl-version: 5.36.0 - arm-linux-gnueabihf-thread-multi-64int Audio::Scan: 1.08 IO::Socket::SSL: 2.081 Databaseversion: DBD::SQLite 1.58 (sqlite 3.22.0)

Tidal plugin version: 1.3.3 Three accounts active

Logfile is attached. It contains some reboots and try-outs to switch accounts and then go to the Tidal Main menu and load "Radiostations for you".

For the most recent try after reboot, following was done:

  1. Reboot server
  2. Go to Tidal Main Menu and choose "Radio stations"
  3. Switch to account "no 2"
  4. Redo 2
  5. Switch t account "no 3"
  6. Redo 2

Results for this: For account 1 and 2 same list of numbers was returned Account 3 returned a different list

server.log (5).zip

Edit: Problem only relates to the "Main menu" entries. All lists in the default menu are updated correctly (My mix, playlists, artists, albums, numbers).

michaelherger commented 2 months ago

One problem might be that the data had been cached for too long before the update. Now even if the update would not do this any more, the cache still returns the data, as it was cached before the fix. You might have to be patient to wait for the cached entries to eventually expire, or delete cache.db from the cache folder (while LMS is shut down).

michaelherger commented 2 months ago

Oh, and you should reset your log settings. There's a lot of noise in there (likely server and server.plugins).

renebk commented 2 months ago

I´ve gotten quite familiar with the "stop" -> "delete cache" -> "start" routine. Latest this morning, removing all .db files from the cache folder "/var/lib/squeezeboxserver/cache" (any additional configurations I am missing to delete?). It did not improve, unfortunately. All three accounts get the same list of recommended radio stations. Again, problem solely relates to the "Main Menu" items - I use the "Recommended Radio Stations" as reference.
Good point about the log, it had become quite messy. I've done a clean up of that as well and attached a fresh version. server.log (6).zip

Probably getting to the end on this one, as no obvious reason can be found for the behavior.

philippe44 commented 2 months ago

I've found the issue. I'll correct that soon.

philippe44 commented 2 months ago

Done in 1.4.6

renebk commented 2 months ago

I added the codechange and have done more than 50 account switches across several players all successful. Works very solid and fast. Thank you and kudos Phillippe