ldsz / plugin.audio.spotify

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

Update of spotty binary? #2

Open xemwebe opened 3 years ago

xemwebe commented 3 years ago

In my environment (Kodi 19 on Arch Linux, Kernel 5.11.12), I could not connect to spotify using this plugin, because the spotty binary that is packaged with the plugin crashes. I could solve this issue by replacing resources/lib/spotty/x86-linux/spotty-x86_64 (which claims to be version 0.20.0) by an updated binary based on the repository https://github.com/michaelherger/spotty which is version 0.35.0. With this version, I can connect to spotify and everything seems to work, except for the most important part: I don't get any sound, but instead a bunch of error messages:

2021-04-11 11:52:46.192 T:634     ERROR <general>: plugin.audio.spotify --> b'WHOOPS!!! Running spotty still handling same request - leave it alone.'
2021-04-11 11:52:56.202 T:18422   ERROR <general>: CCurlFile::FillBuffer - Failed: Transferred a partial file(18)
2021-04-11 11:52:56.203 T:18422   ERROR <general>: Open - error probing input format, http://localhost:52308/track/77sMIMlNaSURUAXq5coCxE/241.591
2021-04-11 11:52:56.203 T:18422   ERROR <general>: Init: Error creating demuxer
2021-04-11 11:52:56.411 T:626     ERROR <general>: plugin.audio.spotify --> b'WHOOPS!!! Running spotty still handling same request - leave it alone.'
2021-04-11 11:53:06.421 T:18422   ERROR <general>: CCurlFile::FillBuffer - Failed: Transferred a partial file(18)
2021-04-11 11:53:06.422 T:18422   ERROR <general>: Open - error probing input format, http://localhost:52308/track/77sMIMlNaSURUAXq5coCxE/241.591
2021-04-11 11:53:06.423 T:18422   ERROR <general>: Init: Error creating demuxer
2021-04-11 11:53:06.423 T:18422   ERROR <general>: CAudioDecoder: Unable to Init Codec while loading file http://localhost:52308/track/77sMIMlNaSURUAXq5coCxE/241.591

This raises a couple of questions:

ldsz commented 3 years ago

I tried to update spotty binary to 0.35 but this version as an issues with special characters in login name. That why I leave 0.20. I understand this can be an issues for others. More work must be done to allow special characters with Spotty 0.35.

You might be the first to try it on Arch, I didn't. In your case, the HTTP server used to serve the downloaded song is running but not data are available.

xemwebe commented 3 years ago

Well, that's a valid reason for not updating. Regarding the second part of your answer: Does that mean that downloading the songs from the spotify server does not work? Does the addon starts a server to let kodi download the song from this server? In the addons data folder, I could see some binary files which could be downloaded songs, but I have no idea what data format these files have.

ldsz commented 3 years ago

I think they are wave file. But you have a partial transfer, I guess they're very small. Maybe this is linked to the authentification issues. The plugin generate the header of the file but can't download from Spotify. What was the issues with spotty 0.20 ?

xemwebe commented 3 years ago

