controlling spotify

Here you are welcome to discuss items of general interest related to Push2Run
Twattycakes
Posts: 1
Joined: Sun Feb 25, 2018 6:48 pm

controlling spotify

Post by Twattycakes »

i'm just wondering if anyone has come up with a way to control Spotify using P2R? i can (obviously) use google assistant to open/play/search etc. spotify on my phone, and if i change the device to my pc, i can do all these things, but what i want is to just say "tell my pc to play <song> and my pc plays it without touching my phone
RobLatour
Site Admin
Posts: 1017
Joined: Mon Feb 19, 2018 11:43 am

Re: controlling spotify

Post by RobLatour »

It took some fiddling to work this out because unfortunately, Spotify doesn't automatically start playing the song you search for in the same way you can have, for example, a youtube video automatically start playing after you've searched for it. Also, Spotify makes it even harder because depending on your search results the link to start the playing the song moves around, and you can't just tab to the play symbol and press enter.

In any case, I did the best I could and got this working using the attached Push2Run card and script. Basically, between the two of them, the Spotify search gets opened up with the song you searched for and the script file sends the keystrokes needed to start playing the song.

In the Push2Run card the script is stored in a folder I created on my c: drive call "my scripts", but you can put it anywhere as long as you update the Push2Run card accordingly.

Alos, I've got it set up to use my default browser which is Google chrome.

With this done, I can now say:
Ok Google tell my computer to play Martha and the Muffins
and then listen to one of my favorite songs after a few seconds - just like I am doing as I type this in :-)

Also, of note, you don't have to wait for the song to complete before asking for another one.

Please let me know how it works for you, and if good enough I'll post in the Push2Run Cards category in this forum too.
Attachments
Play a song from Spotify.P2R
(476 Bytes) Downloaded 1487 times
spotify.vbs
(2.45 KiB) Downloaded 1567 times
sam-warren
Posts: 1
Joined: Thu Jul 05, 2018 6:33 pm

Re: controlling spotify

Post by sam-warren »

Here's my solution to this problem...

On Windows, in the Spotify desktop app, you can right click a song/album/playlist and select "Share -> Copy Spotify URI". Pasting this into the directory to launch an application in Push2Run (see attachment) will open Spotify if it is closed and go straight to the song/album/playlist. From there, you can use either a Push2Run command or NirCmd to hit space to play the song or whatever you copied.

Hope this helps!
Attachments
SpotifySnip.PNG
SpotifySnip.PNG (12.07 KiB) Viewed 19111 times
himaletu
Posts: 1
Joined: Sun Aug 26, 2018 7:04 am

Re: controlling spotify

Post by himaletu »

Twattycakes wrote: Sun Feb 25, 2018 6:59 pm i'm just wondering if anyone has come up with a way to control Spotify using P2R? i can (obviously) use google assistant to open/play/search etc. spotify on my phone, and if i change the device to my pc, i can do all these things, but what i want is to just say "tell my pc to play <song> and my pc plays it without touching my phone
I can not do this but im going to investigate over the internet!
MathewCox
Posts: 1
Joined: Sat Oct 13, 2018 4:38 pm

Re: controlling spotify

Post by MathewCox »

I tried the solution of sam-warren and it worked well for me
zoolake
Posts: 3
Joined: Wed Jan 02, 2019 2:36 am

Re: controlling spotify

Post by zoolake »

Rob could you reupload your card and vbs file. I'm very interested in giving this a try but the links to your files dont seem to be working. Thanks!
RobLatour
Site Admin
Posts: 1017
Joined: Mon Feb 19, 2018 11:43 am

Re: controlling spotify

Post by RobLatour »

ok - I will need to look at this tonight but either get this fixed or the files re-uploaded as soon as I can.

*** edited - I was able to correct this around noon today ***
zoolake
Posts: 3
Joined: Wed Jan 02, 2019 2:36 am

Re: controlling spotify

Post by zoolake »

I was able to download the files today but unfortunately the card doesnt seem to work. It opens the spotify website but the song doesnt start playing.
RobLatour
Site Admin
Posts: 1017
Joined: Mon Feb 19, 2018 11:43 am

Re: controlling spotify

Post by RobLatour »

Did you also you a script to send command to the window to start it playing?

The one I provided above works, but is a little flakey.

I like sam-warrant's solution of sending a space to the open window (which I didn't know you could do) to start the playing.

It would be much better if Spotify just came out with an autoplay feature.
zoolake
Posts: 3
Joined: Wed Jan 02, 2019 2:36 am

Re: controlling spotify

Post by zoolake »

So I've found a better way to do this that uses Spotify on your desktop instead of the Spotify webpage. The trick is to trigger Cortana (Windows Key + S) and use the vb script to paste "play $ on spotify" in. I've got it up and running and it works like a charm. If anyone's interested I can share my script although I'll warn you that its ugly as I'm not much of a coder.
Post Reply