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.