Google Play Desktop Music Player shuffle 'Button"

If you have a question or need help, this is the place to be.
Post Reply
User avatar
zian
Site Admin
Posts: 551
Joined: Wed Jun 24, 2009 3:54 pm

Google Play Desktop Music Player shuffle 'Button"

Post by zian » Mon Nov 13, 2017 3:22 pm

I just downloaded this desktop music player that works via my Google tunes.

I would like the application to resume/start playback on startup.
That might be easier. Maybe command line. I Googled and couldn't find any.

The attached image shows a shuffle "button" in the upper right. On startup when it is not playing I can click that button and it starts to play. How do I click that button via EG? Send message? Python? Find window didn't work for me. I know how to raise window and move curse click etc... but those are cheap tricks. Don't seem smart or consistent for me. Windows move and such.
The real coding & EG tricks are all Greek to me.

I like to have it just shuffle all. Play/shuffle on startup works for me.

keyboard shortcuts...
https://sites.google.com/a/umich.edu/go ... ws-and-mac

This program does offer an api / updated json file. Also greek to me ;)
https://github.com/MarshallOfSound/Goog ... aster/docs

Any ideas or suggestions?
Thanks Shuffle All ;)
Screenshot_20171113-100853.png
eventghost.net
Be there or be square.

jachin99
Experienced User
Posts: 529
Joined: Sat Feb 13, 2016 8:39 pm

Re: Google Play Desktop Music Player shuffle 'Button"

Post by jachin99 » Mon Nov 13, 2017 8:10 pm

If you can't get this working, there is also a desktop mini player for google play music. There probably aren't very many windows to choose from if you wanted to send that keyboard shortcuts or screen clicks http://www.makeuseof.com/tag/google-pla ... op-player/ You might even find the window with the mini player, and then implement that click or keystroke in the full blown desktop player?

eirik226
Experienced User
Posts: 142
Joined: Wed Nov 07, 2012 5:22 pm

Re: Google Play Desktop Music Player shuffle 'Button"

Post by eirik226 » Mon Nov 13, 2017 10:08 pm

As far as I can tell this is possible with the API - just don't have time to look into it right now.

cvben
Posts: 38
Joined: Wed Jun 07, 2017 8:30 pm

Re: Google Play Desktop Music Player shuffle 'Button"

Post by cvben » Thu Feb 08, 2018 6:57 pm

Zian,

First, thanks for the heads up on the program as it is pretty nice actually. I messed around a bit with the api and found it to be a headache, at least from the point of view of an extremely low skill coder.

Next, I believe those keyboard shortcuts from the now dead link are not for the desktop app you are using. From what I recall google once upon a time either had a beta desktop music app they made, which is now discontinued, or someone else designed such an app and these keys re for that program; either way unhelpful unfortunately.

Now to the meat of it:

What I learned was that you have to establish a kind of "handshake" through websocket. See HERE

Process breakdown:

1) you send a json message saying which tells the program you want to connect

Code: Select all

{
  "namespace": "connect",
  "method": "connect",
  "arguments": ["EventGhost"]
}
2) you get a response from the program, which you could use to trigger a function to extract the code or prompt a gui input to use in step 3

Code: Select all

{
  "channel": "connect",
  "payload": "CODE_REQUIRED"
}
3) the program gives you a 4 digit code in its UI which you have to send back to it in json

Code: Select all

{
  "namespace": "connect",
  "method": "connect",
  "arguments": ["Name of Device / App", "0000"] # where 0000 = the code
}
4) this then it gives you a permanent access key. This key must then be used to call the websocket to establish a connection

Code: Select all

{
  "namespace": "connect",
  "method": "connect",
  "arguments": ["EventGhost", "Your_Given_Key"]  
}
5) you are the FINALLY able to then send commands in the form of json

6) these commands might look something like:

(an example I think I understand)

Code: Select all

{
  "namespace": "playback",
  "method": "setShuffle",
  "arguments": [ALL_SHUFFLE]
}
or

(no example given, and no argument value ... so... who knows

Code: Select all

{
  "namespace": "playback",
  "method": "toggleShuffle",
}
For what its worth HERE is a working example from home-assistant.io

Caveats with above link:

1) Based around python 3

2) uses modules outside of EG core.

cvben
Posts: 38
Joined: Wed Jun 07, 2017 8:30 pm

Re: Google Play Desktop Music Player shuffle 'Button"

Post by cvben » Thu Feb 08, 2018 7:02 pm

Further considerations:

This found and brought window to front for me just fine:

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="0.5.0-rc4">
    <Macro Name="Python Script" XML_Guid="{54968E9B-05A3-4720-B9E6-62F70901B952}" Expanded="True">
        <Action XML_Guid="{551746A7-9644-4EF1-8C07-2DB8973C59CF}">
            Window.FindWindow(u'Google Play Music Desktop Player.exe', u'Google Play Music Desktop Player', u'Chrome_WidgetWin_1', u'Chrome Legacy Window', u'Chrome_RenderWidgetHostHWND', 1, False, 0.0, 0)
        </Action>
        <Action XML_Guid="{7DC7BDBB-B7CF-4F82-BE81-A51C4075BB07}">
            Window.BringToFront()
        </Action>
    </Macro>
</EventGhost>

Post Reply