mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-12-05 07:25:08 +00:00
docs(config): make the configuration reference the one owner of every option table
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
# Configuration Reference (moved)
|
||||
|
||||
This page has moved. The configuration reference is now split by area under
|
||||
[`docs/reference/configuration/`](configuration/index.md), or on the docs site at
|
||||
[docs.unshackle.dev/reference/configuration](https://docs.unshackle.dev/reference/configuration/).
|
||||
|
||||
| Area | Page |
|
||||
|------|------|
|
||||
| Overview & quick index | [configuration/index.md](configuration/index.md) |
|
||||
| Directories & filenames | [configuration/directories.md](configuration/directories.md) |
|
||||
| Services & authentication | [configuration/services.md](configuration/services.md) |
|
||||
| Download & processing | [configuration/download.md](configuration/download.md) |
|
||||
| Output & naming | [configuration/output.md](configuration/output.md) |
|
||||
| DRM & CDM | [configuration/drm.md](configuration/drm.md) |
|
||||
| Network & proxy | [configuration/network.md](configuration/network.md) |
|
||||
| Key vaults | [configuration/vaults.md](configuration/vaults.md) |
|
||||
| Post-scripts | [configuration/post-scripts.md](configuration/post-scripts.md) |
|
||||
| Other settings | [configuration/misc.md](configuration/misc.md) |
|
||||
| Complete annotated example | [configuration/example.md](configuration/example.md) |
|
||||
@@ -18,11 +18,13 @@ config keys:
|
||||
| `-r` / `--range` | `range` |
|
||||
| `--list` | `list` |
|
||||
| `--tmdb` | `tmdb_id` |
|
||||
| `--tvdb` | `tvdb_id` |
|
||||
| `--imdb` | `imdb_id` |
|
||||
| `--anilist` | `anilist_id` |
|
||||
| `-naa` / `--noatmos` | `no_atmos` |
|
||||
| `-o` / `--output` | `output_dir` |
|
||||
| `--cdm-only` / `--vaults-only` | `cdm_only` |
|
||||
| `--cdm-only` / `--vaults-only` | `cdm_only` (`true` for `--cdm-only`, `false` for `--vaults-only`) |
|
||||
| `--cdm` | `cdm_name` |
|
||||
|
||||
**Precedence** (highest first): an explicit CLI flag → a per-service
|
||||
[`services.<TAG>.dl`](services.md) override → this global `dl:` block → the built-in
|
||||
@@ -273,13 +275,13 @@ in or writes them as sidecar files. See [Subtitles](../../guide/subtitles.md) fo
|
||||
| Sub-key | Type | Default | Description |
|
||||
|---------|------|---------|-------------|
|
||||
| `strip_sdh` | bool | `true` | Strip SDH/CC cues (hearing-impaired annotations) into a clean track. |
|
||||
| `sdh_method` | str | `"auto"` | SDH-stripping backend to use. |
|
||||
| `sdh_method` | str | `"auto"` | The engine that strips SDH cues: `auto`, `subby`, `subtitleedit` or `filter-subs`. See [SDH engines](#sdh-engines). |
|
||||
| `preserve_formatting` | bool | `true` | Pass WebVTT cue text through as written. `false` re-encodes it through pycaption, which merges identical cues but flattens styling. unshackle removes WebVTT-only cue markup either way. |
|
||||
| `convert_before_strip` | bool | `true` | Convert to the working format before stripping SDH. |
|
||||
| `conversion_method` | str | `"auto"` | Subtitle conversion backend. |
|
||||
| `convert_before_strip` | bool | `true` | Convert a subtitle that is not SRT to SRT before `filter-subs` strips SDH cues, also when `filter-subs` runs as the fallback of another engine. With `false`, `filter-subs` leaves a subtitle that is not SRT as it is. |
|
||||
| `conversion_method` | str | `"auto"` | The first conversion backend to try: `auto`, `subtitleedit`, `subby`, `pysubs2` or `pycaption`. `auto` ranks the backends for each conversion. A named backend goes first, and unshackle uses the others only when it cannot convert the pair. See [Conversion backends](#conversion-backends). |
|
||||
| `output_mode` | str | `"mux"` | `mux` embeds subtitles in the MKV; `sidecar` writes separate files; `both` writes sidecars and still muxes. |
|
||||
| `sidecar_format` | str | `"srt"` | Format for sidecar files when `output_mode` is `sidecar` or `both`. |
|
||||
| `type_priority` | list | *(unset)* | Ordered ranking of subtitle types (`forced`, `normal`, `sdh`; CC counts as SDH). Types you leave out fall to the end. |
|
||||
| `type_priority` | list | *(unset)* | Ordered ranking of subtitle types (`forced`, `normal`, `sdh`; CC counts as SDH). Types you leave out fall to the end. Unset keeps the order forced, normal, SDH. |
|
||||
| `group_by` | str | `"type"` | Which key groups the subtitle tracks. `type` puts all forced tracks together, then all normal, then all SDH. `language` keeps each language next to its own variants. |
|
||||
| `language_priority` | list | *(unset)* | Languages to sort to the top, in the order you give. The rest keep the default order: original language first, then alphabetical. Nothing is removed. |
|
||||
| `ass_style` | dict | *(unset)* | Style for subtitles converted to ASS, as pysubs2 or ASS style fields (`fontname`, `fontsize`, `primarycolor` or `PrimaryColour`, ...) for a 1080-line picture. Makes ASS the output format when `sub_format` is unset. See [Custom font and style](../../guide/subtitles.md#custom-font-and-style). |
|
||||
@@ -292,6 +294,32 @@ subtitle:
|
||||
sidecar_format: srt
|
||||
```
|
||||
|
||||
### SDH engines { #sdh-engines }
|
||||
|
||||
Every engine removes bracketed sound effects (`[MUSIC PLAYING]`, `(door creaks)`), speaker
|
||||
labels (`MAN:`) and font tags, and keeps plain dialogue and inline `<i>` styling. They differ
|
||||
on music and lyric lines. unshackle compares the value case-sensitively, and an unknown value
|
||||
gives `filter-subs`.
|
||||
|
||||
| `sdh_method` | Engine that runs | Lyric lines (`♪ ... ♪`) |
|
||||
| --- | --- | --- |
|
||||
| `auto` | `subby` for an SRT track. For any other format, SubtitleEdit when you install it and `conversion_method` is `auto` or `subtitleedit`, otherwise `filter-subs`. | Kept, unless the fallback reaches `filter-subs`. |
|
||||
| `subby` | `subby`, but only for a track that is already SRT. Any other format falls through to `filter-subs`. | Kept for SRT, removed otherwise. |
|
||||
| `subtitleedit` | SubtitleEdit when you install it, otherwise `filter-subs`. | Kept with SubtitleEdit, removed without it. |
|
||||
| `filter-subs` | `filter-subs` always. | Removed. |
|
||||
|
||||
### Conversion backends { #conversion-backends }
|
||||
|
||||
| `conversion_method` | Best at | Requires |
|
||||
| --- | --- | --- |
|
||||
| `subtitleedit` | Highest fidelity; keeps positioning and italics | SubtitleEdit installed |
|
||||
| `subby` | SRT output with clean-up | - |
|
||||
| `pysubs2` | Best fidelity for styled SSA/ASS | - (pure Python, always available) |
|
||||
| `pycaption` | Last-resort fallback; flattens styling | - |
|
||||
|
||||
What each backend keeps of the styling is in
|
||||
[What each backend preserves](../../guide/subtitles.md#what-each-backend-preserves).
|
||||
|
||||
!!! note "`group_by` track order"
|
||||
| `group_by` | Result |
|
||||
|---|---|
|
||||
@@ -379,7 +407,7 @@ Matroska (MKV) muxing options.
|
||||
| Sub-key | Type | Default | Description |
|
||||
|---------|------|---------|-------------|
|
||||
| `set_title` | bool | `true` | Write a human-readable title into the MKV container. |
|
||||
| `default_language` | dict | `{}` | Force which language is flagged *default* per track type, e.g. `{audio: en, subtitle: en}`. A tag with a region, such as `en-US`, matches only that variant. |
|
||||
| `default_language` | dict | `{}` | Force which language is flagged *default* per track type (`video`, `audio`, `subtitle`), e.g. `{audio: en, subtitle: en}`. A tag with a region, such as `en-US`, matches only that variant. |
|
||||
| `default_subtitle_type` | str or list | unset | The subtitle types that can take the *default* flag, in order: `forced`, `normal`, `sdh` (CC counts as SDH, and `cc` is the same as `sdh`). The first subtitle track of the first type that the title has gets the flag. With `default_language.subtitle`, only the tracks in that language count. unshackle ignores a different word with a warning. `normal` is the value for players that read the forced flag. Read [Muxing](../../guide/output-and-naming.md#muxing-options). |
|
||||
| `merge_audio` | bool | `true` | Merge all audio into one file. `--split-audio` on the CLI flips this off. |
|
||||
| `merge_video` | bool | `false` | Merge video tracks that share height, range, and codec into one file, so only language varies inside a file. `--merge-video` on the CLI flips this on. |
|
||||
@@ -403,7 +431,8 @@ muxing:
|
||||
|
||||
Language-tag remapping and the rule engine behind the `{lang_tag}` filename variable. When a
|
||||
`rules` list is present, unshackle evaluates each rule in order and uses the first match's
|
||||
`tag`. A rule can examine:
|
||||
`tag`. Every condition of a rule must match. When no rule matches, `{lang_tag}` is empty. A
|
||||
rule can examine:
|
||||
|
||||
| Condition | Meaning |
|
||||
|-----------|---------|
|
||||
|
||||
@@ -33,7 +33,7 @@ Where the file lives, how unshackle discovers it, and how to edit it:
|
||||
| [Services & authentication](services.md) | `services`, `credentials`, `firefox_cookies`, `remote_services`, `serve` |
|
||||
| [Download & processing](download.md) | `dl`, `continue_downloads`, `merge_segments`, `subtitle`, `audio`, `muxing`, `language_tags`, `dual_multi_mode`, `generate_dv_mode`, `hdr10plus_probe` |
|
||||
| [Output & naming](output.md) | `output_template`, `tag`, `tag_rules`, `codec_names`, `tag_group_name`, `tag_imdb_tmdb`, `chapter_fallback_name`, `unicode_filenames`, `filename_replacements` |
|
||||
| [DRM & CDM](drm.md) | `cdm`, `remote_cdm`, `decryption` |
|
||||
| [DRM & CDM](drm.md) | `cdm`, `remote_cdm`, `decryption`, `decrypt_segments` |
|
||||
| [Network & proxy](network.md) | `network`, `headers`, `proxy_providers` |
|
||||
| [Key vaults](vaults.md) | `key_vaults`, `vault_timeout` |
|
||||
| [Post-scripts](post-scripts.md) | `post_scripts` |
|
||||
@@ -41,4 +41,4 @@ Where the file lives, how unshackle discovers it, and how to edit it:
|
||||
| [Caching & updates](misc.md#caching-updates) | `title_cache_enabled`, `title_cache_time`, `title_cache_max_retention`, `update_checks`, `update_check_interval` |
|
||||
| [Appearance](misc.md#appearance) | `theme`, `wide_output` |
|
||||
| [Logging, privacy & debug](misc.md#logging-privacy-debug) | `redact_paths`, `debug`, `debug_keys`, `debug_requests`, `debug_requests_body_limit`, `set_terminal_bg` |
|
||||
| [Deprecated & removed](misc.md#deprecated-removed-keys) | `curl_impersonate`, `downloader`, `scene_naming` |
|
||||
| [Deprecated & removed](misc.md#deprecated-removed-keys) | `curl_impersonate`, `downloader`, `scene_naming`, `imdb_api_enabled` |
|
||||
|
||||
@@ -60,23 +60,24 @@ headers:
|
||||
|
||||
- **Type:** `dict` · **Default:** `{}`
|
||||
|
||||
Proxy/VPN provider configuration. Each sub-key names a proxy provider, and unshackle passes its
|
||||
block straight to that provider's constructor. A bare `--proxy` query tries Basic first, then
|
||||
the other proxy providers in the order of their sub-keys, and Control D last (see
|
||||
[Provider load order](../../guide/proxies-and-vpn.md#provider-load-order)). See
|
||||
[Proxies & VPN](../../guide/proxies-and-vpn.md) for the full proxy provider guide. Recognised proxy
|
||||
providers and their exit ports:
|
||||
Proxy provider configuration. Each sub-key names a proxy provider, and unshackle passes its
|
||||
block to the constructor of that proxy provider, so each config key below is a constructor
|
||||
argument. Except for `basic` and `gluetun`, a config key that the proxy provider does not know
|
||||
stops it from loading. The order of the sub-keys sets the order of a bare `--proxy` query (see
|
||||
[Provider load order](../../guide/proxies-and-vpn.md#provider-load-order)). How to set up each
|
||||
proxy provider and the queries it accepts are in [Proxies & VPN](../../guide/proxies-and-vpn.md).
|
||||
Recognised proxy providers and their exit ports:
|
||||
|
||||
| Provider | Config key | Credentials | Proxy scheme/port |
|
||||
|----------|-----------|-------------|-------------------|
|
||||
| Basic (static) | `basic` | country → URI(s) | as specified |
|
||||
| Control D | `controld` | Write API token (profile/resolver pairs optional) | `http://127.0.0.1:{port}` (local forwarder) |
|
||||
| NordVPN | `nordvpn` | **service** credentials (48 chars combined) | `https://...:89` |
|
||||
| Surfshark | `surfsharkvpn` | **service** credentials (48 chars combined) | `https://...:443` |
|
||||
| Windscribe | `windscribevpn` | service credentials | `https://...:443` |
|
||||
| ExpressVPN | `expressvpn` | device login (`enable: true`) / token cache | `https://cat:...@...:443` |
|
||||
| ProtonVPN | `protonvpn` | TV login or exported cookies | `https://...:4443` (or `:443` Secure Core) |
|
||||
| Gluetun | `gluetun` | per-VPN keys/creds | `http://localhost:{port}` (local Docker) |
|
||||
| Basic (static) | [`basic`](#basic) | country → URI(s) | as specified |
|
||||
| Control D | [`controld`](#controld) | Write API token (profile/resolver pairs optional) | `http://127.0.0.1:{port}` (local forwarder) |
|
||||
| NordVPN | [`nordvpn`](#nordvpn) | **service** credentials (48 chars combined) | `https://...:89` |
|
||||
| Surfshark | [`surfsharkvpn`](#surfsharkvpn) | **service** credentials (48 chars combined) | `https://...:443` |
|
||||
| Windscribe | [`windscribevpn`](#windscribevpn) | service credentials | `https://...:443` |
|
||||
| ExpressVPN | [`expressvpn`](#expressvpn) | device login (`enable: true`) / token cache | `https://cat:...@...:443` |
|
||||
| ProtonVPN | [`protonvpn`](#protonvpn) | TV login or exported cookies | `https://...:4443` (or `:443` Secure Core) |
|
||||
| Gluetun | [`gluetun`](#gluetun) | per-VPN keys/creds | `http://localhost:{port}` (local Docker) |
|
||||
| Hola | *(none, auto)* | none | `http://...:{peer}` |
|
||||
|
||||
```yaml
|
||||
@@ -91,7 +92,23 @@ proxy_providers:
|
||||
password: <service password>
|
||||
```
|
||||
|
||||
### `controld`
|
||||
### `basic` { #basic }
|
||||
|
||||
Each config key is a two-letter country code, and its value is one proxy URI or a list of
|
||||
proxy URIs. unshackle adds `http://` to a URI with no scheme. A URI with no host fails when a
|
||||
query picks it, before the download starts. See [Basic](../../guide/proxies-and-vpn.md#basic-static-proxies)
|
||||
for the queries.
|
||||
|
||||
```yaml
|
||||
proxy_providers:
|
||||
basic:
|
||||
us: http://user:pass@1.2.3.4:8080
|
||||
de:
|
||||
- http://a.example:8080
|
||||
- socks5://b.example:1080
|
||||
```
|
||||
|
||||
### `controld` { #controld }
|
||||
|
||||
Config keys of the Control D proxy provider. See
|
||||
[Control D](../../guide/proxies-and-vpn.md#control-d) for how unshackle uses them.
|
||||
@@ -104,8 +121,128 @@ Config keys of the Control D proxy provider. See
|
||||
| `profiles` | `list` | `[]` | Optional. More pairs, each a mapping with `profile` and `resolver`. |
|
||||
| `max_profiles` | `int` | `4` | The most profiles unshackle uses: your pairs plus the `unshackle-*` endpoints on the account. It must be 1 or more. unshackle creates an `unshackle-<region>` profile and endpoint only while the total is lower. |
|
||||
|
||||
### `expressvpn` { #expressvpn }
|
||||
|
||||
| Key | Type | Default | Meaning |
|
||||
|---|---|---|---|
|
||||
| `enable` | `bool` | `false` | Do the one-time interactive device login when no login session exists. |
|
||||
| `region_map` | `dict` | `{}` | A country code to a city or server preset (`us: ny-02`), used when the query names only the country. An empty value gives a smart random location. |
|
||||
| `server_map` | `dict` | `{}` | An alias to a location slug (`usny-newyork-2`) or a `.expressprovider.com` hostname. |
|
||||
| `cache_path` | `str` | `{cache}/vpn/expressvpn_tokens.json` | The token cache. unshackle writes it with `0600` permissions. |
|
||||
| `refresh_token`, `access_token`, `connection_token` | `str` | none | Tokens to use in place of the token cache. |
|
||||
| `account_json` | `str` | none | A JSON file to read the tokens from when there is no token cache. |
|
||||
| `timeout` | `float` | `10.0` | The request timeout in seconds. |
|
||||
|
||||
`{cache}` is [`directories.cache`](directories.md). ExpressVPN also loads with no config block
|
||||
when its token cache exists.
|
||||
|
||||
### `gluetun` { #gluetun }
|
||||
|
||||
```yaml
|
||||
proxy_providers:
|
||||
gluetun:
|
||||
providers:
|
||||
windscribe:
|
||||
vpn_type: wireguard
|
||||
credentials:
|
||||
private_key: YOUR_WIREGUARD_PRIVATE_KEY
|
||||
addresses: YOUR_WIREGUARD_ADDRESS
|
||||
preshared_key: YOUR_PRESHARED_KEY
|
||||
server_countries:
|
||||
us: US
|
||||
uk: GB
|
||||
server_cities: {}
|
||||
server_hostnames: {}
|
||||
extra_env: {}
|
||||
base_port: 8888
|
||||
auto_cleanup: true
|
||||
container_prefix: unshackle-gluetun
|
||||
auth_user: null
|
||||
auth_password: null
|
||||
verify_ip: true
|
||||
```
|
||||
|
||||
Global keys:
|
||||
|
||||
| Key | Type | Default | Meaning |
|
||||
|---|---|---|---|
|
||||
| `providers` | `dict` | `{}` | One entry for each VPN provider, keyed by its name in the query (`gluetun:<vpn-provider>:<region>`). |
|
||||
| `base_port` | `int` | `8888` | The first local port for a proxy. Other containers take the next free ports. |
|
||||
| `auto_cleanup` | `bool` | `true` | Remove the containers on exit. With `false`, unshackle only stops them. |
|
||||
| `container_prefix` | `str` | `unshackle-gluetun` | The prefix of the Docker container names. |
|
||||
| `auth_user`, `auth_password` | `str` | `null` | HTTP proxy credentials. When set, the local proxy asks for them, and the proxy URI holds them. |
|
||||
| `verify_ip` | `bool` | `true` | After the connection, check the exit IP and its country. |
|
||||
|
||||
Keys of each entry under `providers`:
|
||||
|
||||
| Key | Type | Default | Meaning |
|
||||
|---|---|---|---|
|
||||
| `vpn_type` | `str` | `wireguard` | `wireguard` or `openvpn`. |
|
||||
| `credentials` | `dict` | `{}` | The secrets of the tunnel; see the rules below. |
|
||||
| `server_countries` | `dict` | `{}` | Your region alias (`us`) to Gluetun's country value (`US`). |
|
||||
| `server_cities` | `dict` | `{}` | An alias to a Gluetun city. |
|
||||
| `server_hostnames` | `dict` | `{}` | An alias to one server hostname. |
|
||||
| `extra_env` | `dict` | `{}` | Environment variables that go into the container last, for a Gluetun setting that the keys above do not cover. |
|
||||
|
||||
Credentials that each `vpn_type` needs (unshackle checks them when it loads):
|
||||
|
||||
- **`wireguard`:** `private_key` always. `surfshark`, `mullvad` and `ivpn` also need
|
||||
`addresses`. `windscribe` needs `addresses` and `preshared_key`; `preshared_key` can be an
|
||||
empty string, but the config key must be there. NordVPN and Proton VPN need only `private_key`.
|
||||
- **`openvpn`:** `username` and `password`.
|
||||
|
||||
### `nordvpn` { #nordvpn }
|
||||
|
||||
| Key | Type | Default | Meaning |
|
||||
|---|---|---|---|
|
||||
| `username` | `str` | required | The NordVPN *Service Credentials* username. |
|
||||
| `password` | `str` | required | The *Service Credentials* password. |
|
||||
| `server_map` | `dict` | `{}` | A region (`us`) or `code:city` (`us:seattle`) to a NordVPN server ID, or to an `@` selector (see [Choose a server network](../../guide/proxies-and-vpn.md#choose-a-server-network)). |
|
||||
|
||||
The username and the password together must be 48 letters and digits, and the username must not
|
||||
contain `@`. Login credentials fail this check.
|
||||
|
||||
### `protonvpn` { #protonvpn }
|
||||
|
||||
| Key | Type | Default | Meaning |
|
||||
|---|---|---|---|
|
||||
| `enable` | `bool` | `false` | Do the one-time interactive TV login when no login session exists. |
|
||||
| `server_map` | `dict` | `{}` | An alias to a server query. |
|
||||
| `cookie_path` | `str` | `{cookies}/vpn/protonvpn.txt` | The exported `account.proton.me` cookies. |
|
||||
| `cache_path` | `str` | `{cache}/vpn/protonvpn.json` | The TV login cache. unshackle writes it with `0600` permissions. |
|
||||
| `timeout` | `float` | `10.0` | The request timeout in seconds. |
|
||||
|
||||
`{cookies}` and `{cache}` are [`directories.cookies`](directories.md) and
|
||||
`directories.cache`. unshackle also finds the cookie file as `proton.txt`, and in a `vpns`
|
||||
folder. Proton VPN also loads with no config block when the cookie file exists. A TV login cache
|
||||
alone does not load it, so keep the `protonvpn` block for a TV login.
|
||||
|
||||
### `surfsharkvpn` { #surfsharkvpn }
|
||||
|
||||
| Key | Type | Default | Meaning |
|
||||
|---|---|---|---|
|
||||
| `username` | `str` | required | The Surfshark *Service Credentials* username. |
|
||||
| `password` | `str` | required | The *Service Credentials* password. |
|
||||
| `server_map` | `dict` | `{}` | A region (`us`) or `code:city` (`us:seattle`) to a Surfshark server name (`us-dal`, or the full hostname `us-dal.prod.surfshark.com`), or to an `@` selector. unshackle ignores a numeric or empty value with a warning. A city query uses only its `code:city` entry, never the country entry. |
|
||||
|
||||
The username and the password must pass the same 48-character check as `nordvpn`.
|
||||
|
||||
### `windscribevpn` { #windscribevpn }
|
||||
|
||||
| Key | Type | Default | Meaning |
|
||||
|---|---|---|---|
|
||||
| `username` | `str` | required | The username of the Windscribe proxy *Service Credentials*. |
|
||||
| `password` | `str` | required | The password of the proxy *Service Credentials*. |
|
||||
| `server_map` | `dict` | `{}` | A region (`us`) or `region:city` (`us:seattle`) to a hostname, or to an `@` selector. |
|
||||
|
||||
There is no 48-character check.
|
||||
|
||||
### Hola { #hola }
|
||||
|
||||
Hola has no config key. It loads when unshackle finds the `hola-proxy` binary, in its binaries folders or on your `PATH`.
|
||||
|
||||
!!! note "Provider loading differs between CLI and REST server"
|
||||
The `dl` and `search` commands load all providers, including `gluetun`. A server (REST API
|
||||
requests, download jobs and remote sessions) and the remote client do **not** load `gluetun`,
|
||||
because it starts a local Docker container. ExpressVPN and ProtonVPN also auto-load when their cached session exists, and Hola
|
||||
auto-loads whenever the `hola-proxy` binary is present.
|
||||
because it starts a local Docker container. ExpressVPN, Proton VPN and Hola can also load with no config block
|
||||
(see [`expressvpn`](#expressvpn), [`protonvpn`](#protonvpn) and [Hola](#hola)).
|
||||
|
||||
@@ -1,18 +1,26 @@
|
||||
# Output & naming { #output-naming }
|
||||
|
||||
Keys that control the output filename, the per-title subfolder, release-group tagging, and
|
||||
filename character handling. For template cookbook material and worked naming examples, see
|
||||
filename character handling. For how unshackle builds a path, and for worked naming examples, see
|
||||
the [Output & naming guide](../../guide/output-and-naming.md).
|
||||
|
||||
## `output_template`
|
||||
|
||||
- **Type:** `dict` · **Required** (no usable default; `dl` exits with an error if this is missing)
|
||||
|
||||
Filename templates keyed by media kind, using `{variable}` placeholders. Recognised kinds are
|
||||
`movies`, `series`, `sports`, and `songs` (and `albums` for folder templates). A trailing `?` on a
|
||||
variable (e.g. `{quality?}`) marks it optional: if empty, it and one adjacent separator are
|
||||
Filename templates keyed by media kind, using `{variable}` placeholders. `dl` stops with
|
||||
`No 'output_template' in your unshackle.yaml` when the config key is missing or empty. A trailing `?` on
|
||||
a variable (e.g. `{quality?}`) marks it optional: if empty, it and one adjacent separator are
|
||||
dropped.
|
||||
|
||||
| Kind | Applies to | When unset |
|
||||
|---|---|---|
|
||||
| `movies` | Movies | The title name and year, with spaces: `The Movie (2024)`. |
|
||||
| `series` | TV episodes | The show, year, episode number and name, with spaces: `The Show 2024 S01E05 Pilot`. |
|
||||
| `sports` | Episodes that the service marks as a sports event | The `series` template. |
|
||||
| `songs` | Songs | `"{track_number}. {title}"` |
|
||||
| `albums` | Album folders, in `folder` only | The `songs` folder template, then a single-string `folder`, then `"{artist} - {album} ({year})"`, or `"{artist} - {album}"` with no year. |
|
||||
|
||||
```yaml title="unshackle.yaml"
|
||||
output_template:
|
||||
movies: "{title}.{year}.{quality?}.{source}-{tag}"
|
||||
@@ -35,13 +43,92 @@ unshackle validates templates on load and emits warnings for unknown variables,
|
||||
values, filesystem-unsafe characters (`< > : " / \ | ? *`), empty templates, and unknown
|
||||
folder-kind keys.
|
||||
|
||||
??? example "All valid template variables"
|
||||
`title`, `year`, `season`, `episode`, `season_episode`, `episode_name`, `part`,
|
||||
`absolute`, `date`, `quality`, `resolution`, `source`, `tag`, `track_number`, `artist`,
|
||||
`album_artist`, `album`, `disc`, `track_total`, `disc_total`, `release_type`, `genre`,
|
||||
`explicit`, `isrc`, `upc`, `label`, `audio`, `audio_channels`, `audio_full`, `atmos`,
|
||||
`dual`, `multi`, `dubbed`, `video`, `hdr`, `hfr`, `3d`, `edition`, `repack`, `lang_tag`,
|
||||
`title_type`.
|
||||
### Template variables { #template-variables }
|
||||
|
||||
unshackle takes the values from the downloaded media (through MediaInfo), from the title
|
||||
metadata, or from your config. A variable that does not apply to a title becomes an empty
|
||||
string. The common and audio variables work in every template. The episode variables belong to
|
||||
the `series` and `sports` templates, and the music variables to the `songs` and `albums`
|
||||
templates. unshackle warns at startup about such a variable in another template, also in a
|
||||
single-string `folder` template, which still fills it in for the titles that have it.
|
||||
|
||||
**Common and video**
|
||||
|
||||
| Variable | Meaning | Example |
|
||||
|---|---|---|
|
||||
| `title` | Title name (movie/show/song name; `$` is rendered as `S`) | `The Show` |
|
||||
| `title_type` | Media kind of the title | `movie`, `series`, `music` |
|
||||
| `year` | Release year | `2024` |
|
||||
| `source` | Service tag / class name (empty with `--no-source`) | `EXAMPLE` |
|
||||
| `quality` | Standard resolution with scan suffix | `1080p`, `2160p`, `576i` |
|
||||
| `resolution` | Standard resolution number only | `1080` |
|
||||
| `video` | Video codec; rename it with [`codec_names`](#codec_names) | `H.264`, `H.265` |
|
||||
| `hdr` | Dynamic-range label | `HDR`, `HDR10P`, `DV`, `DV.HDR`, `DV.HDR10P`, `DV.HDRVivid`, `HDRVivid`, `HLG` |
|
||||
| `hfr` | High frame rate marker (frame rate > 30) | `HFR` |
|
||||
| `3d` | Stereoscopic 3D marker (MV-HEVC video) | `3D` |
|
||||
| `edition` | Edition label from the track, if any | `Directors Cut` |
|
||||
| `tag` | Release-group tag (from [`tag`](#tagging-naming-keys), [`tag_rules`](#tag_rules) or `--tag`) | `TAG` |
|
||||
| `repack` | `REPACK` when the `--repack` flag is used | `REPACK` |
|
||||
| `lang_tag` | Result of your [`language_tags`](download.md#language_tags) rules, if configured | `MULTi` |
|
||||
|
||||
**Audio**
|
||||
|
||||
| Variable | Meaning | Example |
|
||||
|---|---|---|
|
||||
| `audio` | Audio codec; rename it with [`codec_names`](#codec_names) | `DDP`, `DD`, `AAC`, `DTS-X` |
|
||||
| `audio_channels` | Channel layout; bed.LFE.heights when the track has height channels | `5.1`, `2.0`, `5.1.4` |
|
||||
| `audio_full` | Codec + channels combined; a name that ends in a digit gets a separator | `DDP5.1`, `DTS-X.5.1.4`, `AC4.2.0` |
|
||||
| `atmos` | `Atmos` when an audio track in the file carries JOC or is marked Atmos, as in the `--list` row (MediaInfo shows no JOC for AC-4) | `Atmos` |
|
||||
| `dual` | `DUAL` for two audio languages (see [`dual_multi_mode`](download.md#dual_multi_mode)) | `DUAL` |
|
||||
| `multi` | `MULTi` for more than two audio languages | `MULTi` |
|
||||
| `dubbed` | `DUBBED` for a single audio language that is not the original (strict mode only) | `DUBBED` |
|
||||
|
||||
**Episode** (`series` and `sports` templates)
|
||||
|
||||
| Variable | Meaning | Example |
|
||||
|---|---|---|
|
||||
| `season` | Zero-padded season (`S%02d`) | `S01` |
|
||||
| `episode` | Zero-padded episode (`E%02d`) | `E05` |
|
||||
| `season_episode` | Combined | `S01E05` |
|
||||
| `episode_name` | Episode title | `Pilot` |
|
||||
| `part` | Part index of a [split episode](../../guide/output-and-naming.md#split-episodes), empty otherwise | `2` |
|
||||
| `absolute` | Absolute episode number, zero-padded to 3 digits, empty when unknown | `007` |
|
||||
| `date` | ISO air date, empty when the episode has none | `2024-06-01` |
|
||||
|
||||
When an episode has an air date, `season` and `season_episode` become the formatted air date,
|
||||
unshackle clears `episode` and `year`, and `{date}` holds the ISO date. The separator inside
|
||||
the date follows the style of the template. A `sports` template differs: `{date}` holds the
|
||||
air date in the separator style of the template (`2026.11.01`), and `{year}` is empty when the
|
||||
event has an air date. See [Sports events](../../guide/output-and-naming.md#sports-events).
|
||||
|
||||
**Music** (`songs` and `albums` templates)
|
||||
|
||||
| Variable | Meaning |
|
||||
|---|---|
|
||||
| `track_number` | Zero-padded track number |
|
||||
| `artist` / `album_artist` | Artist / album artist (falls back to artist) |
|
||||
| `album` | Album name |
|
||||
| `disc` | Disc number (only shown when greater than 1) |
|
||||
| `track_total` / `disc_total` | Totals |
|
||||
| `release_type` | `album`, `single`, `ep`, or another type the service supplies |
|
||||
| `genre` | Genre |
|
||||
| `explicit` | `Explicit` when flagged |
|
||||
| `isrc` / `upc` / `label` | ISRC, UPC and record label |
|
||||
|
||||
!!! note "`quality` and `resolution` use the standard height"
|
||||
unshackle names a video by the nearest standard height (4320, 2160, 1440, 1080, 720, 576, 540,
|
||||
480, 360 or 240) when it is within 10%. It measures the short side and the height that a 16:9
|
||||
picture of the same width has, and uses the larger one. So a cropped 1920x800, a padded
|
||||
1920x1088 and a 1080x1920 portrait video are all `1080p`. A short side within 16 lines of
|
||||
2160, 1440 or 1080 gives that height, so an ultrawide 2560x1080 is `1080p`. A size with no
|
||||
standard height near it, such as 1600x900, keeps its own height. `dl -q` and the
|
||||
`dl --export` file name use the same rule.
|
||||
|
||||
!!! warning "An unknown variable stops the naming"
|
||||
unshackle warns at startup about a variable that is not in the tables above, and continues.
|
||||
When it names a file, a required variable (no `?`) that the title does not have, such as a
|
||||
typo like `{quailty}` or `{season}` in a `movies` template, stops the title with
|
||||
`Missing required template variables`. An optional `{quailty?}` is removed.
|
||||
|
||||
!!! warning "`{part?}` is already inside `{season_episode}`"
|
||||
`part` holds the bare part index of a
|
||||
@@ -75,8 +162,8 @@ folder-kind keys.
|
||||
| `tag` | str | `""` | Release-group tag. Fills the `{tag}` template variable and is written into MKV/audio tags. |
|
||||
| `tag_group_name` | bool | `true` | Include the group name (`tag`) in the MKV `Group` tag. |
|
||||
| `tag_imdb_tmdb` | bool | `true` | Write IMDb/TMDB/TVDB external-ID tags into the MKV (needs metadata providers). |
|
||||
| `chapter_fallback_name` | str | `""` | Fallback template for chapter names, e.g. `"Chapter {i:02}"`. |
|
||||
| `unicode_filenames` | bool | `false` | Allow Unicode in filenames; when `false`, names are ASCII-sanitised. |
|
||||
| `chapter_fallback_name` | str | `""` | The name of a chapter that has no name, as a template, e.g. `"Chapter {i:02}"`. `{i}` is the chapter number, from 1; `{j}` counts only the chapters without a name. Format directives such as `{i:02}` work. |
|
||||
| `unicode_filenames` | bool | `false` | `false` transliterates non-ASCII characters to ASCII and removes accents. `true` keeps the native characters in file and folder names, with the vowel and tone marks of languages such as Thai, Hindi and Bengali. With each value, unshackle first normalises the name to Unicode NFC. |
|
||||
| [`filename_replacements`](#filename_replacements) | dict | `{}` | Replace text in file and folder names, e.g. `&` with `and`. |
|
||||
|
||||
## `codec_names`
|
||||
@@ -85,7 +172,7 @@ folder-kind keys.
|
||||
|
||||
Renames the codec and HDR names in the filename. Each map key is a name that unshackle writes by
|
||||
default, and its value is the name to write instead. The map applies to the `video`, `audio`,
|
||||
and `hdr` [template variables](../../guide/output-and-naming.md#template-variables), and so
|
||||
and `hdr` [template variables](#template-variables), and so
|
||||
also to `audio_full`. A name that is not in the map stays as it is, and an empty value removes
|
||||
the name. You can also set `codec_names` for one service under `services`.
|
||||
|
||||
@@ -175,7 +262,7 @@ Put the more specific rules first, because unshackle stops at the first match.
|
||||
also that HDR10 gives `HDR`, not `HDR10`, and so does a PQ video track with no HDR10
|
||||
metadata. The full set of values is `HDR`, `HDR10P`, `DV`, `DV.HDR`, `DV.HDR10P`,
|
||||
`DV.HDRVivid`, `HDRVivid`, and `HLG`, as listed in the
|
||||
[variable table](../../guide/output-and-naming.md#template-variables).
|
||||
[variable table](#template-variables).
|
||||
|
||||
### Operators
|
||||
|
||||
|
||||
@@ -1,23 +1,30 @@
|
||||
# Key vaults { #key-vaults }
|
||||
|
||||
The full guide is at [Vaults](../../guide/vaults.md). Two keys configure them.
|
||||
Two config keys configure the key vaults. What a vault does during a download, the decode
|
||||
check and the `kv` commands are in the [Vaults](../../guide/vaults.md) guide.
|
||||
|
||||
## `key_vaults`
|
||||
|
||||
- **Type:** `list[dict]` · **Default:** `[]`
|
||||
|
||||
An ordered list of key-vault backends. unshackle queries them in order and reuses the
|
||||
content keys instead of licensing them again. Each entry needs a `type` (the backend module
|
||||
name) and a `name`, plus backend-specific keys.
|
||||
A list of key-vault backends. The order in which unshackle asks them is in
|
||||
[How lookups and caching work](../../guide/vaults.md#how-lookups-and-caching-work). Each entry
|
||||
has these fields, plus the fields of its backend:
|
||||
|
||||
| `type` | Purpose | Required keys | Notes |
|
||||
|--------|---------|--------------|-------|
|
||||
| `SQLite` | Local SQLite database | `name`, `path` | Loaded **critically**; a failure aborts the run. |
|
||||
| `MySQL` | Remote MySQL database | `name`, `host`, `database`, `username` | Extra keys (e.g. `password`, `port`) forwarded to pymysql. `connect_timeout`, `read_timeout` and `write_timeout` default to `vault_timeout`. `autocommit` is always on. |
|
||||
| `API` | RESTful JSON API | `name`, `uri`, `token` | Optional `headers` map is sent with every request. Honours `vault_timeout`. |
|
||||
| `HTTP` | HTTP API with modes | `name`, `host`, one of `password`/`api_key`, and `username` in query mode | `api_mode`: `query` (default), `json`, `decrypt_labs`. Honours `vault_timeout`. |
|
||||
| Field | Required | Description |
|
||||
|-------|----------|-------------|
|
||||
| `type` | yes | The backend: `SQLite`, `MySQL`, `HTTP` or `API`. The value is the name of the backend module, and the match is case-sensitive: `sqlite` does not load. |
|
||||
| `name` | yes | A label that you choose. The `kv` commands and the log name the vault by it. |
|
||||
| `no_push` | no | `true` makes the vault read-only: unshackle reads content keys from it and never writes to it. Default `false`. |
|
||||
|
||||
```yaml
|
||||
| `type` | Purpose | Required fields | Load failure during `dl` |
|
||||
|--------|---------|-----------------|---------------------------|
|
||||
| [`SQLite`](#sqlite) | A local SQLite database file | `path` | Stops the run. |
|
||||
| [`MySQL`](#mysql) | A shared MySQL or MariaDB database | `host`, `database`, `username` | Skipped with a warning. |
|
||||
| [`HTTP`](#http) | An HTTP vault in one of three protocols | `host`, `password` or `api_key`, `username` in `query` mode | Skipped with a warning. |
|
||||
| [`API`](#api) | unshackle's own REST vault protocol | `uri`, `token` | Skipped with a warning. |
|
||||
|
||||
```yaml title="unshackle.yaml"
|
||||
key_vaults:
|
||||
- type: SQLite
|
||||
name: Local
|
||||
@@ -31,34 +38,108 @@ key_vaults:
|
||||
no_push: false
|
||||
```
|
||||
|
||||
!!! note "Per-entry options"
|
||||
- `no_push: true` makes a vault read-only (unshackle fetches content keys from it but never writes to it).
|
||||
- A vault of `type: API` whose `name` contains `decrypt_labs` auto-fills its `token` from
|
||||
[`decrypt_labs_api_key`](misc.md#external-api-keys) when not set inline. Vault `type` values are
|
||||
case-sensitive module names.
|
||||
- unshackle treats an empty or all-zero content key, of any length, as "no key" everywhere
|
||||
and never stores it.
|
||||
### `SQLite` { #sqlite }
|
||||
|
||||
!!! note "Bad content keys"
|
||||
A content key from a vault is proven by short FFmpeg decodes of the decrypted output,
|
||||
with windows inside the fragments of each KID in a fragmented MP4. A content key that
|
||||
fails the decode is written to the `bad_keys` table of every `SQLite` vault with the name
|
||||
of the vault that supplied it, and every vault lookup skips a flagged pair from then on. A `SQLite` vault also refuses to
|
||||
store a flagged pair again. Only the `SQLite` backend stores flags; an `API` vault that
|
||||
supplied the pair gets a report. A `serve` instance with
|
||||
`server_cdm` flags a pair the same way when a remote client reports it, so a server whose
|
||||
`key_vaults` hold no `SQLite` entry cannot remember a bad content key.
|
||||
| Field | Required | Description |
|
||||
|-------|----------|-------------|
|
||||
| `path` | yes | The database file. `~` expands. unshackle makes the file and its tables on first use. |
|
||||
|
||||
Each service gets its own table, named after the service tag, with `kid` and `key_` columns.
|
||||
The connections use WAL journaling with a 30-second busy timeout, so threads can share one file.
|
||||
A `bad_keys` table holds each KID:KEY that failed the decode check, with the service, the vault
|
||||
that supplied it and the time of the flag. It is not a service table, and every command that
|
||||
walks the service tables skips it. Only the `SQLite` backend stores these flags.
|
||||
|
||||
### `MySQL` { #mysql }
|
||||
|
||||
| Field | Required | Description |
|
||||
|-------|----------|-------------|
|
||||
| `host` | yes | The database server hostname or IP. |
|
||||
| `database` | yes | The database (schema) name. |
|
||||
| `username` | yes | The login user. |
|
||||
| *(any other field)* | no | Goes to `pymysql.connect` as it is, for example `password`, `port` or `ssl`. `autocommit` is always on. |
|
||||
|
||||
`connect_timeout`, `read_timeout` and `write_timeout` default to
|
||||
[`vault_timeout`](#vault_timeout), or to 10 seconds when `vault_timeout` is `0`.
|
||||
|
||||
The backend reads its own `SHOW GRANTS` when it connects. It needs `SELECT` to load,
|
||||
`INSERT` to write content keys, and `CREATE` to make a service table. Each `MySQL` vault keeps
|
||||
one connection for the whole run and shares it between threads. When the server is down,
|
||||
unshackle skips the vault for the rest of the run.
|
||||
|
||||
### `HTTP` { #http }
|
||||
|
||||
| Field | Required | Description |
|
||||
|-------|----------|-------------|
|
||||
| `host` | yes | The base URL of the vault API. |
|
||||
| `api_mode` | no | `query` (default), `json` or `decrypt_labs`. |
|
||||
| `username` | in `query` mode | Ignored in the other modes. |
|
||||
| `password` | `password` or `api_key` | The password in `query` mode, the token in `json` mode. |
|
||||
| `api_key` | `password` or `api_key` | Used in `decrypt_labs` mode. When you give both, `api_key` wins. |
|
||||
| `timeout` | no | The request timeout in seconds. Default [`vault_timeout`](#vault_timeout). |
|
||||
|
||||
A vault with neither `password` nor `api_key` does not load.
|
||||
|
||||
| `api_mode` | Transport | Authentication | Notes |
|
||||
|------------|-----------|----------------|-------|
|
||||
| `query` | `GET` with query parameters | `username` and `password` as query parameters | Read and write. |
|
||||
| `json` | `POST` of `{"method": ..., "params": ..., "token": ...}` | `password` as the token | Read and write one content key at a time. Cannot list all content keys. |
|
||||
| `decrypt_labs` | `POST` in the DecryptLabs format | `api_key` in a `decrypt-labs-api-key` header | Read-only: `no_push` is always on. |
|
||||
|
||||
In `json` mode the methods are `GetKey`, `InsertKey` and `GetServices`. A bulk write
|
||||
(`kv copy`, `kv add`) first sends `InsertKeys` with
|
||||
`params: {"keys": {kid: key, ...}, "service": ..., "title": ...}`, up to 500 content keys a call,
|
||||
and expects `{"inserted": <count>}`. A server that answers HTTP 404 or
|
||||
`Unknown JSON-RPC method` to `InsertKeys` gets one `InsertKey` call for each content key for
|
||||
the rest of the run. Because `json` mode cannot list content keys, a `kv copy` from it relies
|
||||
on the server to skip duplicates.
|
||||
|
||||
A host that answers with a body that is not a JSON object, for example a parked domain or a
|
||||
login page, is unreachable: unshackle logs one warning and skips the vault for the rest of the
|
||||
run, and the `serve` health check reports the vault as failed. In `json` mode, HTTP 404 to a
|
||||
lookup means that the vault has no entry. In `decrypt_labs` mode, an error status other than
|
||||
429 is a miss.
|
||||
|
||||
### `API` { #api }
|
||||
|
||||
| Field | Required | Description |
|
||||
|-------|----------|-------------|
|
||||
| `uri` | yes | The base URI of the vault API. unshackle removes a trailing slash. |
|
||||
| `token` | yes | The bearer token, sent as `Authorization: Bearer <token>`. |
|
||||
| `headers` | no | Extra HTTP headers for each request, for example the Cloudflare Access service-token headers `CF-Access-Client-Id` and `CF-Access-Client-Secret`. |
|
||||
| `timeout` | no | The request timeout in seconds. Default [`vault_timeout`](#vault_timeout). |
|
||||
|
||||
An `API` vault whose `name` contains `decrypt_labs` and has no `token` takes the token from
|
||||
[`decrypt_labs_api_key`](misc.md#external-api-keys).
|
||||
|
||||
The backend calls endpoints under `uri`, for example `GET {uri}/{service}/{kid}` for one
|
||||
content key, and reads the numeric `code` field of each JSON answer to find errors such as a
|
||||
bad token, a rate limit or an unknown service tag. A push of many content keys goes in batches.
|
||||
When the server refuses a batch as too large, unshackle makes the batch smaller, and later pushes
|
||||
to that vault start at the size that worked.
|
||||
|
||||
!!! warning "This is unshackle's own protocol"
|
||||
The `API` backend expects unshackle's request and response shape. A vault API of another
|
||||
project does not work with it. Put an adapter in front of such a vault, or use the
|
||||
[`HTTP`](#http) backend if one of its protocols matches.
|
||||
|
||||
### Bad content keys
|
||||
|
||||
A content key that fails the decode check goes into the `bad_keys` table of each `SQLite`
|
||||
vault. Which vault gets a report, and what a server does, is in
|
||||
[Wrong keys from a poisoned vault](../../guide/vaults.md#wrong-keys-from-a-poisoned-vault).
|
||||
|
||||
## `vault_timeout`
|
||||
|
||||
- **Type:** `float` · **Default:** `10.0`
|
||||
|
||||
Timeout in seconds for vault operations. Injected automatically into any backend whose
|
||||
constructor accepts a `timeout` parameter (a per-vault `timeout` still wins). The `MySQL` backend
|
||||
uses it as the default `connect_timeout`, `read_timeout` and `write_timeout`.
|
||||
The timeout in seconds of a vault operation. unshackle gives it to each backend that takes a
|
||||
`timeout` field (`HTTP` and `API`), unless the vault sets its own `timeout`. The `MySQL`
|
||||
backend uses it as the default `connect_timeout`, `read_timeout` and `write_timeout`.
|
||||
|
||||
The `API` and `HTTP` backends send a request again up to 3 times when the vault answers
|
||||
`429 Too Many Requests`. They wait the `Retry-After` time, but never longer than this timeout.
|
||||
A connection failure or a timeout is not tried again. The run does not use a vault again after a
|
||||
connection failure, a timeout, or a `429` that continues after the retries, so a vault that is
|
||||
down costs one timeout per run.
|
||||
unshackle does not try again after a connection failure or a timeout. The run does not use a
|
||||
vault again after a connection failure, a timeout, or a `429` that continues after the retries,
|
||||
so a vault that is down costs one timeout per run. unshackle writes to all vaults at the same
|
||||
time, so a slow vault does not delay the others.
|
||||
|
||||
Reference in New Issue
Block a user