Skip to content

HTTP server + RESTful endpoints to remotely control native Apple Music playback on a Mac

License

Notifications You must be signed in to change notification settings

ofdryads/shuffle-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

macOS Playback Control HTTP Server

An HTTP server written in Go which runs on a Mac and listens for requests from clients to control Apple Music playback

Controls

  • Get current song (GET /nowplaying)
  • Play/pause song (POST /playpause)
  • Next song (POST /next)
  • Start Apple Music app (POST /start)
  • Get playlists (GET /playlists)

Start the playback control server

go run main.go

Make requests to control playback

curl -X {REST verb} 'http://{ip:8888/route}'

Start a ffmpeg audio stream server, given BlackHole installed and set as output (audio device number, format, & sample rate may vary)

ffmpeg -f avfoundation -i ":3" -c:a libmp3lame -b:a 128k -ar 44100 -f mp3 -listen 1 http://0.0.0.0:8000

On client machine: ffplay 'http://{ip:8000}'

Acknowledgements

I used this helpful guide to get started: "Building a Custom HTTP Server in Go" by @stev3npy on Medium

I also took inspiration for the concept from talz-a's Apple Music CLI tool and applied the idea of programmatic Apple Music control to network-wide control

About

HTTP server + RESTful endpoints to remotely control native Apple Music playback on a Mac

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages