docs: sweep docs to zero ste_lint findings and one remote session name

This commit is contained in:
imSp4rky
2026-12-04 18:50:27 -07:00
parent 34c8fabe6f
commit 87b58190ea
34 changed files with 134 additions and 214 deletions
+21 -16
View File
@@ -61,7 +61,7 @@ unshackle dl EX 20914 # via an ALIAS
!!! warning "`config.yaml` is shared: keep secrets out of it"
Treat `config.yaml` as a checked-in file of **defaults**: it belongs in the
service repo, and everyone who runs the service shares it. Per-user secrets
(API keys, device IDs, account tokens) must **not** live here. Those go in the
(API keys, device identifiers, account tokens) must **not** live here. Those go in the
user's own `unshackle.yaml` under `services.<TAG>`, which is **merged into
`self.config` at runtime**. That checked-in-defaults / per-user-overrides
split is exactly why every URL lives in `config.yaml` with `{}`/`{name}`
@@ -144,6 +144,11 @@ You can read it *and rewrite* it before you fetch tracks. A service that fetches
specific SSL *cipher* behaviour, mount
`unshackle.core.utils.sslciphers.SSLCiphers` onto a plain `requests.Session`.
!!! note "Keep requests on the proxy"
unshackle warns about a request from service code that does not use the proxy of the run.
Send requests through `self.session`. An HTTP session that goes direct on purpose sets
`session.proxy_exempt = True`.
---
## The methods you write
@@ -226,7 +231,7 @@ Cookies come from files under `directories.cookies`. Credentials come from the
use `self.request_input(prompt)`, never a bare `input()`. Under `serve` mode
there is no local terminal, so a bare `input()` would hang the server waiting on
stdin that never arrives. `request_input` instead relays the prompt to the
client: a remote-dl session gets it through the attached `InputBridge`, and a
client: a remote session gets it through the attached `InputBridge`, and a
REST download job shows it as `input_prompt`. Locally it routes through the
shared Rich console (`prompt_user`) so the prompt renders correctly alongside
progress and log output.
@@ -348,7 +353,7 @@ A service may set `title.data["availability"]` to a dict with two optional field
Only these allowlisted fields reach the REST API as `availability`, including
through remote title reconstruction. The CLI's `--list-titles` does not display
them, and nothing in core reads them to select or authorize downloads.
them, and nothing in core reads them to select or authorise downloads.
Common constructor fields:
@@ -436,7 +441,7 @@ Episode(..., season=1, number=1, part=2, name="The Reckoning")
Once `part` is set, the filename gains a part token (`S01E01.Part.2`, see
[Output & naming](../guide/output-and-naming.md#split-episodes)), `-w S01E01.2` selects a
single part while a bare `-w S01E01` selects them all, and the `--list-titles` tree labels
the episode `01.2`. The REST API reports it as an extra `part` field on the serialized
the episode `01.2`. The REST API reports it as an extra `part` field on the serialised
title, described in [Endpoints](rest-api/endpoints.md#post-apilist-titles).
!!! note "Opt-in and additive"
@@ -526,7 +531,7 @@ def get_tracks(self, title: Title_T) -> Tracks:
per title that the next fetch overwrites.
After parsing, you may **correct** track metadata the manifest gets wrong:
stamp the real `video.range`, fix odd audio channel counts, mark descriptive
stamp the real `video.range`, fix odd audio channel layouts, mark descriptive
audio, add hand-built subtitles or an `Attachment` (e.g. cover art). Do *not*
filter for resolution/bitrate. See `fetch_dash_manifest` in the EXAMPLE service
for a thorough demonstration.
@@ -543,11 +548,11 @@ for a thorough demonstration.
and let the probe relabel the tracks.
!!! warning "`get_tracks` is your only chance to capture license inputs"
The license callbacks (`get_widevine_license` and the others) fire **much later**, in
The licence callbacks (`get_widevine_license` and the others) fire **much later**, in
the download/decrypt step, long after `get_tracks` has returned, and they
receive **only** `challenge`, `title`, and `track`. Nothing else from the
manifest response reaches them. So you must stash anything a license call needs
(the license URL, `dt-custom-data`, a session token) **now**, during
manifest response reaches them. So you must stash anything a licence call needs
(the licence URL, `dt-custom-data`, a session token) **now**, during
`get_tracks`, onto `self.license_data` or `title.data`. This is a
lifecycle-timing consequence you cannot infer from the callback signatures.
@@ -591,10 +596,10 @@ def get_chapters(self, title: Title_T) -> Chapters:
## Handling DRM
The core drives licensing. Your job is to answer the license challenges the CDM
The core drives licensing. Your job is to answer the licence challenges the CDM
produces. Mark encrypted tracks with the right DRM in `get_tracks` (the manifest
parsers do this automatically for PSSH/`EXT-X-KEY` found in the manifest), then
write the license callbacks you need. Each receives the challenge plus the
write the licence callbacks you need. Each receives the challenge plus the
current `title` and `track`. [The service-side hooks](service-architecture.md#the-service-side-hooks)
names each callback, the optional arguments that it can declare, and what it returns:
@@ -612,9 +617,9 @@ def get_widevine_license(self, *, challenge: bytes, title, track):
return response.content # others return raw bytes
```
!!! warning "Return the license untouched"
!!! warning "Return the licence untouched"
Do **not** base64-encode or decode the challenge or response. Pass them
through verbatim. A malformed license request can get your CDM/device
through verbatim. A malformed challenge can get your CDM/device
flagged, banned, or downgraded.
!!! tip "`ClearKeyCENC` (`org.w3.clearkey`) has three escalating integration levels"
@@ -628,15 +633,15 @@ def get_widevine_license(self, *, challenge: bytes, title, track):
the content key in `get_tracks` and pre-populate
`drm.signatures[kid] = key_hex` on the track's `ClearKeyCENC`. The
non-obvious payoff: when every KID is already keyed, the framework skips
the license round-trip entirely.
the licence round-trip entirely.
Things the service does not do:
- **HLS AES-128 (`ClearKey`)** tracks and **DRM-free** tracks have no license
- **HLS AES-128 (`ClearKey`)** tracks and **DRM-free** tracks have no licence
callback. The content key comes from the manifest, and unshackle applies it
directly.
- **Key vaults** cache `KID:KEY` pairs across runs, so repeat downloads skip the
license round-trip entirely.
licence round-trip entirely.
- **Decryption tooling** (shaka-packager or mp4decrypt) and the choice of local
vs remote CDM are user configuration, not service concerns.
@@ -774,7 +779,7 @@ unshackle dl MYSVC https://myservice.com/watch/abc123
- [ ] `cli` is a `@staticmethod` that returns an instance. `__init__` calls `super().__init__(ctx)`.
- [ ] `get_titles`, `get_tracks` and `get_chapters` written. Titles carry the original `language`.
- [ ] Tracks come from a manifest parser with `to_tracks(language=title.language)`. No filtering by quality or language.
- [ ] Encrypted tracks carry their DRM. The license callbacks you need return responses **unmodified**.
- [ ] Encrypted tracks carry their DRM. The licence callbacks you need return responses **unmodified**.
- [ ] URLs, user agents, and certificates live in `config.yaml`, read through `self.config[...]`.
- [ ] Multi-file services import their own modules relatively (`from .helpers import x`), so they work when loaded from a repo.
+6 -6
View File
@@ -82,10 +82,10 @@ Under the integrated server, an API key can do DRM licensing only through a CDM
| `playready_devices` | PlayReady `.prd` devices, by name |
!!! warning "PlayReady access is opt-in per user"
If a user entry omits `playready_devices`, the server gives that API key **no** PlayReady access, and logs a warning at startup. You must name the PlayReady devices explicitly for any API key that needs them. Widevine and PlayReady device files themselves are auto-loaded from your WVDs and PRDs directories.
If a user entry omits `playready_devices`, the server gives that API key **no** PlayReady access, and logs a warning at startup. You must name the PlayReady devices explicitly for any API key that needs them. unshackle loads the WVD and PRD files themselves from your WVDs and PRDs directories.
!!! note "Grants decide whether the server returns content keys"
The devices on an API key decide which CDM the server can use. Two grants in the same user entry decide whether the server returns content keys (`KID:KEY`) for a remote session. `server_cdm` lets the server license with those devices. `server_vault` lets a remote session that the client's own device licenses read the server vault, and the server then makes no live licence. Without either grant, the server can only proxy CDM challenges, so the client must operate its own CDM. See [`serve`](../../reference/configuration/services.md) for both grants.
!!! note "The licensing mode decides whether the server returns content keys"
The devices on an API key decide which CDM the server can use. Two config keys in the same user entry decide the [licensing modes](remote-sessions.md#licensing-modes) of its remote sessions. `server_cdm` lets the server license with those devices. `server_vault` lets a remote session that the client's own device licenses read the server vault, and the server then makes no live licence. Without either one, the server can only proxy CDM challenges, so the client must operate its own CDM. See [`serve`](../../reference/configuration/services.md) for both config keys.
### Disabling authentication
@@ -150,7 +150,7 @@ The value must match one of the configured API keys exactly (`api_secret`, or on
```
!!! tip "The reference client sets it for you"
unshackle's own [remote download](../../guide/downloading.md) client (`RemoteService`) sends `X-Secret-Key` automatically, reading the API key from your `remote_services` config. It also sends a `User-Agent` of `unshackle/<version>`. You only deal with the header directly when writing your own client.
unshackle's own [remote session](../../guide/remote-sessions.md) client (`RemoteService`) sends `X-Secret-Key` automatically, reading the API key from your `remote_services` config. It also sends a `User-Agent` of `unshackle/<version>`. You only deal with the header directly when writing your own client.
### The health check needs an API key too
@@ -303,7 +303,7 @@ See [Downloads](endpoints.md) for how the download endpoint uses these fields.
### Session IP binding (remote sessions)
The remote-download session endpoints (`/api/session/*`) add an extra check on top of the API key. When the server creates a remote session, it records the client's IP address. Any later request for that remote session must come from the **same** IP, or the server rejects it with `403 Forbidden`. Thus the server binds a remote session both to the API key that created it and to the address it came from.
The remote session endpoints (`/api/session/*`) add an extra check on top of the API key. When the server creates a remote session, it records the client's IP address. Any later request for that remote session must come from the **same** IP, or the server rejects it with `403 Forbidden`. Thus the server binds a remote session both to the API key that created it and to the address it came from.
## Transport security (HTTPS)
@@ -322,7 +322,7 @@ With `--caddy`, unshackle also starts `caddy run` using the `Caddyfile` located
| Auth header | `X-Secret-Key` |
| Query-parameter alternative | `?secret_key=` on `GET /api/download/jobs/{job_id}/events` only |
| Default bind address | `127.0.0.1:8786` |
| Failure status | `401 Unauthorized`, or `429 Too Many Requests` for a key over its rate limit |
| Failure status | `401 Unauthorized`, or `429 Too Many Requests` for an API key over its rate limit |
| Missing-header body | `{"status": 401, "message": "Secret Key is Empty."}` |
| Invalid-key body | `{"status": 401, "message": "Secret Key is Invalid."}` |
| Over-limit body | `{"status": 429, "message": "Rate limit exceeded."}`, plus a `Retry-After` header |
+1 -1
View File
@@ -1,4 +1,4 @@
# Developer Dashboard
# Server Dashboard
The dashboard endpoints show the operator of a `serve` instance what the server is doing:
version and uptime, request counts, live remote sessions, download jobs, and the recent
+5 -7
View File
@@ -129,7 +129,7 @@ Field notes:
| `needs_auth` | Whether the service overrides `authenticate()`. |
| `has_search` | Whether the service supports `POST /api/search`. |
| `anonymous_search` | Whether `POST /api/search` operates with no login for this service. The server then ignores `credentials` and `cookies` on a search. |
| `has_drm` | Whether the service overrides a Widevine or PlayReady license hook. |
| `has_drm` | Whether the service overrides a Widevine or PlayReady licence hook. |
| `pending_update` | Set to `true` while a service repository refresh waits for this service's jobs to finish before it swaps in the new code. Absent otherwise. |
| `server_accounts` | Present when the server lends its own accounts for this service: `{regions: ["ca", "gb"], global: bool}`, the regions those accounts cover. A client sends no credentials, cookies, or cache for such a service. |
| `auth_methods` | Declared or inferred auth methods, e.g. `["cookies"]`, `["credentials"]`. |
@@ -231,9 +231,7 @@ them in that mode.
`credentials` (`{username, password, extra?}`) and `cookies` (base64 of a
zlib-compressed Netscape cookie file) are the same as on
[`POST /api/session/create`](remote-sessions.md#post-apisessioncreate). `cache` is a map of cache
files in the same form: each cache key is the file path relative to the service cache
directory, with `/` separators and no `.json` suffix, and each value is base64
of the zlib-compressed file. The server writes these files into the request
files in the form that [Cache files](remote-sessions.md#cache-files) gives. The server writes these files into the request
cache directory before the service authenticates.
When you send `credentials`, `cookies` or `cache`, a successful response also
@@ -273,13 +271,13 @@ server, uses the server's own cache and returns no `cache` field.
}
```
Each serialized title carries `type` (`"episode"`, `"movie"`, `"song"`, or `"other"`), `name`, `id`, `language`, `description`, `date`, and `cover_url`. Episodes and movies add `year`. Episodes also add `series_title`, `season`, and `number`.
Each serialised title carries `type` (`"episode"`, `"movie"`, `"song"`, or `"other"`), `name`, `id`, `language`, `description`, `date`, and `cover_url`. Episodes and movies add `year`. Episodes also add `series_title`, `season`, and `number`.
!!! info "The number that `wanted` takes for a song"
A song adds `year` and its music fields, such as `artist`, `album`, `disc`, `track` and
`position`. `wanted` takes `position` when it is not `null`, else `disc` and `track` as in `"2x3"`.
These keys are sent only when the title carries them, so a title without them serializes exactly as before:
These keys are sent only when the title carries them:
| Key | Type | On | Meaning |
| --- | --- | --- | --- |
@@ -1010,7 +1008,7 @@ The server serialises every structured error raised inside a handler to the same
The [error code catalogue](errors.md#error-code-catalogue) gives the default HTTP status of each error code.
When a generic (uncategorized) exception reaches a handler, unshackle inspects its message and type to pick a code. For example, messages mentioning "connection" or "timeout" become `NETWORK_ERROR` (424, retryable), "rate limit" or "429" become `RATE_LIMITED` (429, retryable), and anything unrecognized collapses to `INTERNAL_ERROR` (422).
When a generic (uncategorised) exception reaches a handler, unshackle inspects its message and type to pick a code. For example, messages mentioning "connection" or "timeout" become `NETWORK_ERROR` (424, retryable), "rate limit" or "429" become `RATE_LIMITED` (429, retryable), and anything unrecognised collapses to `INTERNAL_ERROR` (422).
---
+4 -4
View File
@@ -8,7 +8,7 @@ matching **HTTP status**. This page documents that format and catalogues every e
code the server can send.
If you write a client against the API, read this page alongside the endpoint
reference. Each endpoint lists the specific codes it raises, and this page gives the
reference. The section of each endpoint names the specific codes it raises, and this page gives the
meanings of those codes.
!!! note "Where this comes from"
@@ -64,7 +64,7 @@ Error ref 7f3a2c: SERVICE_ERROR 422 POST /api/session/<id>/license service=EXAMP
```
Search the server log for `Error ref <ref>`. The handler's traceback, when there is one,
is directly above that line. The [developer dashboard](dashboard.md) log view also shows it.
is directly above that line. The [server dashboard](dashboard.md) log view also shows it.
### The `details` object
@@ -129,7 +129,7 @@ while the server restarts.
| `CONFLICT` | 409 | The target resource is in a state that disallows the action (retrying a running job, prioritising a non-queued job, clearing cache during an active download). |
| `SERVER_DRAINING` | 409 | The server is about to restart or stops, and starts no new remote session, remote login or download job. Open work continues. Retryable after the restart. A `dl --remote` client waits for the restart and opens a new remote session. |
| `SERVICE_ERROR` | 422 | The streaming service's API returned an error, or the service does not support the requested operation, or the service code exited (`sys.exit`). |
| `DRM_ERROR` | 422 | DRM or license acquisition failed. |
| `DRM_ERROR` | 422 | DRM or licence acquisition failed. |
| `RATE_LIMITED` | 429 | The streaming service is rate-limiting requests. Retryable. |
!!! warning "Not every `429` is `RATE_LIMITED`"
@@ -294,7 +294,7 @@ For anyone writing a consumer of the API, a durable strategy is:
HTTP status.
!!! note "Reference consumer"
unshackle's own remote-download client treats any status of `400` or above as
unshackle's own remote session client treats any status of `400` or above as
fatal, and a `200` body with `"status": "error"` and an `error_code` too: it logs
`Server error [<error_code>]: <message>` and exits. It retries a request once,
after one second, only when a `502`, `503` or `504` arrives with a body that is
+3 -4
View File
@@ -66,7 +66,7 @@ The `serve` command accepts the following flags:
| `--no-widevine` | off | Disable the Widevine CDM endpoints. Cannot be combined with `--api-only`. |
| `--no-playready` | off | Disable the PlayReady CDM endpoints. Cannot be combined with `--api-only`. |
| `--no-key` | off | Disable API-key authentication entirely; every request is allowed. |
| `--remote-only` | off | Expose only the remote-session subset of routes. Implies `--api-only`. |
| `--remote-only` | off | Expose only the [remote session routes](remote-sessions.md#routes). Implies `--api-only`. |
| `--debug-api` | off | Include tracebacks and worker stderr in error responses. |
| `--debug` | off | Enable debug-level logging. |
| `--caddy` | off | Also launch [Caddy](https://caddyserver.com/) as a reverse proxy, using the `Caddyfile` in your user-config directory. |
@@ -97,8 +97,7 @@ The routes the server mounts depend on how you start the server:
=== "`--remote-only`"
The server mounts only the remote-session subset of routes (health, services, search,
and everything under `/api/session/*`). This mode implies `--api-only`, and the
The server mounts only the [remote session routes](remote-sessions.md#routes). This mode implies `--api-only`, and the
interactive Swagger UI is **not** mounted.
=== "`--cdm-only`"
@@ -227,7 +226,7 @@ the full model, including per-key service allowlists.
<div class="grid cards" markdown>
- **[Quick Start](quickstart.md)**: start the server, set an API key, and operate your
- **[REST API Quick Start](quickstart.md)**: start the server, set an API key, and operate your
first end-to-end download over the API.
- **[Authentication](authentication.md)**: the `X-Secret-Key` header, `--no-key`,
per-key service allowlists, and CORS.
+2 -2
View File
@@ -421,10 +421,10 @@ Each job carries a cancellation event. When you `DELETE` a live job:
[remote session](../../guide/remote-sessions.md#when-the-client-ends-a-remote-session), in at most 4
seconds, and runs no post-script after the cancel.
### Secret handling in serialized jobs
### Secret handling in serialised jobs
Job parameters may carry secrets: a raw `user:pass` credential, or a proxy URL with
embedded userinfo. Whenever the manager serializes a job (for an API response or the
embedded userinfo. Whenever the manager serialises a job (for an API response or the
history file), it masks the sensitive keys (`credential`, `credentials`, `password`,
`token`, `api_key`) and strips userinfo from proxy URLs. The manager also scrubs
free-text fields that a service might have leaked a secret into (`error_message`,
+4 -4
View File
@@ -4,7 +4,7 @@ Unshackle ships with a built-in REST API that exposes the same download engine y
The full loop runs end to end: start the server, authenticate, submit a download job, and poll it to completion. The `curl` commands here come directly from the API routes.
!!! note "Who this page is for"
!!! info "Who this page is for"
This is a **developer** guide. It assumes you are comfortable with HTTP, JSON, and a tool like `curl`. If you only want to download something, the [command line](../../index.md) is simpler. The REST API is meant for building tools, UIs, and automation on top of unshackle.
---
@@ -82,7 +82,7 @@ Common options:
| `--no-key` | off | Disable API-key authentication (allow all requests) |
| `--debug-api` | off | Include tracebacks and stderr in error responses |
| `--debug` | off | Enable DEBUG-level logging |
| `--remote-only` | off | Expose only the remote-session subset of routes |
| `--remote-only` | off | Expose only the remote session routes: `/api/health`, `/api/services`, `/api/search`, `/api/session/*`, `/api/tunnel` and `/api/tunnel/check`, and the dashboard routes when `serve.dashboard.key` is set |
| `--caddy` | off | Also launch Caddy as a reverse proxy (for HTTPS) |
Once it is up you will see the API mounted under `/api/` and, unless you started in remote-only mode, an interactive Swagger UI:
@@ -386,13 +386,13 @@ A retry reuses the original job's service, title, and parameters to enqueue a br
## Beyond a single download
The download loop above is the core of the API, but the same server exposes more:
The download flow above is the core of the API, but the same server exposes more:
- **Discovery**: `POST /api/search` finds titles by query, and `POST /api/list-titles` / `POST /api/list-tracks` inspect what a title offers before you commit to downloading it. See [titles and tracks](endpoints.md).
- **History**: `GET /api/history` reads a persisted log of jobs that reached a terminal state (newest first), and `DELETE /api/history/{job_id}` removes a single entry. See [history](endpoints.md).
- **Introspection**: `GET /api/profiles` lists configured credential profiles per service, `GET /api/config` returns a redacted view of the effective server config, and `GET /api/env/check` reports which external binaries the machine has.
- **Maintenance**: `POST /api/maintenance/clear-cache`, `.../clear-temp`, and `.../refresh-services` do housekeeping (the server blocks the cache and temp clears with `409` while a download is active).
- **Remote sessions**: the `/api/session/*` endpoints drive the thin-client "remote download" flow, where the server authenticates and licenses on behalf of a local client. See [remote sessions](remote-sessions.md).
- **Remote sessions**: the routes that carry the remote sessions of `dl --remote`, where the server authenticates and licenses on behalf of a local client. See [remote sessions](remote-sessions.md).
The interactive **Swagger UI at `/api/docs/`** documents every route and lets you try them in the browser (send your `X-Secret-Key` there too).
+2 -2
View File
@@ -1,4 +1,4 @@
# Remote session protocol
# Remote Session Protocol
The remote session protocol is the one record of the routes, login states, error codes and message
shapes that a `--remote` client and the server share. A remote session keeps an authenticated
@@ -13,7 +13,7 @@ in the wire form of `unshackle/core/wire.py`. To set up `dl --remote`, read
## Routes
`unshackle serve` mounts these routes in every mode except `--cdm-only`, which keeps only
`/api/health`. `--remote-only` keeps only these routes (and the dashboard routes). Paths use the `session_id` of the create request.
`/api/health`. `--remote-only` keeps only these routes (and the dashboard routes when `serve.dashboard.key` is set). Paths use the `session_id` of the create request.
| Method | Path | Purpose |
|---|---|---|
+15 -15
View File
@@ -78,11 +78,11 @@ These are abstract. A service will not load unless it defines all three:
`search` command can operate. unshackle calls `authenticate()` first, unless the
service sets `ANONYMOUS_SEARCH`.
- **Licence callbacks**: see [DRM hooks](#drm-hooks) below.
- **`request_input(prompt, qr=None)`**: prompts the user. It goes through the remote-dl input
- **`request_input(prompt, qr=None)`**: prompts the user. It goes through the remote session input
bridge, the REST download job relay, or the rich console.
- **`wait_for_approval(message, check, timeout, interval=3.0, qr=None)`**: shows a message, then
calls `check` until it returns a value. Use it for a login that the user approves on
another device, such as a pair code. A remote-dl session shows the message as a log
another device, such as a pair code. A remote session shows the message as a log
line, and a REST download job shows it as the job's `notice`. Both methods take `qr`, the
text of a QR code to scan, and the terminal or UI that shows the user the message draws it.
When the login API gives only a PNG, `read_qr_image(data)` in `unshackle.core.console`
@@ -323,8 +323,8 @@ The value also goes to a `--remote` client. A track without it muxes everything
and `sdh`, and `forced` cannot combine with either. `Subtitle.Codec` includes `SubRip`
(SRT), `WebVTT` (VTT), `SubStationAlpha`/`SubStationAlphav4` (SSA/ASS),
`TimedTextMarkupLang` (TTML), `SAMI`, `SCC`, and the box-encapsulated DASH formats `fTTML`
(STPP) and `fVTT` (WVTT). Subtitles receive post-download normalization
(segment merging, WebVTT sanitization, format conversion, and optional SDH stripping),
(STPP) and `fVTT` (WVTT). Subtitles receive post-download normalisation
(segment merging, WebVTT sanitisation, format conversion, and optional SDH stripping),
all documented for users in [Subtitles](../guide/subtitles.md).
### Chapters and attachments
@@ -415,7 +415,7 @@ least one and no track is left.
- **Segments** of each format: unshackle inflates a segment body that is one whole gzip member
before the merge, up to a size limit. A CDN can send such a body with no `Content-Encoding`
header. Any other body stays as it is, such as AES-128 ciphertext that starts with the gzip magic.
- **ISM** has no list of segments and no init segments: the parser synthesizes segment URLs
- **ISM** has no list of segments and no init segments: the parser synthesises segment URLs
from the `<c>` fragment timeline, and rebuilds a `moov`/`ftyp` init box from `CodecPrivateData`
(supported for AVC, HEVC, DV-over-HEVC, AAC, EC-3, and TTML). A track id covers the manifest
URL, so a title you build from one ISM manifest per codec or range keeps every variant:
@@ -424,16 +424,16 @@ least one and no track is left.
## DRM hooks
If a track carries DRM, the framework licenses and decrypts it, but it needs your
service to talk to the platform's license server. unshackle recognizes six DRM classes:
service to talk to the platform's licence server. unshackle recognises six DRM classes:
| DRM class | System | License flow |
| DRM class | System | Licence flow |
|---|---|---|
| `Widevine` | Widevine | CDM challenge → license server → content keys (`.wvd` device) |
| `PlayReady` | PlayReady | CDM challenge (WRM header) → license server → content keys (`.prd` device) |
| `Widevine` | Widevine | CDM challenge → licence server → content keys (`.wvd` device) |
| `PlayReady` | PlayReady | CDM challenge (WRM header) → licence server → content keys (`.prd` device) |
| `ClearKeyCENC` | W3C `org.w3.clearkey` or W3C common PSSH over CENC | JSON KID request → JWK set; no CDM |
| `ClearKey` | HLS AES-128 | content key fetched directly from a URI; no CDM, no challenge |
| `CustomDRM` | a system that a DRM plugin adds | `CustomDRM("<plugin id>", kids=..., data=...)`. For a plugin that holds its key, put the key in `data`. For a plugin that licenses locally, put only the data the plugin reads: unshackle licenses it at the licence step. The plugin decrypts. Its README names the `data` it reads |
| `ClearKeyCTR` | AES-128-CTR over a whole file | the service gives the IV and licenses the content key at the licence step; no CDM, no license server |
| `ClearKeyCTR` | AES-128-CTR over a whole file | the service gives the IV and licenses the content key at the licence step; no CDM, no licence server |
!!! warning "`ClearKey` vs `ClearKeyCENC`"
Despite the shared prefix these are entirely different systems. `ClearKey` is HLS
@@ -459,7 +459,7 @@ When a `--remote` client licenses with its own CDM, the callback on the server g
You do not open CDM sessions or operate shaka-packager yourself. The `Widevine`/`PlayReady`
classes drive the CDM handshake and call the decryption backend. Your callback is only the
"send this challenge, give me back the license" step.
"send this challenge, give me back the licence" step.
### The FairPlay bridge hook
@@ -547,11 +547,11 @@ only such tags stops with `None of the key systems are supported` before it down
### How unshackle chooses a CDM and finds keys
CDM selection is config-driven: the `cdm` map resolves a service tag (and optionally the
The CDM choice comes from config: the `cdm` map resolves a service tag (and optionally the
track quality or DRM type) to a device name, which `load_cdm` instantiates as a local
`.wvd`/`.prd` or a remote CDM. Before ever requesting a license, the framework tries an
in-process cache of content keys and the configured **key vaults**. Only unresolved KIDs
trigger an actual license request, and the framework writes newly licensed keys back to
`.wvd`/`.prd` or a remote CDM. Before ever requesting a licence, the framework tries an
in-process cache of content keys and the configured **key vaults**. The CDM makes a challenge only
for an unresolved KID, and the framework writes newly licensed keys back to
every vault. This is why the same content key is rarely re-licensed twice. Users configure
all of this in [DRM and CDM](../guide/drm-and-cdm.md) and
[Key vaults](../guide/vaults.md). The [DRM API reference](../reference/api/drm.md) gives