Open Elkropac opened 3 years ago
Hi, I'm running some tests but cheroot can be upgraded to the last version. It's not the same for Cherrypy, as I remember some functions were removed or changed.
So, it worked? I will try this updated version
I have an issue with spotify connect, the first song is ok but the next one is not playing. Local playback is ok for me.
I have this in logs
2021-04-27 12:11:51.639 T:1086 ERROR <general>: [27/Apr/2021:12:11:51] HTTP
Traceback (most recent call last):
File "/home/prehravac/.kodi/addons/plugin.audio.spotify/resources/lib/cherrypy/_cprequest.py", line 638, in respond
self._do_respond(path_info)
File "/home/prehravac/.kodi/addons/plugin.audio.spotify/resources/lib/cherrypy/_cprequest.py", line 697, in _do_respond
response.body = self.handler()
File "/home/prehravac/.kodi/addons/plugin.audio.spotify/resources/lib/cherrypy/lib/encoding.py", line 219, in __call__
self.body = self.oldhandler(*args, **kwargs)
File "/home/prehravac/.kodi/addons/plugin.audio.spotify/resources/lib/cherrypy/_cpdispatch.py", line 54, in __call__
return self.callable(*self.args, **self.kwargs)
File "/home/prehravac/.kodi/addons/plugin.audio.spotify/resources/lib/httpproxy.py", line 204, in nexttrack
return self.silence(20)
File "/home/prehravac/.kodi/addons/plugin.audio.spotify/resources/lib/httpproxy.py", line 199, in silence
return cherrypy.lib.static.serve_fileobj(output_buffer.read(), content_type="audio/wav", name="%s.wav" % duration, debug=True)
File "/home/prehravac/.kodi/addons/plugin.audio.spotify/resources/lib/cherrypy/lib/static.py", line 184, in serve_fileobj
return _serve_fileobj(fileobj, content_type, content_length, debug=debug)
File "/home/prehravac/.kodi/addons/plugin.audio.spotify/resources/lib/cherrypy/lib/static.py", line 195, in _serve_fileobj
r = httputil.get_ranges(request.headers.get('Range'), content_length)
File "/home/prehravac/.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'
When i changed line 199 in httpproxy.py to
return cherrypy.lib.static.serve_fileobj(output_buffer.read(), content_type="audio/wav", name="20.wav", debug=True)
I don't know python, so i just removed the formated print :) I guess, this problem will be on more places.
This error goes away. It still behaves strangely, it drops connection on every track change
You have a NoneType for content_length because the file is empty or doesn't exist. I have the same. The code is ok but I'm missing the log about the file not requested or downloaded.
The first error is :
2021-04-26 20:59:02.556 T:4644 ERROR
: [26/Apr/2021:20:59:02] TOOLS.STATIC os has no fstat attribute 2021-04-26 20:59:02.556 T:4644 ERROR : [26/Apr/2021:20:59:02] TOOLS.STATIC Content-Type: 'audio/wav' 2021-04-26 20:59:02.556 T:4644 ERROR : [26/Apr/2021:20:59:02] TOOLS.STATIC Content-Disposition: None
Have you found out something?
Everytime i try to seek in song or to skip to next song (using spotify connect), i get this in log
2021-04-29 23:51:11.057 T:3055 ERROR <general>: [29/Apr/2021:23:51:11] NATIVE_ADAPTER Traceback (most recent call last):
File "/home/prehravac/.kodi/addons/plugin.audio.spotify/resources/lib/cherrypy/_cpnative_server.py", line 89, in respond
self.send_response(
File "/home/prehravac/.kodi/addons/plugin.audio.spotify/resources/lib/cherrypy/_cpnative_server.py", line 117, in send_response
req.write(seg)
File "/home/prehravac/.kodi/addons/plugin.audio.spotify/resources/lib/cheroot/server.py", line 1133, in write
self.conn.wfile.write(chunk)
File "/home/prehravac/.kodi/addons/plugin.audio.spotify/resources/lib/cheroot/makefile.py", line 438, in write
res = super().write(val, *args, **kwargs)
File "/home/prehravac/.kodi/addons/plugin.audio.spotify/resources/lib/cheroot/makefile.py", line 36, in write
self._flush_unlocked()
File "/home/prehravac/.kodi/addons/plugin.audio.spotify/resources/lib/cheroot/makefile.py", line 45, in _flush_unlocked
n = self.raw.write(bytes(self._write_buf))
File "/usr/lib/python3.9/socket.py", line 722, in write
return self._sock.send(b)
ConnectionResetError: [Errno 104] Connection reset by peer
I cannot figure out, which connection is reset. (I think it is download of wav file in proxy)
For a while, i thought, there is problem of 127.0.0.1 vs ::1 vs localhost connection, because i got this on wireshark in roughtly the same time as the error in log.
But even after trying to let the http proxy listen to all ip addresses (suboptimal - opens it to network) , i still get connectionresets in log
I'm not sure to found a solution for now. I commented cherrypy.expose to have a simple solution :
With that modification I can update cheroot and cherrypy to the last version.
Ok, thanks. I will try to debug more, maybe with strace. Can you show me picture of your sound selection, i think, i don't see your options there (i use pulseaudio to be able to send in another sounds/music from bluetooth and home assistant)
It works now, strange. Today, I tested it with my wifes phone and it connects and changes tracks without problem. I have kodi plugin logged in on her account, but until today, i was testing spotify connect with my phone (and my account). There seems to be problem, when re-login to another account is involved.
Hi, when i want reboot or shutdown computer from kodi, it fails, with this in log:
It seem,
isAlive
method was changed tois_alive
in python 3.9. Cheroot included in plugin is really old (6.4.0?). Newest version is 8.5.2 with this fixed.I don't know, if cheroot and cherypy could be easily upgraded.
I changed isAlive to is_alive, for myself, in
/resources/lib/cheroot/workers/threadpool.py
and I can reboot computer from kodi now