mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-25 10:25:09 +00:00
feat(dl): add --cdm to pin one CDM device for a run
Overrides the cdm config mapping (and its quality/DRM sub-entries) for the whole run; the REST API cdm field now flows through the same param.
This commit is contained in:
@@ -833,6 +833,13 @@ class dl:
|
||||
default=None,
|
||||
help="Only use CDM, or only use Key Vaults for retrieval of Decryption Keys.",
|
||||
)
|
||||
@click.option(
|
||||
"--cdm",
|
||||
"cdm_name",
|
||||
type=str,
|
||||
default=None,
|
||||
help="Use this CDM device for the run, overriding the cdm config mapping.",
|
||||
)
|
||||
@click.option("--no-proxy", is_flag=True, default=False, help="Force disable all proxy use.")
|
||||
@click.option(
|
||||
"--no-proxy-download",
|
||||
@@ -1201,6 +1208,7 @@ class dl:
|
||||
f"Applied service-specific '{config_key}' overrides for {self.service}: {override_value}"
|
||||
)
|
||||
|
||||
self.cdm_override = ctx.params.get("cdm_name")
|
||||
cdm_only = ctx.params.get("cdm_only")
|
||||
|
||||
if cdm_only:
|
||||
@@ -1504,6 +1512,8 @@ class dl:
|
||||
self.service_anime = bool(getattr(service, "ANIME", False))
|
||||
self.service_daily = bool(getattr(service, "DAILY", False))
|
||||
self.server_cdm = getattr(service, "_server_cdm", False)
|
||||
if self.server_cdm and self.cdm_override:
|
||||
self.log.warning("--cdm is ignored: this remote service licenses with the server CDM")
|
||||
self._remote_service = service if hasattr(service, "_server_cdm") else None
|
||||
start_time = time.time()
|
||||
|
||||
|
||||
@@ -440,6 +440,7 @@ def perform_download(
|
||||
"no_proxy": params.get("no_proxy", False),
|
||||
"no_proxy_download": params.get("no_proxy_download", False),
|
||||
"profile": params.get("profile"),
|
||||
"cdm_name": params.get("cdm"),
|
||||
"repack": params.get("repack", False),
|
||||
"tag": params.get("tag"),
|
||||
"tmdb_id": params.get("tmdb_id"),
|
||||
@@ -484,10 +485,6 @@ def perform_download(
|
||||
daily=params.get("daily", False),
|
||||
output_dir=Path(params["output_dir"]) if params.get("output_dir") else None,
|
||||
)
|
||||
# Per-request CDM override (a device name in the WVDs dir); get_cdm() takes it first.
|
||||
if params.get("cdm"):
|
||||
dl_instance.cdm_override = params["cdm"]
|
||||
|
||||
# Per-request credential ("user:pass"); feed it into the map get_credentials() reads so a
|
||||
# client can authenticate without anything being persisted to disk. Without a profile,
|
||||
# get_credentials() falls back to "default", so store it there too rather than dropping it
|
||||
|
||||
@@ -757,6 +757,9 @@ async def download(request: web.Request) -> web.Response:
|
||||
cdm_only:
|
||||
type: boolean
|
||||
description: Only use CDM for content key retrieval (true) or only vaults (false) (default - None)
|
||||
cdm:
|
||||
type: string
|
||||
description: CDM device name on the server to license with, overriding the cdm config mapping. Requires serve.cdm_overrides to allow it (default - None)
|
||||
proxy:
|
||||
type: string
|
||||
description: Proxy URI or country code (default - None)
|
||||
|
||||
Reference in New Issue
Block a user