librespot icon indicating copy to clipboard operation
librespot copied to clipboard

Autoplay failing to get attribute

Open musshorn opened this issue 2 years ago • 6 comments

Describe the bug Autoplay fails with the warning WARN librespot_connect::spirc] Unable to get autoplay user attribute. Continuing with autoplay disabled. but it's enabled in the windows desktop UI image

To reproduce Steps to reproduce the behavior:

  1. Play the last song in a playlist, observe the following warning.

Log

[2022-08-18T10:22:28Z DEBUG librespot_connect::spirc] At track 12 of 11 <"spotify:playlist:7t5BQs06tsKXCXUCAouxYc"> update [true]
[2022-08-18T10:22:28Z WARN  librespot_connect::spirc] Unable to get autoplay user attribute. Continuing with autoplay disabled.
[2022-08-18T10:22:28Z DEBUG librespot_connect::spirc] Looping around back to start, repeat is false
[2022-08-18T10:22:28Z TRACE librespot_connect::spirc] Sending status to server: [kPlayStatusPause]
[2022-08-18T10:22:28Z DEBUG librespot_playback::player] command=Load(SpotifyId("spotify:track:5rQriQOlPspqLyO38OYBUM"), false, 0)
[2022-08-18T10:22:28Z TRACE librespot_playback::player] == Stopping sink ==
[2022-08-18T10:22:29Z TRACE librespot_connect::spirc] ==> kPlayStatusPause
[2022-08-18T10:22:29Z TRACE librespot_connect::spirc] Sending status to server: [kPlayStatusPause]

Host (what you are running librespot on):

  • OS: Linux
  • Platform: Rpi 4b
  • librespot 0.5.0-dev 27e1274 (Built on 2022-08-18, Build ID: SbfdVjDd, Profile: release)

Additional context Looks like it's almost certainly related to the new-api efforts, but I'm not familiar enough with rust to debug it further.

musshorn avatar Aug 18 '22 10:08 musshorn

Can you please post the full debug log, right from the start, including all messages from the initial login?

roderickvd avatar Aug 18 '22 11:08 roderickvd

Certainly!

librespot.log

Not sure if this is a factor but when I was recording that log, the first run it worked (as in the next song autoplayed) it was only after i added the --onevent flag it stopped working. It continued to fail though even when I removed the flag again.

musshorn avatar Aug 19 '22 07:08 musshorn

That’s interesting. When you toggle the autoplay switch in the client while playing in librespot, what do the logs then say?

roderickvd avatar Aug 20 '22 08:08 roderickvd

I've attached a full log, but this appears to be the only message when I toggle autoplay in the client [2022-08-21T02:09:20Z TRACE librespot_connect::spirc] Received attribute mutation for autoplay but key was not found!

librespot.log

I was toggling it before the song ended as well as after

musshorn avatar Aug 21 '22 02:08 musshorn

It's really interesting that apparently, Spotify is not consistent in sending the same product info on login. In your case, you are not being pushed an autoplay property, which myself I do get consistently, at least from The Netherlands. We need to know the initial state, because the mutation message doesn't send a new value, just signals the fact that it's being toggled.

I don't see any other property either that could replace it.

It seems that you have blocked apresolve.spotify.com, correct? Could you try what happens if you unblock it, so that you don't use a fallback access point?

This brings me to a couple of thoughts:

  1. Can anyone verify from other countries or access points?
  2. Does anyone see some alternative way of getting the initial state?
  3. We might need to re-introduce an --autoplay {auto|on|off} command line option to allow for an override.

roderickvd avatar Aug 22 '22 20:08 roderickvd

Bizzare.

I've attached a log with the apresolve.spotify.com block removed, still fails the same way. I'd initially blocked that as I was having the same issue as #972 but I just saw your comment that it's no longer required. librespot.log

musshorn avatar Aug 23 '22 08:08 musshorn

This should now be fixed in 6dc7a11b09b5eea8f333805374ce0b45757e9539 which re-introduces an autoplay command-line option as a manual override.

roderickvd avatar Sep 28 '22 21:09 roderickvd

Confirmed that's working a treat! Thanks for the fix

musshorn avatar Sep 29 '22 20:09 musshorn