Alpha [WIP] ConnectControl for Spotify
#1
Hey guys,
I just wanted to share with you what I am currently working on. It is a Frontend for Kodi to control a Spotify Instance using the new connect endpoint of the official Spotify webAPI.
You can control any type of Spotify connect enabled Programm (like the official ones or for instance librespot or spotify-connect-web).
Currently it only shows the currently playing track in a nice, for the TV optimized way and provides standard playback control (and the ability to chose which device to play on and to save the current track to the library)

Take a look at some pictures:

Image

Image

Hope you guys like it!

Here is the github repository with all the necessary instructions: https://github.com/NicolasHaeffner/plugi...ectcontrol
Reply
#2
Did you find out what was causing your icons to go wonky with different skins?
Reply
#3
(2017-05-11, 16:43)gedisony Wrote: Did you find out what was causing your icons to go wonky with different skins?


No, frankly speaking I have no idea at all what could be causing it but I will keep on trying to fix this..


Gesendet von iPad mit Tapatalk
Reply
#4
Hi, thanks for sharing the plugin! I'd like to give it a try but unfortunately I wasn't able to install it on LibreElec 8.0.1. The Kodi log says "ERROR: CAddonInstallJob[plugin.audio.connectcontrol]: The dependency on script.module.requests version 2.14.0 could not be satisfied." (I hope I translated that correctly, it actually was in Dutch :-))

Any assistance is appreciated.
Reply
#5
Hmm I do not know why I have 2.14.0 in there (should be 2.12.4) and then why it worked for me [emoji28]. Should be fixed now though, so if you would pull it and try again?


Gesendet von iPad mit Tapatalk
Reply
#6
Thanks for the quick reply. I downloaded the zip again (Git isn't installed onLibreElec) and tried to install it. Now it complains about script.module.spotipy version 2.3.6 :-|
Reply
#7
Oh man yeah have deleted the dependency completely now. It isn't necessary anymore just a remaining part of the early stage development process.. hopefully it works now, I did not have many testers till now, so sorry bout that Wink


Gesendet von iPad mit Tapatalk
Reply
#8
Don't worry about it, I *am* your tester :-)

Anyway, it did install as expected. I entered the username, Client ID and Client Secret. I tried to start the addon, but a quick error message flashed in the top right corner. Although I have the Chromium browser addon installed, the browser didn't come up, so I enabled the debug log and checked it. There was no line saying "ConnectControl: Please navigate here", but there was this error message:

Code:
01:02:48.469 T:140514858903296    INFO: initializing python engine.
01:02:48.469 T:140514858903296   DEBUG: CPythonInvoker(21, /storage/.kodi/addons/plugin.audio.connectcontrol/plugin.py): start processing
01:02:48.483 T:140514858903296   DEBUG: -->Python Interpreter Initialized<--
01:02:48.483 T:140514858903296   DEBUG: CPythonInvoker(21, /storage/.kodi/addons/plugin.audio.connectcontrol/plugin.py): the source file to load is "/storage/.kodi/addons/plugin.audio.connectcontrol/plugin.py"
01:02:48.483 T:140514858903296   DEBUG: CPythonInvoker(21, /storage/.kodi/addons/plugin.audio.connectcontrol/plugin.py): setting the Python path to /storage/.kodi/addons/plugin.audio.connectcontrol:/storage/.kodi/addons/script.module.pyxbmct/lib:/storage/.kodi/addons/script.module.requests/lib:/storage/.kodi/addons/script.module.six/lib:/usr/share/kodi/addons/script.module.pil/lib:/usr/lib/python27.zip:/usr/lib/python2.7:/usr/lib/python2.7/plat-linux2:/usr/lib/python2.7/lib-tk:/usr/lib/python2.7/lib-old:/usr/lib/python2.7/lib-dynload:/usr/lib/python2.7/site-packages:/usr/lib/python2.7/site-packages/gtk-2.0
01:02:48.483 T:140514858903296   DEBUG: CPythonInvoker(21, /storage/.kodi/addons/plugin.audio.connectcontrol/plugin.py): entering source directory /storage/.kodi/addons/plugin.audio.connectcontrol
01:02:48.483 T:140514858903296   DEBUG: CPythonInvoker(21, /storage/.kodi/addons/plugin.audio.connectcontrol/plugin.py): instantiating addon using automatically obtained id of "plugin.audio.connectcontrol" dependent on version 2.4.0 of the xbmc.python api
01:02:48.657 T:140514858903296   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <class 'socket.error'>
                                            Error Contents: [Errno 98] Address already in use
                                            Traceback (most recent call last):
                                              File "/storage/.kodi/addons/plugin.audio.connectcontrol/plugin.py", line 166, in <module>
                                                token = util.prompt_for_user_token(username, cachepath, client_id=client_id, client_secret=client_secret, redirect_uri=redirect_uri)
                                              File "/storage/.kodi/addons/plugin.audio.connectcontrol/resources/lib/spotipy/util.py", line 61, in prompt_for_user_token
                                                server = HTTPServer(('localhost', 12345), TokenHandler)
                                              File "/usr/lib/python2.7/SocketServer.py", line 417, in __init__
                                              File "/usr/lib/python2.7/BaseHTTPServer.py", line 108, in server_bind
                                              File "/usr/lib/python2.7/SocketServer.py", line 431, in server_bind
                                              File "/usr/lib/python2.7/socket.py", line 228, in meth
                                            error: [Errno 98] Address already in use
                                            -->End of Python script error report<--
01:02:48.662 T:140516512909440   DEBUG: ------ Window Init (DialogNotification.xml) ------
01:02:48.737 T:140514858903296    INFO: Python script stopped
Reply
#9
Try rebooting it.. somewhere in the background the server is already running (probably because of any of those previous run attempts) or if it still persists afterwards, change the port of the redirect Uri (in the settings and on the Spotify website) maybe some other service is running on 12345 (Original I know..)
BTW I am not sure if the script will start chromium.. I never tried it on libreelec and I am not sure if the method works there.
Don't click it twice when chromium is not starting (because than you will get the same error message as above) and keep in mind that you will have to fill in the local ip of the kodi machine into the Spotify website if you have to do it from another device (there's really no other option here..)


