docs(config): explain how to set defaults for a service's own options

This commit is contained in:
imSp4rky
2026-12-02 18:41:16 -07:00
parent 20e06665a1
commit 5f152fdace
2 changed files with 45 additions and 3 deletions
+31
View File
@@ -109,6 +109,37 @@ dl:
request body, `workers: 0` for example, makes each job that uses it fail at submit with request body, `workers: 0` for example, makes each job that uses it fail at submit with
`400 INVALID_PARAMETERS`. `400 INVALID_PARAMETERS`.
### Service option defaults
A service can have its own options, which `unshackle dl <TAG> --help` lists. To give one a
default, add a block under `dl:` and name it with the service tag.
- **Block name:** the tag exactly as you type it on the command line. A `dl:` block named
`EXAMPLE1` applies to `dl EXAMPLE1` and not to `dl example1`.
- **Config key:** the option's long name with dashes replaced by underscores (`--<word>-<word>` →
`<word>_<word>`). Do not use the short flag, and do not keep the dashes: the run ignores an
unknown config key without a warning.
A service option can store its value under another name, as some `dl` options do.
When a config key has no effect, look for that name in the option's definition in the service code.
- **Value:** `true` for a flag, or the value that you would type after the option.
```yaml
dl:
EXAMPLE1:
extra_mode: true
video_profile: ALL
```
The defaults also apply when the service runs on a [remote server](services.md#remote_services),
with `--remote` or with `services.<TAG>.dl.remote`. An option that you type on the command line
replaces the default. A flag that the config sets to `true` stays on unless the service gives the
flag an off form. To turn it off for one run, remove it from the config.
Do not put service options in [`services.<TAG>.dl`](services.md). That block takes only `dl`
options, and it ignores a service option with an `Ignoring unknown dl option` warning.
A setting from the service's own `config.yaml` is not an option: it goes in the service's block
in [`services`](services.md#services).
### Completion archive ### Completion archive
`dl.skip_existing: true` opts CLI downloads into an append-only completion archive under `dl.skip_existing: true` opts CLI downloads into an append-only completion archive under
+14 -3
View File
@@ -15,15 +15,24 @@ Per-service configuration, keyed by the service tag in any case (for example `EX
- **`title_map`**: an exact-match rename map applied to fetched titles (source name → - **`title_map`**: an exact-match rename map applied to fetched titles (source name →
desired name), so a service that names a title differently from your library still matches. desired name), so a service that names a title differently from your library still matches.
- **`dl`**: per-service download defaults, using the same keys as the global - **`dl`**: per-service download defaults, using the same keys as the global
[`dl`](download.md#dl) block. Set `remote: true` to send the `dl` and `search` runs of that [`dl`](download.md#dl) block. A service's own options go in the global `dl` block, see
[service option defaults](download.md#service-option-defaults). Set `remote: true` to send the `dl` and `search` runs of that
service to a [remote server](#remote_services) without `--remote`. Add `server` to select one of service to a [remote server](#remote_services) without `--remote`. Add `server` to select one of
several servers. On the command line, `--local` and `--server` override these keys. A REST API job ignores both keys. several servers. On the command line, `--local` and `--server` override these keys. A REST API job ignores both keys.
A REST API job takes the other keys that it accepts as download parameters as its defaults, A REST API job takes the other keys that it accepts as download parameters as its defaults,
above the `serve` defaults and below the values that the request sends. above the `serve` defaults and below the values that the request sends.
See [making a service remote by default](../../dev/rest-api/remote-sessions.md#making-a-service-remote-by-default). See [making a service remote by default](../../dev/rest-api/remote-sessions.md#making-a-service-remote-by-default).
Individual services may read any additional keys they define. unshackle hands the merged result A service can also read settings of its own, such as a preferred metadata language. The service's own
(the service's own `config.yaml` with this block layered on top) to the service as `self.config`. `config.yaml` and its README, when it has one, name them. To change one, copy its config key into this
block with the same nesting. unshackle merges this block over the service's `config.yaml` and gives
the result to the service as `self.config`. A nested config key replaces only that value, so the
other values in the same section stay.
Over `--remote`, the server builds the service from its own config. The client sends only the
config keys that the service lists for a client identity, see
[your own device identity](../../dev/rest-api/remote-sessions.md#your-own-device-identity).
For every other setting, the value in the server's config applies.
User- or device-specific values (API keys, account IDs, device attributes) belong in this block User- or device-specific values (API keys, account IDs, device attributes) belong in this block
rather than in the service's own `config.yaml`, which holds shared defaults. See rather than in the service's own `config.yaml`, which holds shared defaults. See
@@ -37,6 +46,8 @@ services:
"nordvpn:ca": ca-toronto "nordvpn:ca": ca-toronto
title_map: title_map:
"My Show: The Movie": "My Show Presents The Movie" "My Show: The Movie": "My Show Presents The Movie"
preferences:
language: ko
``` ```
## `credentials` ## `credentials`