Created
July 30, 2023 21:50
-
-
Save ethanpil/c92990b55e67e0072f72c73f7c25d19a to your computer and use it in GitHub Desktop.
Mopidy Play Web Stream from Shell CLI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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