How Could Play A Song In My Computer Soco Python (sonos Controller Python)
I'm using soco (link github), I'm try to playing a song on my computer by using these command : sonos = SoCo('192.168.1.102') sonos.play_uri('C:\\mysong.mp3') but it got error :
Solution 1:
The uri you provide has to be in the Sonos upnp format. The play_uri() action is run on your Sonos device, not on your PC, so it has no access to your local C: drive.
Play something using the Sonos app, and then use Python soco to look at the running device to get its uri as seen from the Sonos device.
sonos = SoCo('192.168.1.102')
sonos.get_current_track_info()
This will return a dict that includes the uri. Plug that uri in to your play_uri call.
Here are some uri's that work for me. The first is the Radio Paradise station, which should work for you. The second is an album I have on my NAS, which gives you an idea of how to play a specific cut remotely. The cut must be indexed in your Sonos music library.
sonos.play_uri('aac://http://stream-uk1.radioparadise.com/aac-320')
sonos.play_uri('x-file-cifs://192.168.1.222/SDCard_Volume1/Brian%20Eno/Thursday%20Afternoon/01.%20Thursday%20Afternoon%20(61-minute%20version).mp3')
Post a Comment for "How Could Play A Song In My Computer Soco Python (sonos Controller Python)"