How to Play an MP3 file or URL on Sonos

Programming, Tools

It’s quite painful to play podcasts or some arbitrary mp3 files on Sonos, especially when you are on Linux. I decided to write sonosplay – a simple command line utility based on SoCo libary to make life easier for me and probably other people. So now I just do


and the media starts playing on Sonos right away.

In order to play local files it starts an embedded HTTP server, creates an URL and sends it to Sonos. Works good, but there are some limitations:

– I can’t detect now, when the file is finished playing, so it’s necessary to stop the service manually by Ctrl+C.

– In the Sonos app it’s shown as stream.mp3 for the moment without any description or image, even if the file itself contains that meta information:

But anyway I’m happy that I don’t need anymore all those whistles and bells in order to launch a recent podcast or a mix session on Sonos.