Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import pychromecast
import pychromecast.controllers.dashcast as dashcast
debug = '--show-debug' in sys.argv
if debug:
logging.basicConfig(level=logging.DEBUG)
casts = pychromecast.get_chromecasts()
if len(casts) == 0:
print("No Devices Found")
exit()
cast = casts[0]
cast.start()
d = dashcast.DashCastController()
cast.register_handler(d)
print()
print(cast.device)
time.sleep(1)
print()
print(cast.status)
print()
print(cast.media_controller.status)
print()
if not cast.is_idle:
print("Killing current running app")
cast.quit_app()
time.sleep(5)
import pychromecast
import pychromecast.controllers.dashcast as dashcast
debug = '--show-debug' in sys.argv
if debug:
logging.basicConfig(level=logging.DEBUG)
casts = pychromecast.get_chromecasts()
if len(casts) == 0:
print("No Devices Found")
exit()
cast = casts[0]
cast.start()
d = dashcast.DashCastController()
cast.register_handler(d)
print()
print(cast.device)
time.sleep(1)
print()
print(cast.status)
print()
print(cast.media_controller.status)
print()
if not cast.is_idle:
print("Killing current running app")
cast.quit_app()
time.sleep(5)
def __init__(self, appNamespace=APP_NAMESPACE, appId=APP_DASHCAST):
super(DashCastController, self).__init__(appNamespace, appId)
def __init__(self, device, dashboard_url='https://home-assistant.io', dashboard_app_name='DashCast'):
self.device = device
print('DashboardLauncher', self.device.name)
self.controller = dashcast.DashCastController()
self.device.register_handler(self.controller)
receiver_controller = device.socket_client.receiver_controller
receiver_controller.register_status_listener(self)
self.dashboard_url = dashboard_url
self.dashboard_app_name = dashboard_app_name
# Check status on init.
self.new_cast_status(self.device.status)
# Launch dashboard on init.
while True:
self.launch_dashboard()
time.sleep(60)
def __init__(self, cast, app, prep=None):
self._controller = PyChromecastDashCastController()
super(DashCastController, self).__init__(cast, app, prep=prep)