SoCo是一个用于控制 Sonos 扬声器的 Python 库。我正在尝试播放本地存储的歌曲:
device = SoCo("192.168.209.7")
device.play_uri("/home/myuser/mysong.ogg")
如果我正确阅读了文档,mysong.ogg
应该开始在 Sonos 上玩。但是,此代码会立即导致以下异常:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.4/site-packages/soco/core.py", line 95, in inner_function
return function(self, *args, **kwargs)
File "/usr/lib/python3.4/site-packages/soco/core.py", line 470, in play_uri
('CurrentURIMetaData', meta)
File "/usr/lib/python3.4/site-packages/soco/services.py", line 156, in _dispatcher
return self.send_command(action, *args, **kwargs)
File "/usr/lib/python3.4/site-packages/soco/services.py", line 357, in send_command
self.handle_upnp_error(response.text)
File "/usr/lib/python3.4/site-packages/soco/services.py", line 417, in handle_upnp_error
error_xml=xml_error
soco.exceptions.SoCoUPnPException: UPnP Error 714 received: Illegal MIME-Type from 192.168.209.7