diff --git a/catt/cli.py b/catt/cli.py index 6457949..e0dffd5 100755 --- a/catt/cli.py +++ b/catt/cli.py @@ -315,16 +315,22 @@ def cast( @cli.command("cast_site", short_help="Cast any website to a Chromecast.") @click.argument("url", callback=process_url) +@click.option( + "-i", + "--iframe", + is_flag=True, + help="Load website into an iframe to avoid timeout (requires HTTPS).", +) @click.pass_obj -def cast_site(settings, url): +def cast_site(settings, url, iframe): cst = setup_cast( settings["selected_device"], controller="dashcast", action="load_url", prep="app", ) - click.echo('Casting {} on "{}"...'.format(url, cst.cc_name)) - cst.load_url(url) + click.echo('Casting {} on "{}" (iframe={})...'.format(url, cst.cc_name, iframe)) + cst.load_url(url, force=not iframe) @cli.command(short_help="Add a video to the queue (YouTube only).") diff --git a/catt/controllers.py b/catt/controllers.py index 13950bc..c05779e 100644 --- a/catt/controllers.py +++ b/catt/controllers.py @@ -7,7 +7,6 @@ import pychromecast from pychromecast.config import APP_BACKDROP as BACKDROP_APP_ID -from pychromecast.config import APP_DASHCAST as DASHCAST_APP_ID from pychromecast.config import APP_MEDIA_RECEIVER as MEDIA_RECEIVER_APP_ID from pychromecast.config import APP_YOUTUBE as YOUTUBE_APP_ID from pychromecast.controllers.dashcast import DashCastController as PyChromecastDashCastController @@ -26,6 +25,9 @@ VALID_STATE_EVENTS = ["UNKNOWN", "IDLE", "BUFFERING", "PLAYING", "PAUSED"] CLOUD_APP_ID = "38579375" +DASHCAST_NAMESPACE = "urn:x-cast:es.offd.dashcast" +DASHCAST_APP_ID = "5C517DAC" + class App: def __init__(self, app_name, app_id, supported_device_types): @@ -496,11 +498,11 @@ def restore(self, data): class DashCastController(CastController): def __init__(self, cast, app, prep=None): - self._controller = PyChromecastDashCastController() + self._controller = PyChromecastDashCastController(appNamespace=DASHCAST_NAMESPACE, appId=DASHCAST_APP_ID) super(DashCastController, self).__init__(cast, app, prep=prep) - def load_url(self, url, **kwargs): - self._controller.load_url(url, force=True) + def load_url(self, url, force=True, **kwargs): + self._controller.load_url(url, force=force) def prep_app(self): """Make sure desired chromecast app is running."""