Skip to content

Commit

Permalink
Ensure DIAL info in get_chromecasts (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
theychx committed Aug 23, 2017
1 parent 7ea9a5f commit 28c5075
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions catt/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 28c5075

Please sign in to comment.