From 28c5075882ea03ae66d462e9025cbceec0a48101 Mon Sep 17 00:00:00 2001 From: theychx Date: Wed, 23 Aug 2017 16:52:27 +0200 Subject: [PATCH] Ensure DIAL info in get_chromecasts (#47) --- catt/controllers.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/catt/controllers.py b/catt/controllers.py index 8b9c987..f050867 100644 --- a/catt/controllers.py +++ b/catt/controllers.py @@ -19,7 +19,8 @@ def get_chromecasts(): raise CattCastError("No devices found.") devices.sort(key=lambda cc: cc.name) - return devices + # We need to ensure that all Chromecast objects contain DIAL info. + return [pychromecast.Chromecast(cc.host) for cc in devices] def get_chromecast(device_name): @@ -146,8 +147,7 @@ def __init__(self, device_name, state_check=True): raise ValueError self.cast = pychromecast.Chromecast(cached_ip) except (pychromecast.error.ChromecastConnectionError, ValueError): - cast = get_chromecast(device_name) - self.cast = pychromecast.Chromecast(cast.host) + self.cast = get_chromecast(device_name) cache.set(self.cast.name, self.cast.host) self.cast.wait()