Gesendet von iPad mit Tapatalk
Reply
#10
Allright, I'm making progress, little by little. Rebooting helped: when I started the addon, the Chromium browser opened automatically, asking me to allow the addon. Then I got the message that I could close the browser, as was expected.

Now I went back to the addon, but so far it's just a black screen with a couple of buttons that do nothing. The Kodi log shows this error:

Code:
21:12:21.259 T:140221433358080   ERROR: Exception in thread Thread-1:
                                            Traceback (most recent call last):
                                              File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
                                              File "/usr/lib/python2.7/threading.py", line 754, in run
                                              File "/storage/.kodi/addons/plugin.audio.connectcontrol/plugin.py", line 31, in updateWindow
                                                track = sp.get_player()
                                              File "/storage/.kodi/addons/plugin.audio.connectcontrol/resources/lib/spotipyControl.py", line 17, in get_player
                                                return self._get('me/player')
                                              File "/storage/.kodi/addons/plugin.audio.connectcontrol/resources/lib/spotipy/client.py", line 148, in _get
                                                return self._internal_call('GET', url, payload, kwargs)
                                              File "/storage/.kodi/addons/plugin.audio.connectcontrol/resources/lib/spotipy/client.py", line 126, in _internal_call
                                                headers=r.headers)
                                            SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/me/player:
                                             Permissions missing

And it adds additional errors (all "SpotifyException: http status: 401") when I click the buttons. Other devices do not see the addon as spotify connect device. I'm not sure what the function of port 12345 is, but nmap says it is closed.

Also, I cannot exit the addon in any way (no close button, Alt-F4 and Alt-Tab do nothing) so the only way to get out is to reboot the machine.

Again thanks for your help.
Reply
#11
Hmm I don


Gesendet von iPhone mit Tapatalk
Reply
#12
(2017-05-16, 21:25)Halbstark Wrote: Hmm I don


Gesendet von iPhone mit Tapatalk

Ups that what's my pocket [emoji28]
Do you have Spotify premium? If so please go into the user data/addon_data/plugin.audio.connectcontrol/ and delete the file with the extension .cache and try again.. I have no idea what could cause this error, but what it says is that you do not have the permission to execute the commands

and BTW have you filled in your username, client secret, client id and redirect uri into the settings?

Edit: okay sorry, my bad.. I forgot to add a certain scope (probably it worked for me because I granted access somewhen in the past) I don't know if it will work without deleting the .cache or if it will update automatically.



Gesendet von iPad mit Tapatalk
Reply
#13
I already saw your commit on github... trying right now!
Reply
#14
Yes! It works! Nice :-)
Reply
#15
(2017-05-16, 23:32)marcvangend Wrote: Yes! It works! Nice :-)


Perfect Smile Sooner or later I will add more functionality (browsing) but that might actually take some time.. I have exams soon Undecided


Gesendet von iPad mit Tapatalk
Reply

Logout Mark Read Team Forum Stats Members Help
[WIP] ConnectControl for Spotify0