MarshallOfSound / Google-Play-Music-Desktop-Player-UNOFFICIAL-

A beautiful cross platform Desktop Player for Google Play Music
https://www.googleplaymusicdesktopplayer.com
MIT License
8.27k stars 766 forks source link

AppleScript support #3341

Closed kazak1377 closed 6 years ago

kazak1377 commented 6 years ago

Hello!

I am using better touch tool for scripting the touchbar on new MacBooks. And wanted to add support for controlling the GPMDP from Touch Bar buttons with changing buttons status (play/pause) and showing the current playing song.

For iTunes I can use apple script like this:

if application "iTunes" is running then
    tell application "iTunes"
        if player state is playing then return "pause"
    end tell
end if

return "play"
if application "iTunes" is running then
    tell application "iTunes" to playpause
else
    tell application "iTunes" to activate
end if

And it would be great to be able to do something similar to GPMDP

I know about playback API, but can't use ws to control GPMDP from AppleScript

OS: macOS 10.13.6

GPMDP Version: 4.6.1

welcome[bot] commented 6 years ago

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of duplicate issues on this repo, so please double check now that your issue has not already been solved or doesn't have an open issue already. To help make it easier for us to investigate your issue, please follow the contributing guidelines and ensure the issue template was filled out.

MarshallOfSound commented 6 years ago

We have our playback API which spits out JSON metadata files and uses a websocket to do two way player control.

You just need to figure out how to do that wiring. Also we do integrate with macOS's media service so the OS should know our app is playing music.

andrewshipe commented 4 years ago

Stumbled on this and I found a way to hook in through the app UI via AppleScript. This is working for me in a Keyboard Maestro macro:

tell application "System Events"
tell process "Google Play Music Desktop Player" to click menu item "Play / Pause" of menu
"Playback" of menu bar 1
end tell