Support podcast episodes as Sonos favorites (#25087)

This commit is contained in:
Anders Melchiorsen 2019-07-12 07:08:57 +02:00 committed by Pascal Vizeli
parent 53111f6426
commit afade4e997
4 changed files with 12 additions and 6 deletions

View file

@ -4,7 +4,7 @@
"config_flow": true,
"documentation": "https://www.home-assistant.io/components/sonos",
"requirements": [
"pysonos==0.0.19"
"pysonos==0.0.20"
],
"dependencies": [],
"ssdp": {

View file

@ -371,9 +371,15 @@ class SonosEntity(MediaPlayerDevice):
def _set_favorites(self):
"""Set available favorites."""
favorites = self.soco.music_library.get_sonos_favorites()
# Exclude favorites that are non-playable due to no linked resources
self._favorites = [f for f in favorites if f.reference.resources]
self._favorites = []
for fav in self.soco.music_library.get_sonos_favorites():
try:
# Exclude non-playable favorites with no linked resources
if fav.reference.resources:
self._favorites.append(fav)
except SoCoException as ex:
# Skip unknown types
_LOGGER.error("Unhandled favorite '%s': %s", fav.title, ex)
def _radio_artwork(self, url):
"""Return the private URL with artwork for a radio stream."""

View file

@ -1378,7 +1378,7 @@ pysmarty==0.8
pysnmp==4.4.9
# homeassistant.components.sonos
pysonos==0.0.19
pysonos==0.0.20
# homeassistant.components.spc
pyspcwebgw==0.4.0

View file

@ -298,7 +298,7 @@ pysmartapp==0.3.2
pysmartthings==0.6.9
# homeassistant.components.sonos
pysonos==0.0.19
pysonos==0.0.20
# homeassistant.components.spc
pyspcwebgw==0.4.0