From ba48e52fb16f9cf32141184ede2779673b3767dd Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sun, 20 Jan 2019 15:16:16 +0100 Subject: [PATCH] Update self.chromecasts on each get_chromecasts() call --- platypush/plugins/media/chromecast.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/platypush/plugins/media/chromecast.py b/platypush/plugins/media/chromecast.py index 44c527be7..62e0a8746 100644 --- a/platypush/plugins/media/chromecast.py +++ b/platypush/plugins/media/chromecast.py @@ -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):