Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions homeassistant/components/media_player/sonos.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,15 +427,18 @@ def _set_basic_information(self):
self.update_volume()

self._favorites = []
for fav in self.soco.music_library.get_sonos_favorites():
# SoCo 0.14 raises a generic Exception on invalid xml in favorites.
# Filter those out now so our list is safe to use.
try:
if fav.reference.get_uri():
self._favorites.append(fav)
# pylint: disable=broad-except
except Exception:
_LOGGER.debug("Ignoring invalid favorite '%s'", fav.title)
# SoCo 0.14 raises a generic Exception on invalid xml in favorites.
# Filter those out now so our list is safe to use.
# pylint: disable=broad-except
try:
for fav in self.soco.music_library.get_sonos_favorites():
try:
if fav.reference.get_uri():
self._favorites.append(fav)
except Exception:
_LOGGER.debug("Ignoring invalid favorite '%s'", fav.title)
except Exception:
_LOGGER.debug("Ignoring invalid favorite list")

def _radio_artwork(self, url):
"""Return the private URL with artwork for a radio stream."""
Expand Down