Skip to content

Instantly share code, notes, and snippets.

@ethanpil
Created July 30, 2023 21:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ethanpil/c92990b55e67e0072f72c73f7c25d19a to your computer and use it in GitHub Desktop.
Save ethanpil/c92990b55e67e0072f72c73f7c25d19a to your computer and use it in GitHub Desktop.
Mopidy Play Web Stream from Shell CLI
#!/bin/sh
#How to play a web stream on mopidy from command line (Linux) using CURL.
#Can also adjust moplidy playback volume if needed
#Clear current tracklist. Will also stop playback
curl -X POST -H Content-Type:application/json -d '{
"method": "core.tracklist.clear",
"jsonrpc": "2.0",
"id": 1
}' http://localhost:6680/mopidy/rpc
#Add URL of stream to tracklist
curl -X POST -H Content-Type:application/json -d '{
"method": "core.tracklist.add",
"jsonrpc": "2.0",
"params": {
"uris": ["https://broadcast.myurl.com/radio.mp3"]
},
"id": 1
}' http://localhost:6680/mopidy/rpc
#Adjust volume if necessary
curl -X POST -H Content-Type:application/json -d '{
"method": "core.mixer.set_volume",
"jsonrpc": "2.0",
"params": {
"volume": 25
},
"id": 1
}' http://localhost:6680/mopidy/rpc
#Play the new tracklist
curl -X POST -H Content-Type:application/json -d '{
"method": "core.playback.play",
"jsonrpc": "2.0",
"id": 1
}' http://localhost:6680/mopidy/rpc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment