Python Plugin: Spotify

Python and python framework
eddieb
Posts: 12
Joined: Wednesday 04 July 2018 7:48
Target OS: NAS (Synology & others)
Domoticz version:
Location: NL
Contact:

Re: Python Plugin: Spotify

Post by eddieb » Thursday 05 July 2018 12:34

Ok, now we are getting somewhere :

root@diskstation:/volume1/@appstore/domoticz/var# curl -v -L "http://127.0.0.1:8084/json.htm?type=com ... rvariables"
> GET /json.htm?type=command&param=getuservariables HTTP/1.1
> Host: 127.0.0.1:8084
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Length: 56
< Content-Type: application/json;charset=UTF-8
< Cache-Control: no-cache
< Pragma: no-cache
< Access-Control-Allow-Origin: *
<
{
"status" : "OK",
"title" : "GetUserVariables"
}



total logging from the plug :
2018-07-05 12:31:05.642 Status: (Spotify) Started.
2018-07-05 12:31:06.024 Status: (Spotify) Entering work loop.
2018-07-05 12:31:06.024 Status: (Spotify) Initialized version 0.1, author 'djj'
2018-07-05 12:31:06.095 Error: (Spotify) Cannot read the uservariable holding the persistent variables

Sjaakios
Posts: 18
Joined: Saturday 04 June 2016 23:41
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin: Spotify

Post by Sjaakios » Thursday 05 July 2018 12:40

Ahh, so you have no variables at all at the moment? Try adding one manually in your domoticz. Maybe that’s causing the issue. (Should solve that in the code of that is the case...)


Verzonden vanaf mijn iPhone met Tapatalk

eddieb
Posts: 12
Joined: Wednesday 04 July 2018 7:48
Target OS: NAS (Synology & others)
Domoticz version:
Location: NL
Contact:

Re: Python Plugin: Spotify

Post by eddieb » Thursday 05 July 2018 12:43

ehm ???
no idea what you mean and how to do that ...
I have 9 devices running smooth for months, no problems with them ...

eddieb
Posts: 12
Joined: Wednesday 04 July 2018 7:48
Target OS: NAS (Synology & others)
Domoticz version:
Location: NL
Contact:

Re: Python Plugin: Spotify

Post by eddieb » Thursday 05 July 2018 12:48

adding a var named test with a value of 1 did the trick...
Perhaps you should modify your code to ignore uservars if there are none ...

Now I get an other error

Error: (Spotify) Error occured in request for getting acces_tokens from Spotify, error code: 400, reason: Bad Request. Seems either client_id, client_secret or code is incorred. Please note that the code received from Spotify could only be used once. Please get a new one from spotify.

let me re-initialize the codes

eddieb
Posts: 12
Joined: Wednesday 04 July 2018 7:48
Target OS: NAS (Synology & others)
Domoticz version:
Location: NL
Contact:

Re: Python Plugin: Spotify

Post by eddieb » Thursday 05 July 2018 12:52

After re-init the code something is happening. I get a device, but only one ...
Screen Shot 2018-07-05 at 13.00.14.png
Screen Shot 2018-07-05 at 13.00.14.png (51.43 KiB) Viewed 96 times
I expected more controls ???

Sjaakios
Posts: 18
Joined: Saturday 04 June 2016 23:41
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin: Spotify

Post by Sjaakios » Thursday 05 July 2018 14:28

Cool! I'll fix that in the code... [update]fixed in new version[/update]

For the usage, now update your user variable Spotify-searchTxt with for instance 'artist coldplay'. After the update. select on the device ebook, it should start playing spotify on this device.

eddieb
Posts: 12
Joined: Wednesday 04 July 2018 7:48
Target OS: NAS (Synology & others)
Domoticz version:
Location: NL
Contact:

Re: Python Plugin: Spotify

Post by eddieb » Thursday 05 July 2018 14:57

Ok, that works ..

after adding a search string in that var I can switch between iPad and MacBook running spotify.
Some more controls would be nice but this is a start ...
It always sets the volume on the iPad 100% too

Eddie

Sjaakios
Posts: 18
Joined: Saturday 04 June 2016 23:41
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin: Spotify

Post by Sjaakios » Thursday 05 July 2018 15:04

Nice that it works!

Good feature requests :-)

eddieb
Posts: 12
Joined: Wednesday 04 July 2018 7:48
Target OS: NAS (Synology & others)
Domoticz version:
Location: NL
Contact:

Re: Python Plugin: Spotify

Post by eddieb » Thursday 05 July 2018 15:15

like
volume controls
display playing track
search from control
;-)

no hurry

Sjaakios
Posts: 18
Joined: Saturday 04 June 2016 23:41
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin: Spotify

Post by Sjaakios » Thursday 05 July 2018 15:28

eddieb wrote:
Thursday 05 July 2018 15:15
like
volume controls
display playing track
search from control
;-)

no hurry
I did think about this... however i don't really see the use case for this. Real control of spotify I would always do via my spotify app. I'll will never go to my domoticz to do this.
Use case that i see, is that you enter home, wake up... you can start your favorite tune. Or in my case, i have a google home, were i will say what i would like to listen, via IFTTT it will update my user variable, en press play and it will play the tune on my receiver. (by default google home only allows Spotify playback on the google home device :? )

dlefol
Posts: 42
Joined: Monday 21 December 2015 17:35
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Python Plugin: Spotify

Post by dlefol » Wednesday 11 July 2018 9:52

Hi,

Thanks a lot for the plugin. I tested it yesterday and it works fine.
I have a similar use case as yours but a bit different:

I want to be able to launch automatically some of my playlists using scenes (for instance to have background music when I activate the scene "cooking" which triggers other things too).

I also want to use it as a simple spotify control for my kids so they can play music without giving them access to the phone/tablet. I'm planning to use the Xiaomi smart cube for that: shake would start spotify, rotate clockwise / anti clockwise would change the volume (I can control my sound system directly for that so not via spotify).

The controls I haven't figured out how to do yet are:
- skip to next / previous songs (for the kids who like to repeat the same song over and over again, a movement of the cube could allow that)
- Shuffle mode on / off for playlist

Thanks again for this plugin.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest