mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-12-05 07:25:08 +00:00
docs: sweep docs to zero ste_lint findings and one remote session name
This commit is contained in:
@@ -145,7 +145,7 @@ unshackle honours the special language tokens `orig`, `all`, and `best` everywhe
|
||||
|
||||
| Flag | Description |
|
||||
|---|---|
|
||||
| `-w`, `--wanted` | Wanted episodes, e.g. `S01-S05,S07`, `S01E01-S02E03`. Supports exclusions with a leading `-` (e.g. `-S03`). For a [split episode](downloading.md#split-episodes), `.N` picks one part (`S01E01.2`), a range must stay inside the episode (`S01E01.1-S01E01.3`), and `S01E01` on its own takes every part. For a [dated episode](downloading.md#daily-and-date-based-content), a token can also be an ISO air date (`2026-08-11`) or a date range with a colon (`2026-08-01:2026-08-31`). For a [music release](downloading.md#music-tracks), a token is a number of the track list (`1-5`, `1,3,7`), or `{disc}x{track}` (`2x3`) when the release has more than one disc. |
|
||||
| `-w`, `--wanted` | Wanted episodes, e.g. `S01-S05,S07`, `S01E01-S02E03`. Supports exclusions with a leading `-` (e.g. `-S03`). For a [split episode](downloading.md#split-episodes), `.N` picks one part (`S01E01.2`), a range must stay inside the episode (`S01E01.1-S01E01.3`), and `S01E01` on its own takes every part. For a [dated episode](downloading.md#daily-and-date-based-content), a token can also be an ISO air date (`2026-08-11`) or a date range with a colon (`2026-08-01:2026-08-31`). For a [music release](downloading.md#songs), a token is a number of the track list (`1-5`, `1,3,7`), or `{disc}x{track}` (`2x3`) when the release has more than one disc. |
|
||||
| `--select-titles` | Interactively select what to download: episodes of a series, or films when a title has more than one. **Cannot combine with `-w`.** |
|
||||
| `--latest-episode` | Download only the single most recent episode. `-w` has no effect with it. |
|
||||
| `--latest-episodes N` | Download only the N most recent episodes, which can come from more than one season. A split episode counts as one episode, and all its parts download. `-w` has no effect with it. |
|
||||
@@ -227,7 +227,7 @@ Keep only certain track types, or skip certain track types.
|
||||
| `--no-proxy` | Force-disable all proxy use. |
|
||||
| `--no-proxy-download` | Bypass the proxy for **all downloads** (manifest, licence, and auth stay proxied). |
|
||||
| `--proxy-download` | Use a different proxy for **all downloads**, in the same forms as `--proxy` (manifest, licence, and auth stay on `--proxy`). |
|
||||
| `--remote` | Use a remote unshackle server. |
|
||||
| `--remote` | Use a remote unshackle server. See [Remote sessions](remote-sessions.md). |
|
||||
| `--local` | Use the local service code, also when the config sets `remote: true`. |
|
||||
| `--server` | Name a remote server from the `remote_services` config. |
|
||||
|
||||
@@ -262,7 +262,7 @@ Find titles on a service. Like `dl`, `search` is a group whose subcommands are t
|
||||
unshackle search [OPTIONS] SERVICE [QUERY...]
|
||||
```
|
||||
|
||||
Each service defines its own query syntax. unshackle prints the results as a tree of titles with their service IDs. Feed an ID straight into `dl`.
|
||||
Each service defines its own query syntax. unshackle prints the results as a tree of titles with their title IDs. Feed an ID straight into `dl`.
|
||||
|
||||
unshackle logs in to the service before the search. A service that declares a search with no login is the exception: unshackle then reads no cookies and no credentials, and `--profile` has no effect.
|
||||
|
||||
@@ -597,7 +597,7 @@ unshackle serve [OPTIONS]
|
||||
| `--no-key` | off | Disable API-key authentication (allows all requests). |
|
||||
| `--debug-api` | off | Include tracebacks/stderr in API error responses. |
|
||||
| `--debug` | off | Enable debug logging for API operations. |
|
||||
| `--remote-only` | off | Expose only the remote service session endpoints (health, services, search, session). Implies `--api-only`. |
|
||||
| `--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. Implies `--api-only`. |
|
||||
|
||||
WVD files in the WVDs directory and PRD files in the PRDs directory are auto-loaded. The REST API lives under `http://<host>:<port>/api/`, with Swagger UI at `/api/docs/` and a health check at `/api/health`.
|
||||
|
||||
|
||||
@@ -535,7 +535,7 @@ select the tracks of a music release. By default, unshackle downloads **all** ep
|
||||
|
||||
`-w` / `--wanted` accepts season and episode ranges, comma-separated. Prefix a token
|
||||
with `-` to exclude it. For a music release, the same option takes track numbers. Read
|
||||
[music tracks](#music-tracks) below.
|
||||
[songs](#songs) below.
|
||||
|
||||
=== "Whole seasons"
|
||||
|
||||
@@ -586,7 +586,7 @@ with `-` to exclude it. For a music release, the same option takes track numbers
|
||||
unshackle dl -w 2026-08-01:2026-08-31,-2026-08-15 EXAMPLE 81234567
|
||||
```
|
||||
|
||||
### Music tracks
|
||||
### Songs
|
||||
|
||||
`-w` selects the tracks of an album, EP, single, or playlist. Give a track by its number.
|
||||
A release with more than one disc uses the `{disc}x{track}` form. A number on its own is a
|
||||
|
||||
+24
-24
@@ -3,10 +3,10 @@
|
||||
A Digital Rights Management (DRM) system protects most commercial streaming titles.
|
||||
To download a title and play it back, unshackle needs to get the **content keys**
|
||||
for the encrypted tracks and then decrypt them. This page explains the DRM systems
|
||||
unshackle supports, how to install a device so it can talk to a license server, the
|
||||
unshackle supports, how to install a device so it can talk to a licence server, the
|
||||
difference between local and remote CDMs, and how to choose a decryption backend.
|
||||
|
||||
!!! note "Who this page is for"
|
||||
!!! info "Who this page is for"
|
||||
This is a practical configuration guide for end users of the unshackle CLI.
|
||||
A few sections have a **Developer** mark. They give internal behaviour that is
|
||||
useful when you write a service, but you do not need them to download a protected
|
||||
@@ -18,10 +18,10 @@ Before configuring anything, it helps to know the vocabulary. unshackle draws a
|
||||
line between two things:
|
||||
|
||||
- A **CDM** (Content Decryption Module) is the trusted "black box" that turns a
|
||||
*license challenge* into *content keys*. A **device** backs it: a file that carries
|
||||
*licence challenge* into *content keys*. A **device** backs it: a file that carries
|
||||
the cryptographic identity of a real client, such as a phone or a browser.
|
||||
- A **DRM system** is the wrapper around a CDM that parses the protection metadata,
|
||||
drives the challenge → license → keys handshake, and finally invokes an external
|
||||
drives the challenge → licence → keys handshake, and finally invokes an external
|
||||
tool to physically decrypt the downloaded file.
|
||||
|
||||
A handful of other terms show up throughout:
|
||||
@@ -31,27 +31,27 @@ A handful of other terms show up throughout:
|
||||
| **PSSH** | Protection System Specific Header. The per-system init data extracted from the file's init segment or the manifest. |
|
||||
| **KID** | Key ID: a 16-byte UUID identifying *which* key a track needs. |
|
||||
| **CEK** | Content Encryption Key: the AES content key, mapped from its KID. |
|
||||
| **Challenge** | The license request the CDM produces, sent to the service's license server. |
|
||||
| **License** | The server's response, which the CDM parses to recover the content keys. |
|
||||
| **Challenge** | The request the CDM produces, sent to the service's licence server. |
|
||||
| **Licence** | The server's response, which the CDM parses to recover the content keys. |
|
||||
|
||||
For a Widevine or PlayReady title, the flow is: unshackle reads the PSSH and KIDs
|
||||
from the track, asks the CDM for a license challenge, sends that challenge to the
|
||||
service's license server, hands the response back to the CDM to extract the keys, and
|
||||
from the track, asks the CDM for a licence challenge, sends that challenge to the
|
||||
service's licence server, hands the response back to the CDM to extract the keys, and
|
||||
then decrypts the file with those keys.
|
||||
|
||||
## Supported DRM systems
|
||||
|
||||
unshackle has five DRM systems built in. Only the first two need a device file and a
|
||||
license-server handshake. The rest are special cases. A DRM plugin adds another system (see
|
||||
licence-server handshake. The rest are special cases. A DRM plugin adds another system (see
|
||||
[DRM plugins](#drm-plugins)).
|
||||
|
||||
| System | Device file | License flow | Decryption |
|
||||
| System | Device file | Licence flow | Decryption |
|
||||
|--------|-------------|--------------|------------|
|
||||
| **Widevine** (Google) | `.wvd` | CDM challenge → license server → CDM parses → keys | shaka-packager / mp4decrypt |
|
||||
| **PlayReady** (Microsoft) | `.prd` | CDM challenge (WRM header) → license server → CDM parses → keys | shaka-packager / mp4decrypt |
|
||||
| **ClearKey (CENC)**, W3C EME `org.w3.clearkey` or the W3C common PSSH | none | JSON `{"kids":[...],"type":"temporary"}` → license server returns a JWK Set. No CDM. | shaka-packager / mp4decrypt |
|
||||
| **Widevine** (Google) | `.wvd` | CDM challenge → licence server → CDM parses → keys | shaka-packager / mp4decrypt |
|
||||
| **PlayReady** (Microsoft) | `.prd` | CDM challenge (WRM header) → licence server → CDM parses → keys | shaka-packager / mp4decrypt |
|
||||
| **ClearKey (CENC)**, W3C EME `org.w3.clearkey` or the W3C common PSSH | none | JSON `{"kids":[...],"type":"temporary"}` → licence server returns a JWK Set. No CDM. | shaka-packager / mp4decrypt |
|
||||
| **ClearKey (HLS)**, AES-128 `EXT-X-KEY` | none | Key fetched directly from a URI or `data:` URL. No CDM, no challenge. | in-process AES-CBC |
|
||||
| **ClearKey (CTR)**, AES-128-CTR | none | The service gives the per-track key and IV. No CDM, no license server. | in-process AES-CTR over the whole file |
|
||||
| **ClearKey (CTR)**, AES-128-CTR | none | The service gives the per-track key and IV. No CDM, no licence server. | in-process AES-CTR over the whole file |
|
||||
|
||||
!!! warning "Three different ClearKeys"
|
||||
"ClearKey (HLS)", "ClearKey (CENC)" and "ClearKey (CTR)" are entirely different systems that
|
||||
@@ -213,7 +213,7 @@ The `prd` command group creates and maintains `.prd` files.
|
||||
$ unshackle prd test ./data/PRDs/mydevice.prd -sl 2000 -c aesctr
|
||||
```
|
||||
|
||||
Runs a full challenge/license/keys cycle against Microsoft's public PlayReady
|
||||
Runs a full challenge/licence/keys cycle against Microsoft's public PlayReady
|
||||
test server and prints the returned keys, confirming the device works.
|
||||
`-sl/--security-level` accepts `150`, `2000`, or `3000` (default `2000`).
|
||||
`-c/--ckt` accepts `aesctr` or `aescbc`.
|
||||
@@ -300,7 +300,7 @@ profile.
|
||||
A CDM can operate in two places:
|
||||
|
||||
- A **local CDM** loads a `.wvd` or `.prd` device from your machine and performs the
|
||||
challenge/license/keys handshake locally. This is what the `cdm` mapping above
|
||||
challenge/licence/keys handshake locally. This is what the `cdm` mapping above
|
||||
resolves to by default.
|
||||
- A **remote CDM** delegates the CDM operations to an HTTP API. Your device (and its
|
||||
secrets) live on the remote CDM host. unshackle sends it PSSH/challenge data and
|
||||
@@ -485,7 +485,7 @@ conditions shaka-packager is the better backend. Switch a specific service to
|
||||
When an HLS playlist references a content key with an `EXT-X-KEY` tag, unshackle
|
||||
fetches the content key directly (from the given URI or an inline `data:` URL) and
|
||||
decrypts each segment in-process with AES-CBC. There is no device, no CDM, and no
|
||||
license challenge, so you do not set anything up. unshackle decrypts such tracks
|
||||
licence challenge, so you do not set anything up. unshackle decrypts such tracks
|
||||
automatically during download.
|
||||
|
||||
The `EXT-X-KEY` URI must return a content key of exactly 16 bytes, or the download stops with an error.
|
||||
@@ -494,7 +494,7 @@ logs one warning for the track, because the content key is possibly wrong.
|
||||
|
||||
### ClearKey over CENC (W3C EME `org.w3.clearkey`)
|
||||
|
||||
The CENC ClearKey scheme is a proper license flow, but the "license server"
|
||||
The CENC ClearKey scheme is a proper licence flow, but the "licence server"
|
||||
returns the keys as a JWK Set and not a DRM-wrapped blob. unshackle builds a W3C
|
||||
EME request of the form:
|
||||
|
||||
@@ -502,22 +502,22 @@ EME request of the form:
|
||||
{"kids": ["<base64url-kid>", ...], "type": "temporary"}
|
||||
```
|
||||
|
||||
It sends this to the manifest's license URL (or to whatever a service's ClearKey
|
||||
license hook returns) and reads the JSON Web Key set back. You do not need a device
|
||||
It sends this to the manifest's licence URL (or to whatever a service's ClearKey
|
||||
licence hook returns) and reads the JSON Web Key set back. You do not need a device
|
||||
file. The decrypted file still goes through shaka-packager or mp4decrypt like any
|
||||
other CENC track, so the `decryption` setting applies.
|
||||
|
||||
A DASH manifest can also give the KID of a ClearKey track with only the W3C common PSSH
|
||||
(`urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b`). The common PSSH can name KIDs for any DRM
|
||||
system, so unshackle reads it as ClearKey (CENC) only when the manifest and the init segment
|
||||
give no other DRM system. This scheme has no license URL in the manifest, so the content key
|
||||
must come from the service's ClearKey license hook or from a key vault.
|
||||
give no other DRM system. This scheme has no licence URL in the manifest, so the content key
|
||||
must come from the service's ClearKey licence hook or from a key vault.
|
||||
|
||||
### ClearKey over a whole file (AES-CTR)
|
||||
|
||||
Some services encrypt one whole audio file with AES-128-CTR and give the content key and
|
||||
the IV with the track. unshackle decrypts the file in-process after the download. There is
|
||||
no device, no CDM and no license challenge. The licence step of a download or of a `--skip-dl` run licenses
|
||||
no device, no CDM and no licence challenge. The licence step of a download or of a `--skip-dl` run licenses
|
||||
the content key, so `--list` asks for none. The IV, the length of the header in front of the media and the
|
||||
signature the file must start with travel with the track list.
|
||||
|
||||
@@ -670,7 +670,7 @@ debug_requests: true
|
||||
```
|
||||
|
||||
!!! warning "Keys and paths in logs"
|
||||
When you enable key logging, unshackle writes content keys (KID:key pairs) to the logs.
|
||||
When you enable key logging, unshackle writes content keys (`KID:KEY`) to the logs.
|
||||
Treat those logs as sensitive. The unrelated `redact_paths` option (default
|
||||
`true`) masks local directory paths in log output.
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ For custom templates there is also a standalone [`{part}`](../reference/configur
|
||||
|
||||
### Sports events {#sports-events}
|
||||
|
||||
A service can mark an episode as a sports event. That episode then uses the `sports` output template and the `sports` folder template, if you set them. Without them it uses the `series` templates, as before.
|
||||
A service can mark an episode as a sports event. That episode then uses the `sports` output template and the `sports` folder template, if you set them. Without them it uses the `series` templates.
|
||||
|
||||
```yaml title="unshackle.yaml"
|
||||
output_template:
|
||||
@@ -237,7 +237,7 @@ warning. An MKA file gets no cover art.
|
||||
|
||||
unshackle writes lyrics when the service supplies them: a `LYRICS` Vorbis comment for FLAC, a
|
||||
`USLT` frame for MP3, and a `©lyr` atom for M4A. Ogg uses the same `LYRICS` field as
|
||||
FLAC. unshackle does not write synchronized lyrics (`SYLT`).
|
||||
FLAC. unshackle does not write synchronised lyrics (`SYLT`).
|
||||
|
||||
The embedded lyrics are plain text. A service can also save timed lyrics in a file beside
|
||||
the audio, for example `08.Get.Lucky.lrc` next to `08.Get.Lucky.m4a`. A music player reads
|
||||
@@ -501,11 +501,6 @@ When a title has chapters, unshackle writes them to an OGM chapters file (`filen
|
||||
chapter_fallback_name: "Chapter {i:02}"
|
||||
```
|
||||
|
||||
## Removed & migrated options
|
||||
|
||||
!!! warning "`scene_naming` was removed"
|
||||
The old `scene_naming` option no longer exists. If it is present in your config, unshackle exits immediately with an error asking you to configure `output_template` instead. Migrate any scene-naming setup to the templates described on this page.
|
||||
|
||||
## Worked examples
|
||||
|
||||
Each tab shows a template and what it produces for a few different downloads, so you can see
|
||||
|
||||
@@ -344,7 +344,7 @@ network.
|
||||
!!! note "Each request crosses the tunnel twice"
|
||||
A request from the server goes to your machine and then to the service, so it takes
|
||||
longer than a request that the server sends directly. The segments do not go through the
|
||||
tunnel: the client downloads them as before.
|
||||
tunnel: the client downloads them as it does without one.
|
||||
|
||||
A service that uses a server account does not work with `--local-proxy`, because the server
|
||||
logs in with its own account. If the tunnel drops, the client connects again, and a new request
|
||||
@@ -976,53 +976,6 @@ proxy_providers:
|
||||
|
||||
The returned proxy is HTTPS on **port 443**.
|
||||
|
||||
## Developer notes
|
||||
|
||||
!!! note "One resolution path (developers)"
|
||||
`dl`, `search`, the REST API handlers and the remote-service client all load proxy
|
||||
providers through `load_proxy_providers()` in `unshackle/core/proxies/resolve.py`.
|
||||
The REST API, its download jobs and the remote-service client call it through
|
||||
`initialize_proxy_providers()`, which leaves out Gluetun because Gluetun starts a
|
||||
local Docker container. All paths read a value through `resolve_proxy_value()`, which
|
||||
returns the proxy URI with the proxy provider, the query and the log line: a
|
||||
`controld://` resolver, a `provider:query` or a bare query tried against providers in
|
||||
order, or else an explicit proxy URI or `host:port`.
|
||||
|
||||
The remote-service client resolves `--proxy` with its own
|
||||
`resolve_remote_proxy_arg()`. It changes a `controld:` query to a `controld://`
|
||||
resolver for the server with `get_remote_proxy()`, and it removes Control D from a bare
|
||||
query, because a loopback forwarder is of no use to a server on another machine.
|
||||
|
||||
!!! note "Keeping service requests on the proxy (developers)"
|
||||
`unshackle/core/utils/run_proxy.py` holds the proxy rules for service traffic:
|
||||
|
||||
- `pin(session)` stops environment and system proxies from overriding the proxy of a
|
||||
requests HTTP session, and keeps the environment CA bundle. Call it on each requests
|
||||
HTTP session that gets a proxy.
|
||||
- `fallback_session()` gives a core helper with no HTTP session (a manifest parser, a DRM
|
||||
class) a session on the proxy of the service that called it.
|
||||
- An audit hook on `socket.getaddrinfo` and on `socket.connect` to a host name, and a
|
||||
check in `RnetSession.request`, warn about requests from service code that do not use
|
||||
the proxy. A service sets
|
||||
`proxy_exempt = True` on an HTTP session that goes direct on purpose.
|
||||
|
||||
!!! note "Implementing a new provider (developers)"
|
||||
Every proxy provider subclasses `unshackle.core.proxies.proxy.Proxy` and has three
|
||||
methods:
|
||||
|
||||
- `__init__(self, **kwargs)` receives its `proxy_providers` sub-dict splatted as
|
||||
keyword arguments, so YAML keys map 1:1 to constructor parameters. Check the
|
||||
configuration here, but make no request: every `dl` run builds every configured
|
||||
proxy provider, even for a run with no proxy. Read the server or location catalogue
|
||||
through a `functools.cached_property`, so the first query fetches it.
|
||||
- `__repr__(self)` is a human summary, conventionally `"{n} Countries ({m} Servers)"`.
|
||||
- `get_proxy(self, query)` returns a Requests-compatible proxy URI, or `None` only
|
||||
when the query was valid but no proxy exists. Raise on genuine errors or bad queries.
|
||||
|
||||
Optionally add `get_connection_info(query)` (as Gluetun does) or
|
||||
`last_connection_display()` (as ExpressVPN and Proton VPN do) to make `dl` print a
|
||||
friendly connection line instead of the raw proxy URL.
|
||||
|
||||
## See also
|
||||
|
||||
- [Downloading](downloading.md): the full `dl` command guide, including where proxy
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Remote sessions
|
||||
# Remote Sessions
|
||||
|
||||
A remote session runs a service on a remote unshackle server and the download on your machine.
|
||||
The server logs in to the service, lists the titles, gets the tracks and their manifests, and can
|
||||
@@ -359,7 +359,7 @@ job that uses a remote server sends the end request for at most 4s, then its wor
|
||||
!!! example "`403 FORBIDDEN` during a download"
|
||||
The request came from a different IP address than the one that created the remote session.
|
||||
Remote sessions are bound to that address. Do not move between networks (or NAT egress
|
||||
addresses) during a remote download.
|
||||
addresses) during a remote session.
|
||||
|
||||
!!! example "The login times out or the prompt never resolves"
|
||||
An interactive login has a time limit (see
|
||||
|
||||
@@ -4,7 +4,7 @@ Subtitles are first-class tracks in unshackle. When you download a title, unshac
|
||||
parses the subtitle tracks from the manifest alongside video and audio. It downloads
|
||||
them, cleans them up, and optionally converts them to the format you want. It then muxes
|
||||
them into the final Matroska file, or writes them out as sidecar files next to it. The
|
||||
sections below cover the supported formats, how unshackle normalizes tracks after
|
||||
sections below cover the supported formats, how unshackle normalises tracks after
|
||||
download, how to select and filter subtitles, and every subtitle-related configuration
|
||||
option.
|
||||
|
||||
@@ -54,7 +54,7 @@ format-appropriate clean-up to make a single, valid file:
|
||||
- **Segment merging**: when a WebVTT or boxed subtitle arrives as many DASH/HLS
|
||||
segments, unshackle merges the segments back into one continuous document with
|
||||
correct timing. A cue that a segment boundary cuts in two comes out as one cue.
|
||||
- **WebVTT sanitization**: merged WebVTT runs through a repair pipeline that clamps
|
||||
- **WebVTT sanitisation**: merged WebVTT runs through a repair pipeline that clamps
|
||||
negative timestamps to `00:00:00.000`, removes stray cue identifiers (like `Q0`, `Q1`)
|
||||
that confuse downstream parsers, and merges multi-line cues that a service split into
|
||||
separate overlapping cues. By default unshackle keeps the original styling and layout
|
||||
@@ -435,7 +435,7 @@ an anchor, and an unquoted number is not read as a colour.
|
||||
|
||||
!!! note "Player settings"
|
||||
A player draws an ASS subtitle with its own style, so player options for text subtitles,
|
||||
such as the mpv options `sub-font` and `sub-font-size`, no longer apply. The text size
|
||||
such as the mpv options `sub-font` and `sub-font-size`, do not apply. The text size
|
||||
follows the height of the video, so on a wide video such as 1920x800 the text is smaller
|
||||
than on a 1920x1080 video.
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ Every line is a self-contained JSON object. The first line of each log file reco
|
||||
|
||||
Quote `unshackle_code_hash` in a bug report. It fingerprints the framework source you operate, so it tells us the exact code state even when you did not install from git. A hash that matches no release means that someone edited the source locally.
|
||||
|
||||
Subsequent lines record the operations: service calls, DRM licence requests, vault lookups, downloader progress, and errors. Common fields include:
|
||||
Subsequent lines record the operations: service calls, DRM challenges and licences, vault lookups, downloader progress, and errors. Common fields include:
|
||||
|
||||
| Field | Meaning |
|
||||
|---|---|
|
||||
@@ -358,32 +358,3 @@ Each command reports how many files it removed and how much space it freed, then
|
||||
unshackle loads the **first** `unshackle.yaml` it finds, in the order that [Where the config file lives](../getting-started/configuration-file.md#where-the-config-file-lives) gives.
|
||||
|
||||
If you have config in more than one of those locations, an earlier one wins and unshackle silently ignores your edits to a later file. `unshackle env info` prints the path it loaded (or, if none exists, shows every candidate location so you can make the file correctly). See [Configuration](cli-reference.md#cfg) for editing values with the `cfg` command.
|
||||
|
||||
---
|
||||
|
||||
!!! note "Developer note: structured logging in code"
|
||||
Service and command code sends entries through the shared `log_event(...)` helper (and the `timed_operation(...)` context manager for timing a block) from `unshackle.core.utilities`. These are no-ops when you disable debug logging, so they are always safe to leave in place. When you add a new feature, call `log_event("my_feature_event", message="...", context={...})`. Do not write the "is the logger enabled?" guard again. unshackle does the redaction and the JSON-serialisation for you, and redacts any field whose name looks like a content key, a secret, or a token. Content keys only appear when the run has `debug_keys` enabled.
|
||||
|
||||
### Logging conventions when adding entries
|
||||
|
||||
The debug log is tuned for **developers troubleshooting pipeline flow** (maximum signal, minimum noise), not for end users. A few conventions keep it that way. The `log_event` signature does not enforce them, so they are easy to miss and worth stating explicitly.
|
||||
|
||||
!!! tip "Log levels are a flow skeleton, not just severity"
|
||||
Treat `level` as structure, not decoration. Send exactly **one `INFO` milestone per pipeline stage** so that `jq 'select(.level=="INFO")'` reads back the whole end-to-end flow of a run. Everything internal goes to `DEBUG`. Failures go to `ERROR`. A sparse `INFO` is the whole point. It is the line a developer skims first to see where a run got to before it broke.
|
||||
|
||||
```console
|
||||
# Read the pipeline's high-level flow, one line per stage
|
||||
jq 'select(.level == "INFO")' unshackle_debug_EXAMPLE_20260703-142530.jsonl
|
||||
```
|
||||
|
||||
!!! warning "No request bodies and no raw dumps"
|
||||
A `log_event` entry never holds a request body or a raw dump: no full `Tracks` object, no MPD/manifest body and no response payload. Only `debug_requests` records request and response bodies, and only as files in its separate body folder. Log only **counts, ids, sizes, and `safe_display_url(url)`**. This keeps the log low-noise and prevents leaking title or manifest data into the file *before* redaction even runs. Redaction is a backstop, not a licence to dump raw objects.
|
||||
|
||||
!!! note "Operation names: `<area>_<event>`, no registry"
|
||||
Operation names are plain lowercase strings that follow an `<area>_<event>` convention: `manifest_dash_parse`, `drm_decrypt`, `vault_get_key`, `tool_run`. We write them inline at each call site on purpose. There is **no central registry or enum**. Do not look for one, and do not make one. The absence is a deliberate design choice, not an omission.
|
||||
|
||||
!!! note "Message reads alone; data lives in fields"
|
||||
Give every entry a single-sentence `message` that stands on its own. Put all structured data (`context`, counts, ids, `duration_ms`) in **fields**, not in the prose. This separation lets the log be both human-scannable and machine-filterable. A message like `"Parsed DASH manifest"` with `context={"video": 4, "audio": 2}` beats `"Parsed manifest with 4 video and 2 audio tracks"`.
|
||||
|
||||
!!! tip "Let tool runs log themselves"
|
||||
For external-tool calls (FFmpeg, mkvmerge, `dovi_tool`, and friends), route through `run_step` / `run_tool` / `ffprobe`, which auto-emit a `tool_run` entry capturing the binary's version, return code, and duration consistently. `run_tool` also raises `ToolFailed`, whose message names the tool, the exit code and the last lines the tool wrote. A failure that the caller recovers from (a retry, a fallback) is named with `handled=` (exit codes or stderr text): its `tool_run` entry is `DEBUG`, not `ERROR`, and the call still raises. Only fall back to calling `log_tool_run` manually for a direct `subprocess.run` you genuinely cannot route through those helpers. Auto-logging is the preferred path precisely because it captures those fields the same way every time.
|
||||
|
||||
@@ -201,7 +201,7 @@ $ unshackle kv add keys.txt EXAMPLE local shared
|
||||
0e7cc1a4e2f9411db0f24a3fbb8f8b21:00112233445566778899aabbccddeeff
|
||||
```
|
||||
|
||||
The service argument (`EXAMPLE` above) is normalized to its canonical tag automatically. Keys that already exist in a vault are reported as skipped.
|
||||
The service argument (`EXAMPLE` above) is normalised to its canonical tag automatically. Keys that already exist in a vault are reported as skipped.
|
||||
|
||||
If a vault answers and refuses the content keys, `kv add` shows one warning and continues with the next vault. If a vault is unreachable or still rate limited, `kv add` stops with an error.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user