With spotty 0.20, I could not authenticate at all. If you are interested, I could roll back to version 0.20 and send you the error logs (and I don't use any special characters, but long random strings of alphanumerical characters as password).

xemwebe commented 3 years ago

Here are the error messages I get when I try to use spotty 0.20:

2021-04-13 11:51:25.075 T:90584    INFO <general>: plugin.audio.spotify --> b'trying AP Port 443'
2021-04-13 11:51:40.232 T:90607    INFO <general>: plugin.audio.spotify --> b'trying AP Port 443'
2021-04-13 11:51:55.387 T:90650    INFO <general>: plugin.audio.spotify --> b'trying AP Port 443'
2021-04-13 11:52:03.507 T:577      INFO <general>: JSONRPC Server: New connection added
2021-04-13 11:52:10.541 T:90682    INFO <general>: plugin.audio.spotify --> b'trying AP Port 443'
2021-04-13 11:52:23.259 T:90715    INFO <general>: initializing python engine.
2021-04-13 11:52:23.988 T:90715   ERROR <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'TypeError'>
                                                   Error Contents: '>=' not supported between instances of 'tuple' and 'int'
                                                   Traceback (most recent call last):
                                                     File "/var/lib/kodi/.kodi/addons/plugin.audio.spotify/resources/lib/spotipy/client.py", line 121, in _internal_call
                                                       r.raise_for_status()
                                                     File "/var/lib/kodi/.kodi/addons/script.module.requests/lib/requests/models.py", line 940, in raise_for_status
                                                       raise HTTPError(http_error_msg, response=self)
                                                   requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://api.spotify.com/v1/me/

                                                   During handling of the above exception, another exception occurred:

                                                   Traceback (most recent call last):
                                                     File "/var/lib/kodi/.kodi/addons/plugin.audio.spotify/resources/lib/plugin_content.py", line 57, in __init__
                                                       self.browse_main()
                                                     File "/var/lib/kodi/.kodi/addons/plugin.audio.spotify/resources/lib/plugin_content.py", line 353, in browse_main
                                                       cur_user_label = self.sp.me()["display_name"]
                                                     File "/var/lib/kodi/.kodi/addons/plugin.audio.spotify/resources/lib/spotipy/client.py", line 570, in me
                                                       return self._get('me/')
                                                     File "/var/lib/kodi/.kodi/addons/plugin.audio.spotify/resources/lib/spotipy/client.py", line 148, in _get
                                                       return self._internal_call('GET', url, payload, kwargs)
                                                     File "/var/lib/kodi/.kodi/addons/plugin.audio.spotify/resources/lib/spotipy/client.py", line 124, in _internal_call
                                                       raise SpotifyException(r.status_code,
                                                   spotipy.client.SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/me/:
                                                    The access token expired

                                                   During handling of the above exception, another exception occurred:

                                                   Traceback (most recent call last):
                                                     File "/var/lib/kodi/.kodi/addons/plugin.audio.spotify/plugin.py", line 14, in <module>
                                                       PluginContent()
                                                     File "/var/lib/kodi/.kodi/addons/plugin.audio.spotify/resources/lib/plugin_content.py", line 62, in __init__
                                                       log_exception(__name__, exc)
                                                     File "/var/lib/kodi/.kodi/addons/plugin.audio.spotify/resources/lib/utils.py", line 90, in log_exception
                                                       log_msg(format_exc(sys.exc_info()), xbmc.LOGDEBUG)
                                                     File "/usr/lib/python3.9/traceback.py", line 167, in format_exc
                                                       return "".join(format_exception(*sys.exc_info(), limit=limit, chain=chain))
                                                     File "/usr/lib/python3.9/traceback.py", line 120, in format_exception
                                                       return list(TracebackException(
                                                     File "/usr/lib/python3.9/traceback.py", line 493, in __init__
                                                       context = TracebackException(
                                                     File "/usr/lib/python3.9/traceback.py", line 508, in __init__
                                                       self.stack = StackSummary.extract(
                                                     File "/usr/lib/python3.9/traceback.py", line 340, in extract
                                                       if limit >= 0:
                                                   TypeError: '>=' not supported between instances of 'tuple' and 'int'
                                                   -->End of Python script error report<--
2021-04-13 11:52:24.022 T:90666   ERROR <general>: GetDirectory - Error getting plugin://plugin.audio.spotify/
Manlibear commented 3 years ago

I'm running Arch as well (Kodi 19, Arch 5.11.13) , using the default Spotty binary. I'm able to authenticate (using the connect via phone method) however when I try to play a song I too am getting there error:

CCurlFile::FillBuffer - Failed: Transferred a partial file(18)

ldsz commented 3 years ago

If you go to this URL : https://www.spotify.com/fr/account/apps/ Can you see the app Spotify for Kodi ?

flos06 commented 3 years ago

I created a new issue but can see that you guys are already talking about it here. I'm using default spotty and also getting partial file. If I follow your link I see the app Spotify for Kodi