Fix Sonos handling of unsupported favorites (#22906)

pull/22921/head
Anders Melchiorsen 2019-04-09 02:32:56 +02:00 committed by Andrew Sayre
parent 55c8417ec0
commit d577955d1e
5 changed files with 5 additions and 16 deletions

View File

@ -4,7 +4,7 @@ from homeassistant.helpers import config_entry_flow
DOMAIN = 'sonos'
REQUIREMENTS = ['pysonos==0.0.8']
REQUIREMENTS = ['pysonos==0.0.9']
async def async_setup(hass, config):

View File

@ -3,7 +3,7 @@
"name": "Sonos",
"documentation": "https://www.home-assistant.io/components/sonos",
"requirements": [
"pysonos==0.0.8"
"pysonos==0.0.9"
],
"dependencies": [],
"codeowners": [

View File

@ -454,18 +454,7 @@ class SonosEntity(MediaPlayerDevice):
def _set_favorites(self):
"""Set available favorites."""
# SoCo 0.16 raises a generic Exception on invalid xml in favorites.
# Filter those out now so our list is safe to use.
try:
self._favorites = []
for fav in self.soco.music_library.get_sonos_favorites():
try:
if fav.reference.get_uri():
self._favorites.append(fav)
except Exception: # pylint: disable=broad-except
_LOGGER.debug("Ignoring invalid favorite '%s'", fav.title)
except Exception: # pylint: disable=broad-except
_LOGGER.debug("Ignoring invalid favorite list")
self._favorites = self.soco.music_library.get_sonos_favorites()
def _radio_artwork(self, url):
"""Return the private URL with artwork for a radio stream."""

View File

@ -1270,7 +1270,7 @@ pysmartthings==0.6.7
pysnmp==4.4.8
# homeassistant.components.sonos
pysonos==0.0.8
pysonos==0.0.9
# homeassistant.components.spc
pyspcwebgw==0.4.0

View File

@ -239,7 +239,7 @@ pysmartapp==0.3.2
pysmartthings==0.6.7
# homeassistant.components.sonos
pysonos==0.0.8
pysonos==0.0.9
# homeassistant.components.spc
pyspcwebgw==0.4.0