Fix Sonos handling of unsupported favorites (#22906)

This commit is contained in:
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' DOMAIN = 'sonos'
REQUIREMENTS = ['pysonos==0.0.8'] REQUIREMENTS = ['pysonos==0.0.9']
async def async_setup(hass, config): async def async_setup(hass, config):

View File

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

View File

@ -454,18 +454,7 @@ class SonosEntity(MediaPlayerDevice):
def _set_favorites(self): def _set_favorites(self):
"""Set available favorites.""" """Set available favorites."""
# SoCo 0.16 raises a generic Exception on invalid xml in favorites. self._favorites = self.soco.music_library.get_sonos_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")
def _radio_artwork(self, url): def _radio_artwork(self, url):
"""Return the private URL with artwork for a radio stream.""" """Return the private URL with artwork for a radio stream."""

View File

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

View File

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