Update self.chromecasts on each get_chromecasts() call

This commit is contained in:
Fabio Manganiello 2019-01-20 15:16:16 +01:00
parent 3c0ed443a2
commit ba48e52fb1
1 changed files with 6 additions and 1 deletions

View File

@ -47,6 +47,11 @@ class MediaChromecastPlugin(MediaPlugin):
Get the list of Chromecast devices
"""
self.chromecasts.update({
cast.device.friendly_name: cast
for cast in pychromecast.get_chromecasts()
})
return [ {
'type': cc.cast_type,
'name': cc.name,
@ -69,7 +74,7 @@ class MediaChromecastPlugin(MediaPlugin):
'volume': round(100*cc.status.volume_level, 2),
'muted': cc.status.volume_muted,
} if cc.status else {}),
} for cc in pychromecast.get_chromecasts() ]
} for cc in self.chromecasts.values() ]
def get_chromecast(self, chromecast=None, n_tries=3):