Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def save(settings, path):
cst = setup_cast(settings["device"], prep="control")
if not cst.save_capability or cst.is_streaming_local_file:
raise CliError("Saving state of this kind of content is not supported")
elif cst.save_capability == "partial":
warning("Please be advised that playlist data will not be saved")
print_status(cst.media_info)
if path and path.is_file():
click.confirm("File already exists. Overwrite?", abort=True)
click.echo("Saving...")
if path:
state = CastState(path, StateMode.ARBI)
cc_name = "*"
else:
state = CastState(STATE_PATH, StateMode.CONF)
cc_name = cst.cc_name
state.set_data(cc_name, {"controller": cst.name, "data": cst.media_info})
def save(settings, path):
cst = setup_cast(settings["device"], prep="control")
if not cst.save_capability or cst.is_streaming_local_file:
raise CliError("Saving state of this kind of content is not supported")
elif cst.save_capability == "partial":
warning("Please be advised that playlist data will not be saved")
print_status(cst.media_info)
if path and path.is_file():
click.confirm("File already exists. Overwrite?", abort=True)
click.echo("Saving...")
if path:
state = CastState(path, StateMode.ARBI)
cc_name = "*"
else:
state = CastState(STATE_PATH, StateMode.CONF)
cc_name = cst.cc_name
state.set_data(cc_name, {"controller": cst.name, "data": cst.media_info})
def __init__(self, state_path: Path, mode: StateMode) -> None:
super(CastState, self).__init__(state_path)
if mode == StateMode.CONF:
self._create_store_dir()
if not self.store_path.is_file():
self._write_store({})
elif mode == StateMode.ARBI:
self._write_store({})
def __init__(self, state_path: Path, mode: StateMode) -> None:
super(CastState, self).__init__(state_path)
if mode == StateMode.CONF:
self._create_store_dir()
if not self.store_path.is_file():
self._write_store({})
elif mode == StateMode.ARBI:
self._write_store({})