ldsz / plugin.audio.spotify

Unofficial spotify plugin for Kodi 19
GNU General Public License v3.0
47 stars 17 forks source link

Playback via Spotify Connect stops after one track #18

Open jmbreuer opened 3 years ago

jmbreuer commented 3 years ago

Environment

Steps to Reproduce

  1. Have LibreELEC/Kodi running with this spotify plugin enabled
  2. Start Spotify desktop app
  3. Choose the Kodi plugin using "connect to a device..."
  4. Start playback of an album or track within an album
  5. First chosen track plays, queue in spotify application shows upcoming songs
  6. When the first song finishes, the spotify plugin logs some error messages and playback stops

In the logged example, I chose the track "All in the Golden Afternoon" from Alphaville's album "Prostitute", https://open.spotify.com/album/6NCunjK4obZ8BsVDQA3KKi

Expected Results

With plugin.audio.spotify connected to a Spotify application, it should follow the playback queue shown there - continuing in the album, going on to other related tracks as offered by Spotify.

Log

https://paste.kodi.tv/agifunisex.kodi

Messages related to track change from line 85 onwards.

Interpretation

Something expects a resource http://localhost:52308/nexttrack to be available within the plugin's cherrypy, but that results in an HTTP status 500 internal error.

Local playback seems to work differently, in that case, a queue of tracks can be played and managed using Kodi's playlist interface.

Notes

I'm comfortable with making local changes / tryouts, just let me know.

jmbreuer commented 3 years ago

This looks interesting (Log line 122ff):

Request Headers:
  Host: localhost:52308
  Range: bytes=0-

and (Log line 117ff):

File "/storage/.kodi/addons/plugin.audio.spotify/resources/lib/cherrypy/lib/httputil.py", line 91, in get_ranges
  stop = content_length - 1
TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'

A brief look at: https://docs.cherrypy.org/en/latest/_modules/cherrypy/lib/httputil.html suggests that the traceback is a result of cherrypy trying to calculate the byte range on a resource that has no content_length attribute available.

In this particular case and for a completely redundant range of "complete contents", it might useful to just strip out that request header at an appropriate place.