diff --git a/docs/getting-started/quickstart.md b/docs/getting-started/quickstart.md index bd05dc6c..c22f929a 100644 --- a/docs/getting-started/quickstart.md +++ b/docs/getting-started/quickstart.md @@ -198,7 +198,7 @@ tags the result. | `-r`, `--range` | Dynamic range, e.g. `-r HDR10` or `-r DV`. Defaults to `SDR`. | | `-w`, `--wanted` | Which episodes, e.g. `-w S01` or `-w S01E01-S01E03`. For music, which tracks, e.g. `-w 1-5` or `-w 2x3` for disc 2 track 3. | | `-o`, `--output` | Override the output directory for this run. | -| `--list` | List the tracks that would be downloaded, then stop. | +| `--list` | List every track of each title, then stop before track selection. | !!! example "A few realistic variations" ```shell @@ -212,8 +212,8 @@ tags the result. unshackle dl --latest-episode EXAMPLE 81234567 ``` -See [Downloading](../guide/downloading.md) for the complete flag reference, including -codec, bitrate, channel-layout, and track-type selection. +See the [CLI reference](../guide/cli-reference.md#dl) for every flag, and +[Downloading](../guide/downloading.md) for codec, bitrate, channel-layout, and track-type selection. ## 8. Where the output lands @@ -229,7 +229,7 @@ unshackle dl -q 1080 -o /mnt/media/incoming EXAMPLE 81234567 - unshackle writes **movies** as a single `.mkv` file named from your `movies` template. - unshackle groups **TV episodes** into a per-show / per-season folder (from your - `series` template) unless you pass `--no-folder`. + `series` template). `--no-folder` writes every title directly in the output directory. - unshackle builds the filename from your `output_template` and adds IMDb/TMDB/TVDB IDs to the file's metadata tags when available. diff --git a/docs/guide/cli-reference.md b/docs/guide/cli-reference.md index c33c4dcf..a30d1250 100644 --- a/docs/guide/cli-reference.md +++ b/docs/guide/cli-reference.md @@ -52,20 +52,21 @@ unshackle dl [OPTIONS] SERVICE [SERVICE ARGS...] - `SERVICE`: a service tag (for example `EXAMPLE1` or `EXAMPLE2`). Tags are case-insensitive and honour each service's aliases (`example+`, `EXAMPLE2`, and the other alias forms all give the same tag). - `SERVICE ARGS`: the title, URL, or ID, plus any service-specific options. These belong to the service, not to `dl`. -!!! example "Typical downloads" - ```shell - # Best available 1080p SDR of a title - unshackle dl -q 1080 EXAMPLE 81234567 +```shell title="Typical downloads" +# Best available 1080p SDR of a title +unshackle dl -q 1080 EXAMPLE 81234567 - # 4K HDR10, English audio + subs, from a URL - unshackle dl -q 2160 -r HDR10 -l en EXAMPLE "https://www.example.com/..." +# 4K HDR10, English audio + subs, from a URL +unshackle dl -q 2160 -r HDR10 -l en EXAMPLE "https://www.example.com/..." - # A season range, HEVC video, EC3 audio - unshackle dl -w S01-S03 -v H.265 -a EC3 SERVICE TITLE-ID - ``` +# A season range, HEVC video, EC3 audio +unshackle dl -w S01-S03 -v H.265 -a EC3 SERVICE TITLE-ID +``` -!!! note "Config-driven defaults" - You can give any `dl` flag a default under the `dl:` section of `unshackle.yaml`, and per-service under `services..dl`. Explicit command-line values (and environment values) always win over both. Service defaults only fill in options you did not set. See the [configuration file](../getting-started/configuration-file.md) guide. +[Downloading](downloading.md) shows how these flags work together for common tasks. + +!!! note "Defaults from the configuration file" + You can give any `dl` flag a default in the [`dl`](../reference/configuration/download.md#dl) block of `unshackle.yaml`, and for one service under `services..dl`. A REST API download job takes most of these options: [`POST /api/download`](../dev/rest-api/endpoints.md#post-apidownload) lists them. ### Quality, codec, bitrate & range @@ -73,23 +74,43 @@ unshackle dl [OPTIONS] SERVICE [SERVICE ARGS...] |---|---|---| | `-p`, `--profile` | - | Profile for credentials and cookies. | | `-q`, `--quality` | best | Resolution(s), comma-separated, e.g. `1080,720`. `-q 1080` also matches anamorphic tracks by 16:9 canvas, and padded encodes by standard resolution. | -| `-v`, `--vcodec` | any | Video codec(s). Accepts names or values: `AVC`/`H.264`/`H264`, `HEVC`/`H.265`/`H265`, `VVC`/`H.266`/`H266`, `VC1`/`VC-1`, `VP8`, `VP9`, `AV1`. | -| `-a`, `--acodec` | any | Audio codec(s), comma-separated. Accepts `AAC`, `AC3`/`DD`, `EC3`/`DD+`/`eac3`/`ddp`, `AC4`/`AC-4`, `OPUS`, `OGG`/`VORB`/`vorbis`, `DTS`, `DTSX`/`DTS-X`, `ALAC`, `FLAC`, `MP3`. | +| `-v`, `--vcodec` | any | Video codec(s). Accepts names or values: `AVC`/`H.264`/`H264`, `HEVC`/`H.265`/`H265`, `VVC`/`H.266`/`H266`, `VC1`/`VC-1`, `VP8`, `VP9`, `AV1`, `LCEVC`. unshackle selects an LCEVC track only when you name it, because it cannot play without its base video track. | +| `-a`, `--acodec` | any | Audio codec(s), comma-separated. Accepts a name or a value from [Audio codec values](#audio-codec-values), and the aliases `eac3` and `ddp` (`EC3`) and `vorbis` (`OGG`). | | `-vb`, `--vbitrate` | highest | Exact video bitrate in kbps. | | `-ab`, `--abitrate` | highest | Exact audio bitrate in kbps. | | `-vb-range`, `--vbitrate-range` | - | Video bitrate range in kbps, e.g. `6000-7000`; picks highest within. Mutually exclusive with `--vbitrate`. | | `-ab-range`, `--abitrate-range` | - | Audio bitrate range in kbps, e.g. `128-256`. Mutually exclusive with `--abitrate`. | -| `-r`, `--range` | `SDR` | Colour range(s): `SDR`, `HLG`, `HDR10`, `HDR10P` (HDR10+), `VIVID` (HDR Vivid), `DV`, `HYBRID`. | +| `-r`, `--range` | `SDR` | Colour range(s): `SDR`, `HLG`, `HDR10`, `HDR10P` (HDR10+), `VIVID` (HDR Vivid), `DV`, `HYBRID`. `HDR10+` and `"HDR Vivid"` also work. | | `--generate-dv` | off | With `-r HYBRID`, make Dolby Vision from the HDR10+ metadata or the decoded video when a title has no Dolby Vision track. With `-r HDR10` or `-r HDR10P`, make it for that base and ignore a Dolby Vision track. See [Dolby Vision without a DV track](downloading.md#dolby-vision-without-a-dv-track). | -| `-c`, `--channels` | - | Audio channels; matches sub-layouts (5.1 ≈ 6.0). | +| `-c`, `--channels` | - | Audio channels, e.g. `5.1` or `2.0`; matches sub-layouts (5.1 ≈ 6.0). An immersive layout such as `5.1.4` matches its total number of channels (`-c 10`). | | `-naa`, `--noatmos` | off | Exclude Dolby Atmos audio tracks. | | `--worst` | off | Pick the lowest-bitrate video at each requested resolution, or at the lowest resolution if none is set. | | `--best-available`, `--warn-only` | off | Warn and continue when a requested resolution, range, video language, or audio language is absent, instead of failing. With `--all-drm`, also when one DRM system does not license. | | `-rvb`, `--real-video-bitrate` | off | Probe real media size for true video bitrates, overriding the manifest. | | `-rab`, `--real-audio-bitrate` | off | Same for audio (slower). | +#### Audio codec values + +| Name | Value | Codec | +| --- | --- | --- | +| `AAC` | `AAC` | Advanced Audio Coding | +| `AC3` | `DD` | Dolby Digital | +| `EC3` | `DD+` | Dolby Digital Plus | +| `AC4` | `AC-4` | Dolby AC-4 | +| `OPUS` | `OPUS` | Opus | +| `OGG` | `VORB` | Vorbis | +| `DTS` | `DTS` | DTS | +| `DTSX` | `DTS-X` | DTS:X Profile 2 (DTS-UHD) | +| `DTSHD` | `DTS-HD` | DTS-HD High Resolution, Master Audio and Express | +| `MPEGH` | `MPEG-H` | MPEG-H 3D Audio | +| `AV3A` | `Audio Vivid` | Audio Vivid (AVS3-P3) | +| `ALAC` | `ALAC` | Apple Lossless | +| `FLAC` | `FLAC` | FLAC | +| `MP3` | `MP3` | MPEG-1 Audio Layer III | +| `PCM` | `PCM` | Pulse-code modulation | + !!! note "`HYBRID` range" - `-r HYBRID` fetches both an HDR10/HDR10+/HDR Vivid base and Dolby Vision and merges them with `dovi_tool`. It requires the `dovi_tool` binary on your `PATH`. + `-r HYBRID` fetches both an HDR10/HDR10+/HDR Vivid base and Dolby Vision and merges them with `dovi_tool`. See [Colour range](downloading.md#colour-range) for what it needs. ### Language & subtitles @@ -105,11 +126,11 @@ unshackle dl [OPTIONS] SERVICE [SERVICE ARGS...] | `--skip-missing` | off | Skip a title that misses a required language or track, and continue with the next title. A run with one title, or a run that skips every title, still fails. | | `--skip-existing` | off | Skip a resolved video variant recorded in the completion archive. Does not verify that files still exist. | | `--force` | off | Bypass the completion archive check for this run; does not change overwrite behaviour. | -| `-fs`, `--forced-subs` | off | Include forced subtitle tracks. | +| `-fs`, `--forced-subs` | off | Include forced subtitle tracks. Without it, unshackle drops them. | | `-fso`, `--forced-subs-only` | off | Keep only forced subtitle tracks; drop the other subtitles. Implies `-fs`. | -| `-fsl`, `--forced-s-lang` | none | Language(s) wanted for forced subtitles; implies `-fs`. A `-` prefix excludes. | +| `-fsl`, `--forced-s-lang` | none | Language(s) wanted for forced subtitles; implies `-fs`. A `-` prefix excludes. Independent of `--s-lang`: `-sl all -fsl en` keeps every full subtitle and only the English forced track. | | `--exact-lang` | off | A tag without a region selects only the variant it means and never falls back to another: `-l es` does not select `es-419`. A tag with a region, such as `es-419`, is always exact. Applies to selection and to sort order. | -| `--sub-format` | - | Output subtitle format (`SRT`/`srt`, `VTT`/`webvtt`, `ASS`/`ssa`, `TTML`, `SMI`, ...), or `original` to keep the source format. | +| `--sub-format` | - | Output subtitle format, converted only when necessary: a subtitle codec name or value, case-insensitive (`SRT`, `VTT`/`webvtt`, `ASS`, `SSA`, `TTML`, `SMI`, ...), or `original` to keep the source format. | | `--sub-font` | - | Font for subtitles converted to ASS, with the rest of the look from `subtitle.ass_style`. Implies `--sub-format ASS` and overrides a `sub_format` from the configuration file; a typed `--sub-format` of another format is an error. | !!! tip "These flags select languages, they do not order them" @@ -126,10 +147,10 @@ unshackle honours the special language tokens `orig`, `all`, and `best` everywhe |---|---| | `-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. | | `--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. | -| `--latest-episodes N` | Download only the N most recent episodes. | -| `--max-downloads N` | Stop after N titles have downloaded. A skipped title, or a title already in the completion archive, does not count. | -| `--list-titles` | List titles only; do not download. | +| `--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. | +| `--max-downloads N` | Stop after N titles have downloaded. A skipped title, or a title already in the completion archive, does not count. With `--skip-dl` or `--no-mux`, a title counts when its run completes. Each part of a split episode counts as one title. unshackle does not open the titles after the limit. | +| `--list-titles` | List every title the service returned, then stop. `-w`, `--latest-episode` and `--latest-episodes` do not apply to this list. | ### Track-type inclusion / exclusion @@ -145,7 +166,7 @@ Keep only certain track types, or skip certain track types. | Flag | Description | |---|---| -| `-ad`, `--audio-description` | Include descriptive (audio-description) tracks. | +| `-ad`, `--audio-description` | Include descriptive (audio-description) tracks. Without it, unshackle drops them. | | `-ado`, `--audio-description-only` | Keep only descriptive (audio-description) tracks; drop the standard audio. Does not need `-ad`. | | `--skip-subtitle-errors` | Skip a failed subtitle instead of aborting the title. Video/audio failures remain fatal. | @@ -156,7 +177,7 @@ Keep only certain track types, or skip certain track types. | `--split-audio` | Write a separate output file per audio codec instead of merging. Defaults to config `muxing.merge_audio`. | | `--merge-video` | Mux video tracks that share a height, range, and codec into one file, so only language varies inside a file. Defaults to config `muxing.merge_video`. | | `-o`, `--output` | Override the output directory for this run. | -| `--no-folder` | Disable folder creation for TV shows. | +| `--no-folder` | Write the files directly in the output directory, with no folder for the title. Applies to every kind of title. | | `--no-source` | Remove the source tag from the filename/path. | | `--no-mux` | Do not mux; keep individual track files. | | `--sample` | Download a short sample and write it with a `SAMPLE` tag on the filename in a `Sample` folder inside the output folder. Bare `--sample` = 60 seconds from 2 minutes in; `--sample 0-60` = a custom window in seconds. | @@ -176,37 +197,26 @@ Keep only certain track types, or skip certain track types. | `--anilist` | AniList ID (integer), e.g. `--anilist 21`. A MyAnimeList ID is accepted as `mal:12345` and resolved to the AniList entry. Used for the tags. Skips the title search. `--enrich` reads it too. Needs no API key. | | `--enrich` | Overwrite show title, year and original language with the external source's. **Requires** one of `--tmdb`, `--imdb`, `--tvdb`, or `--anilist`. | | `--daily` | Treat the title as daily/date-based content and fill missing episode air dates from TVDB. The fill needs `--enrich` and a TVDB ID. See [Daily and date-based content](downloading.md#daily-and-date-based-content). | -| `--tvdb-order` | Renumber episodes to a TVDB season order: `official` (aired), `dvd`, `absolute`, `alternate`, or `regional`. Needs `tvdb_api_key`. | +| `--tvdb-order` | Renumber episodes to a TVDB season order: `official` (aired), `dvd`, `absolute`, `alternate`, or `regional`. Needs `tvdb_api_key`. See [Episode ordering](downloading.md#episode-ordering). | | `-ce` / `--continuous-episodes` | Number each season on from the season before it. After a season one of four episodes, season two starts at `S02E05`. Season 0 and episode 0 keep their numbers. | !!! note "One ID at a time" You cannot combine `--tmdb`, `--imdb` and `--tvdb`. Give one and unshackle finds the others from it, and writes all three to the tags. `--anilist` is outside that rule and pairs with one of them, which is how you set the western ID of an anime title yourself. - An ID with no metadata provider that can find it, such as `--tmdb` with no `tmdb_api_key`, - fails before the download starts. `--anilist` needs no API key, so it never fails this check. - -#### Episode ordering - -A service does not always number a series the way TVDB's aired order does. Some services use -TVDB's `alternate` (Streaming) order for Futurama, for example. `--tvdb-order` works out which -order the service used, then renumbers the episodes into the order you asked for. - -!!! note "Orders that do not cover the whole series" - An order can ignore episodes the service carries. TVDB's `dvd` order for Futurama leaves - out the four movies. Those episodes keep their original numbering. If that would give two - episodes the same season/episode slot, and so the same filename, unshackle logs an error - and keeps the service's numbering unchanged. Pick an order that covers the whole series. + An ID with no metadata provider that can find it, such as `--tmdb` with no `tmdb_api_key` + or an ID whose providers `metadata_providers` leaves out, fails before the download starts. `--anilist` needs no API key, so it never fails this check. ### DRM, keys & decryption | Flag | Description | |---|---| -| `--cdm-only` / `--vaults-only` | Use only the CDM, or only Key Vaults, for key acquisition. | -| `--cdm ` | Use the named CDM device from the `cdm` config mapping for this run, ignoring the service/default mapping. Over `--remote`, that device licenses the remote session, not the server CDM. | +| `--cdm-only` | Read no key vault, and get each content key that the run does not already hold from a licence. Over `--remote`, your own CDM licenses each track, and the run uses neither the server CDM nor the server vault. A run with no local CDM fails, and so does a remote session on the server's device. | +| `--vaults-only` | Get no licence. A content key that no key vault, export or earlier track gives fails the title. With both flags, the last one wins. | +| `--cdm ` | Use the named CDM device for this run, and ignore the `cdm` config mapping, its quality and Widevine/PlayReady entries included. Over `--remote`, that device licenses the remote session, not the server CDM. | | `--skip-dl` | Skip the download but still retrieve keys. | | `--all-drm` | License each track with both Widevine and PlayReady. Needs a CDM for each DRM system. Key Vaults are read first; `--cdm-only` sends a challenge for each system. Not for use with `--cdm`. | -| `--export` | Export track info and keys to a `mediaexport` JSON file in the exports directory. | +| `--export` | Write an [export](downloading.md#keys-vaults-and-export) of each title's tracks, DRM init data and content keys to the exports directory. | ### Network & proxy @@ -227,14 +237,14 @@ order the service used, then renumbers the episodes into the order you asked for |---|---|---| | `--workers` | downloader default | Per-track download threads. | | `--adaptive-workers` | off | Scale per-track segment workers dynamically (up to the `--workers` cap) based on measured CDN throughput and errors. | -| `--download-processes` | `1` | Split large segment batches (24+) across this many download processes to exceed the single-process throughput cap on multi-gigabit connections. Ignored while a speed limit is set: the cap is one shared budget, which extra processes cannot share, so the download stays in a single process. Also ignored when the service HTTP session carries state a child process cannot rebuild, such as a custom TLS adapter. | +| `--download-processes` | `1` | Split a batch of 24 or more segments across this many download processes, which share the `--workers` threads. One process tops out at about 1.3 Gb/s; `2` reaches 2.5GbE line rate on a fast CDN. Ignored while a speed limit is set (`--speed-limit`, or the share of `global_speed_limit` that `serve` gives a job): the limit is one budget for every thread of the process, which child processes cannot share. Also ignored when the service HTTP session carries state a child process cannot rebuild, such as a custom TLS adapter. | | `--continue-downloads` | off | Keep completed segment files across runs and resume a previously failed download. One-off enable of the [`continue_downloads`](../reference/configuration/download.md#continue_downloads) config option. | | `--downloads` | `1` | Number of tracks downloaded concurrently. | | `--speed-limit` | unlimited | Cap total download speed across all threads and tracks, e.g. `500k`, `5M`, `1.5G` or plain bytes/sec. Values are bytes, not bits (`5M` = 5.0 MB/s). `off` disables a configured limit. | | `--no-cache` | off | Bypass the title cache. | | `--reset-cache` | off | Clear the title cache. | -| `--list` | off | List available/would-be-downloaded tracks; do not download. | -| `--slow` | - | Inter-title delay. Bare `--slow` = 60-120s; `--slow 20-40` = custom range (minimum 20s). | +| `--list` | off | List the tracks of each title, then stop before track selection. | +| `--slow` | - | Delay between titles. Bare `--slow` = 60-120 s; `--slow MIN-MAX` (e.g. `--slow 20-40`) = a custom range in seconds, with MIN at least 5 and not more than MAX. | !!! warning "Some flags cannot be combined" `--select-titles` and `--wanted` are mutually exclusive. `--vbitrate` and `--vbitrate-range` (and the audio equivalents) are mutually exclusive. @@ -266,13 +276,12 @@ unshackle logs in to the service before the search. A service that declares a se | `--local` | Search with the local service code, also when the config sets `remote: true` for the service. | | `--server` | Name a remote server from the `remote_services` config. | -!!! example - ```shell - unshackle search EXAMPLE "My Show" - unshackle search -p myprofile EXAMPLE "Another Show" - unshackle search --proxy nordvpn:ca SERVICE "query" - unshackle search --remote --server my_server SERVICE "query" - ``` +```shell title="search examples" +unshackle search EXAMPLE "My Show" +unshackle search -p myprofile EXAMPLE "Another Show" +unshackle search --proxy nordvpn:ca SERVICE "query" +unshackle search --remote --server my_server SERVICE "query" +``` --- @@ -286,13 +295,12 @@ unshackle import EXPORT_FILE [DL_ARGS...] unshackle forwards any `dl` options after the file verbatim, so you can override quality, range, proxy, and so on. The import selects tracks with the `dl` defaults, not with the selection of the export. Give the selection options of the export again, for example `-r HYBRID` for an export of HDR tracks. -!!! example - ```shell - unshackle import export.json - unshackle import export.json -r HDR10 --proxy US - ``` +```shell title="import examples" +unshackle import export.json +unshackle import export.json -r HDR10 --proxy US +``` -The export file can be a `mediaexport` file from `dl --export`, an export from an older version of unshackle, or an export from unidl. The file must name the service it came from. +The export file can be an export from `dl --export`, an export from an older version of unshackle, or an export from unidl. The file must name the service it came from. --- @@ -325,11 +333,10 @@ unshackle setup The command takes no options and asks its questions at the prompt. It shows the missing [external tools](../getting-started/installation.md#external-tools-on-your-path) and downloads the ones you accept. It puts them in a `binaries` folder, in the package folder of a git clone or in your user data directory for a `uv` tool install. If no `unshackle.yaml` exists, it writes a first one: inside the clone, or to your user config directory for a `uv` tool install. It then makes the data folders and imports `.wvd` and `.prd` devices, one file or folder per answer, until you give an empty answer. It ends with a summary of the tools, the path of a config that it wrote, and a pointer to `env check`. You can run it again: it skips the tools it finds and never overwrites a config. [Installation](../getting-started/installation.md#what-unshackle-setup-does) gives the full steps and where each file goes. -!!! example - ```shell - uv run unshackle setup # from a git clone - unshackle setup # from a uv tool install - ``` +```shell title="setup examples" +uv run unshackle setup # from a git clone +unshackle setup # from a uv tool install +``` --- @@ -351,15 +358,14 @@ unshackle cfg [KEY] [VALUE] [OPTIONS] !!! warning "Comments are stripped" Writing a value through `cfg` rewrites the configuration file and **removes all comments** from it. If your config relies on comments, edit it by hand instead. Setting a value and using `--unset` together is an error. If a config key is set twice in the same block, every command warns with the line numbers of the two copies and uses the later copy. `cfg` stops without a change. -!!! example - ```shell - unshackle cfg --list # print entire config - unshackle cfg serve.api_secret # read a nested key - unshackle cfg tag MYGROUP # set a string - unshackle cfg update_checks false # literal → boolean False - unshackle cfg directories.downloads /mnt/dl # set a nested path - unshackle cfg tag --unset # remove a key - ``` +```shell title="cfg examples" +unshackle cfg --list # print entire config +unshackle cfg serve.api_secret # read a nested key +unshackle cfg tag MYGROUP # set a string +unshackle cfg update_checks false # literal → boolean False +unshackle cfg directories.downloads /mnt/dl # set a nested path +unshackle cfg tag --unset # remove a key +``` --- @@ -419,21 +425,20 @@ Clear an environment directory. unshackle empties the directory, makes it again, | `unshackle env clear cache [SERVICE]` | Clear the cache directory, or only one service's cache subdirectory. | | `unshackle env clear temp` | Clear the temp directory. | -!!! example - ```shell - unshackle env check - unshackle env info - unshackle env theme - unshackle env clear cache - unshackle env clear cache EXAMPLE # one service only - unshackle env clear temp - ``` +```shell title="env examples" +unshackle env check +unshackle env info +unshackle env theme +unshackle env clear cache +unshackle env clear cache EXAMPLE # one service only +unshackle env clear temp +``` --- ## `kv` -Manage Key Vaults. You configure vaults under `key_vaults` in `unshackle.yaml`, each with a `name`, a `type` (`sqlite`, `mysql`, `http`, `api`), and type-specific options. unshackle normalises service tags automatically. +Manage Key Vaults. You configure vaults under [`key_vaults`](../reference/configuration/vaults.md) in `unshackle.yaml`. unshackle normalises service tags automatically. ``` unshackle kv COMMAND [ARGS]... @@ -460,7 +465,7 @@ Add content keys to one or more vaults for a service. `FILE` contains one `KID:K ### `kv search KID` -Find a KID (32 hex characters, no dashes) in the configured vaults and report its content key. +Find a KID (32 hex characters; unshackle removes dashes) in the configured vaults and report its content key. | Option | Description | |---|---| @@ -474,16 +479,15 @@ Find a KID (32 hex characters, no dashes) in the configured vaults and report it Make service tables on vaults that use tables, for every installed service, where they do not already exist. -!!! example - ```shell - unshackle kv copy main backup1 backup2 - unshackle kv copy main backup -s EXAMPLE - unshackle kv copy main ~/Downloads/key_store.db -s EXAMPLE - unshackle kv sync main mysql_vault - unshackle kv add keys.txt EXAMPLE main backup - unshackle kv search 0123456789abcdef0123456789abcdef -s EXAMPLE -v main - unshackle kv prepare main mysql_vault - ``` +```shell title="kv examples" +unshackle kv copy main backup1 backup2 +unshackle kv copy main backup -s EXAMPLE +unshackle kv copy main ~/Downloads/key_store.db -s EXAMPLE +unshackle kv sync main mysql_vault +unshackle kv add keys.txt EXAMPLE main backup +unshackle kv search 0123456789abcdef0123456789abcdef -s EXAMPLE -v main +unshackle kv prepare main mysql_vault +``` --- @@ -511,13 +515,12 @@ unshackle wvd COMMAND [ARGS]... | `-l`, `--level` | `1` | Security level (1-3). | | `-o`, `--output` | WVDs dir | Output directory. | -!!! example - ```shell - unshackle wvd add device.wvd - unshackle wvd parse nexus_6p_1234_l1 - unshackle wvd dump device.wvd ./out_dir - unshackle wvd new "Nexus 6P" private_key.pem client_id.bin vmp.bin -t ANDROID -l 3 - ``` +```shell title="wvd examples" +unshackle wvd add device.wvd +unshackle wvd parse nexus_6p_1234_l1 +unshackle wvd dump device.wvd ./out_dir +unshackle wvd new "Nexus 6P" private_key.pem client_id.bin vmp.bin -t ANDROID -l 3 +``` --- @@ -564,15 +567,14 @@ Write the group key (`zgpriv.dat`) and the group certificate (`bgroupcert.dat`) Show each certificate of a certificate chain: type, security level, expiry date, name, features and keys. Give `-d` with a `.prd` file, or `-c` with a chain file such as `bgroupcert.dat`. -!!! example - ```shell - unshackle prd new ./device_folder/ - unshackle prd new zgpriv.dat bgroupcert.dat -o /out/dir - unshackle prd reprovision mydevice.prd - unshackle prd test mydevice.prd -sl 3000 -c aescbc - unshackle prd export mydevice.prd -o ./out_dir - unshackle prd inspect -d mydevice.prd - ``` +```shell title="prd examples" +unshackle prd new ./device_folder/ +unshackle prd new zgpriv.dat bgroupcert.dat -o /out/dir +unshackle prd reprovision mydevice.prd +unshackle prd test mydevice.prd -sl 3000 -c aescbc +unshackle prd export mydevice.prd -o ./out_dir +unshackle prd inspect -d mydevice.prd +``` --- @@ -612,14 +614,13 @@ WVD files in the WVDs directory and PRD files in the PRDs directory are auto-loa username: user ``` -!!! example - ```shell - unshackle serve - unshackle serve -h 0.0.0.0 -p 8080 - unshackle serve --api-only - unshackle serve --remote-only - unshackle serve --caddy - ``` +```shell title="serve examples" +unshackle serve +unshackle serve -h 0.0.0.0 -p 8080 +unshackle serve --api-only +unshackle serve --remote-only +unshackle serve --caddy +``` --- @@ -666,14 +667,13 @@ Decode an entire video with FFmpeg and report any corruptions or errors. By defa |---|---|---| | `-m`, `--map` | `0` | Do a test of specific tracks with FFmpeg's `-map`, for example `0:v:0` or `0:a`. | -!!! example - ```shell - unshackle util refresh-services - unshackle util crop video.mkv 2.39:1 - unshackle util crop ./season/ 16:9 --pillar -o 10 - unshackle util range video.mkv --full - unshackle util test video.mkv -m 0:v:0 - ``` +```shell title="util examples" +unshackle util refresh-services +unshackle util crop video.mkv 2.39:1 +unshackle util crop ./season/ 16:9 --pillar -o 10 +unshackle util range video.mkv --full +unshackle util test video.mkv -m 0:v:0 +``` --- diff --git a/docs/guide/downloading.md b/docs/guide/downloading.md index bc224eae..c8131157 100644 --- a/docs/guide/downloading.md +++ b/docs/guide/downloading.md @@ -1,17 +1,14 @@ # Downloading `unshackle dl` is the main download command: it fetches a title's manifest from a -streaming service, selects exactly the tracks you asked for, acquires and applies -decryption keys, and muxes everything into a finished Matroska file. The flags below -cover quality and codec selection, language and subtitle handling, episode ranges, and -the download flow itself. +streaming service, selects exactly the tracks you asked for, gets and applies the +content keys, and muxes everything into a finished Matroska file. This page shows how +to do common download tasks and how the flags work together. -!!! note "Where the full flag list lives" - This page covers the flags you will use most and explains how they interact. It is - not an exhaustive enumeration. For the complete, always-current list of every option - and its exact wording, use `unshackle dl --help`. Every flag shown here can also be - given a default in your configuration file. See - [Configuration file](../getting-started/configuration-file.md). +!!! note "Where each flag is described" + The [CLI reference](cli-reference.md#dl) describes each `dl` flag and its default, and + `unshackle dl --help` gives a short description of each. To give a flag a default in your + configuration file, use the [`dl`](../reference/configuration/download.md#dl) block. ## Command shape @@ -59,14 +56,16 @@ with `--skip-dl`. 5. **Get tracks**: parse the manifest into video, audio, subtitle, and chapter tracks. 6. **Select tracks**: narrow each type down using your quality, codec, range, language, and bitrate flags. -7. **Download**: pull segments for the selected tracks (concurrently per `--downloads`). -8. **License & decrypt**: get the content keys (vault → CDM), decrypt each track. +7. **Licence**: get the content keys of each selected track, in the + [key order](drm-and-cdm.md#keys-vaults-and-caching). +8. **Download & decrypt**: pull the segments of the selected tracks (concurrently per + `--downloads`), merge them, and decrypt each track. 9. **Post-process**: extract closed captions, convert subtitles, repack, mux with `mkvmerge`, and move the finished file to your downloads directory. `--list` prints the tracks a title exposes and stops before selection. `--list-titles` prints every title the service returned and stops before `--wanted`/`--latest-episode`/`--latest-episodes` -filtering. `--skip-dl` runs the license step but skips the actual segment download. +filtering. `--skip-dl` runs the licence step but skips the segment download. ## Choosing quality @@ -96,12 +95,10 @@ unshackle dl -q 2160,1080,720 EXAMPLE 81234567 ### Best-available and worst -By default a missing requested resolution is an error. Two flags change that: - -| Flag | Behaviour | -| --- | --- | -| `--best-available` (`--warn-only`) | If the requested resolution(s) are not present, continue with the best that *is* available instead of failing. Also softens missing video and audio languages and hybrid fallbacks, and with `--all-drm` a DRM system that does not license. | -| `--worst` | Pick the lowest-bitrate video at each requested resolution. With no requested resolution, pick the lowest-bitrate video at the lowest resolution. | +By default a missing requested resolution is an error. +[`--best-available` and `--worst`](cli-reference.md#quality-codec-bitrate-range) change that: +the first continues with the best resolution that is available, and the second picks the +lowest-bitrate video. A `quality` in the config counts as a requested resolution. When `--best-available` finds none of the requested resolutions, `--worst` also picks from the lowest resolution. In hybrid mode, that is the @@ -115,24 +112,8 @@ unshackle dl -q 2160 --best-available EXAMPLE 0ABC123 ### Codec -`-v` / `--vcodec` selects one or more video codecs. The default is any codec. It accepts -either enum **names** or their **values**, comma-separated. - -| Name | Value | -| --- | --- | -| `AVC` | `H.264` | -| `HEVC` | `H.265` | -| `VVC` | `H.266` | -| `VC1` | `VC-1` | -| `VP8` | `VP8` | -| `VP9` | `VP9` | -| `AV1` | `AV1` | -| `LCEVC` | `LCEVC` | - -`H264`, `H265` and `H266` are aliases of `AVC`, `HEVC` and `VVC`. - -An LCEVC (MPEG-5 Part 2) track only adds detail on top of its base video track and cannot play -alone, so unshackle selects it only when you ask for it with `-v LCEVC`. +[`-v` / `--vcodec`](cli-reference.md#quality-codec-bitrate-range) selects one or more video codecs, +comma-separated, by name (`HEVC`) or by value (`H.265`). The default is any codec. ```shell title="Either spelling works" unshackle dl -v HEVC EXAMPLE 81234567 @@ -142,17 +123,9 @@ unshackle dl -v hevc,avc EXAMPLE 81234567 ### Colour range -`-r` / `--range` selects one or more colour ranges. The default is `SDR`. - -| Range | Meaning | -| --- | --- | -| `SDR` | Standard dynamic range (default) | -| `HLG` | Hybrid Log-Gamma | -| `HDR10` | HDR10 | -| `HDR10P` | HDR10+ (`-r HDR10+` also works) | -| `VIVID` | HDR Vivid (`-r "HDR Vivid"` also works) | -| `DV` | Dolby Vision | -| `HYBRID` | Fetch both an HDR10/HDR10+/HDR Vivid base and a DV track, then merge them | +[`-r` / `--range`](cli-reference.md#quality-codec-bitrate-range) selects one or more colour ranges. +The default is `SDR`. `HYBRID` fetches both an HDR10/HDR10+/HDR Vivid base and a DV track, +then merges them. ```shell title="Grab HDR10 and Dolby Vision in one run" unshackle dl -q 2160 -r HDR10,DV EXAMPLE '...' @@ -273,18 +246,9 @@ measured for each pixel. By default unshackle keeps the highest-bitrate rendition for each selected resolution/codec/range/language combination. One requested video language is one language here, also when it matches more than one regional tag (`en` can match -`en-AU` and `en-GB`). You can constrain this. - -| Flag | Purpose | -| --- | --- | -| `-vb` / `--vbitrate` | Exact video bitrate in kbps. | -| `-ab` / `--abitrate` | Exact audio bitrate in kbps. | -| `-vb-range` / `--vbitrate-range` | Video bitrate range in kbps, e.g. `6000-7000`; picks the highest within it. | -| `-ab-range` / `--abitrate-range` | Audio bitrate range in kbps, e.g. `128-256`. | - -!!! warning "Exact vs range are mutually exclusive" - You cannot combine `--vbitrate` with `--vbitrate-range`, and likewise for the audio - pair. Pick one form. +`en-AU` and `en-GB`). To pick a different bitrate, give an exact bitrate (`-vb`, `-ab`) +or a bitrate range (`-vb-range`, `-ab-range`); the +[CLI reference](cli-reference.md#quality-codec-bitrate-range) describes each. ### Real bitrate probing @@ -292,12 +256,10 @@ Manifest-declared bitrates are sometimes rounded or wrong. Services often advert **peak** or **nominal** bandwidth that is far from the track's real average. This matters because a track's bitrate drives the track listing, the sort order, *and* the `--vbitrate`/`--vbitrate-range` selection above. A bogus declared value therefore makes -unshackle pick the wrong track. These flags probe the actual media size to compute a true -bitrate for the top renditions, overriding the manifest value: - -- `-rvb` / `--real-video-bitrate`: probe real video bitrates (per codec/range). -- `-rab` / `--real-audio-bitrate`: probe real audio bitrates (per codec/channels/ - language). Slower than the video variant because there are more renditions to probe. +unshackle pick the wrong track. +[`-rvb` and `-rab`](cli-reference.md#quality-codec-bitrate-range) probe the media size to calculate +the real bitrate of the top video and audio renditions, and override the manifest value. The +audio probe is slower, because there are more audio renditions to probe. !!! note "Reading the probed numbers" unshackle measures a single-file track (DASH `SegmentBase`/`BaseURL`) **exactly**. A @@ -321,27 +283,9 @@ bitrate for the top renditions, overriding the manifest value: ### Codec -`-a` / `--acodec` selects one or more audio codecs (comma-separated). The default is any. - -| Name | Value | Codec | -| --- | --- | --- | -| `AAC` | `AAC` | Advanced Audio Coding | -| `AC3` | `DD` | Dolby Digital | -| `EC3` | `DD+` | Dolby Digital Plus | -| `AC4` | `AC-4` | Dolby AC-4 | -| `OPUS` | `OPUS` | Opus | -| `OGG` | `VORB` | Vorbis | -| `DTS` | `DTS` | DTS | -| `DTSX` | `DTS-X` | DTS:X Profile 2 (DTS-UHD) | -| `DTSHD` | `DTS-HD` | DTS-HD High Resolution, Master Audio and Express | -| `MPEGH` | `MPEG-H` | MPEG-H 3D Audio | -| `AV3A` | `Audio Vivid` | Audio Vivid (AVS3-P3) | -| `ALAC` | `ALAC` | Apple Lossless | -| `FLAC` | `FLAC` | FLAC | -| `MP3` | `MP3` | MPEG-1 Audio Layer III | - -unshackle accepts names, values, and a few aliases: `eac3` and `ddp` both give `EC3`, -and `vorbis` gives `OGG`. +[`-a` / `--acodec`](cli-reference.md#quality-codec-bitrate-range) selects one or more audio codecs, +comma-separated, by name, value or alias from the [audio codec values](cli-reference.md#audio-codec-values). +The default is any. ```shell title="Prefer Dolby Digital Plus, fall back to AAC" unshackle dl -a EC3,AAC EXAMPLE 81234567 @@ -349,10 +293,8 @@ unshackle dl -a EC3,AAC EXAMPLE 81234567 ### Channels and Atmos -- `-c` / `--channels`: desired channel layout, for example `5.1` or `2.0`. Matching is by - ceiling, so `5.1` implicitly matches a `6.0`-reported layout. An immersive layout such as - `5.1.4` matches on its total number of channels, so `-c 10` selects it. -- `-naa` / `--noatmos`: exclude Atmos audio tracks from selection. +[`-c` / `--channels` and `-naa` / `--noatmos`](cli-reference.md#quality-codec-bitrate-range) select a +channel layout, such as `5.1` or `2.0`, and drop the Atmos tracks. A track is Atmos when its manifest says so: a DD+ JOC descriptor, an HLS `CHANNELS` value with `JOC` or `ATMOS` (`16/JOC`, `2/IMSA,ATMOS`), or the Smooth Streaming `HasAtmos` attribute. A DASH @@ -388,7 +330,7 @@ unshackle dl -a AAC -ab 320 EXAMPLE 81234567 ### Video and audio language -`-l` / `--lang` sets the wanted language(s) for **both video and audio**. The default is +[`-l` / `--lang`](cli-reference.md#language-subtitles) sets the wanted language(s) for **both video and audio**. The default is `orig`, the title's original language. ```shell title="Original language plus English" @@ -502,7 +444,7 @@ See the [exclusion rules](#excluding-languages) for `--exact-lang`. ### Selecting subtitle languages -`-sl` / `--s-lang` sets the wanted subtitle language(s). The default is `all`, so +[`-sl` / `--s-lang`](cli-reference.md#language-subtitles) sets the wanted subtitle language(s). The default is `all`, so unshackle downloads every available subtitle language. ```shell title="Only English and Spanish subtitles" @@ -515,7 +457,7 @@ except Spanish, forced Spanish subtitles included. ### Requiring subtitles -`--require-subs` takes a list of languages that **must** exist. If any is missing, the +[`--require-subs`](cli-reference.md#language-subtitles) takes a list of languages that **must** exist. If any is missing, the title fails, even under `--best-available` / `--warn-only`. Use it when a download is only worth keeping if a specific subtitle track is present. @@ -553,7 +495,7 @@ The check runs against the full track list, before any language selection or exc video track counts. `--no-audio` and `--no-video` drop the matching requirement. A failed title stops the whole run. To skip that title and come back for it later, add -`--skip-missing`, or set `skip_missing: true` under `dl:` in `unshackle.yaml`. It also skips a +`--skip-missing`, or set `skip_missing` in the [`dl`](../reference/configuration/download.md#dl) block. It also skips a title that has no track for a filter such as `-q`, `-v`, `-r`, `-a` or a language you request. A run with one title, or a run that skips every title, still fails. A REST API job lists each skipped title and the reason in `skipped_titles`. @@ -565,26 +507,13 @@ unshackle dl -al ko,en --require-audio ko --skip-missing -w S06 EXAMPLE 0ABC123 ### Forced subtitles and output format -- `-fs` / `--forced-subs`: include forced subtitle tracks (signs/foreign dialogue). - Without this flag, unshackle drops forced subtitle tracks from the selection. -- `-fsl` / `--forced-s-lang`: keep forced subtitles only in these languages (implies - `-fs`). Works independently of `--s-lang`, so `-sl all -fsl en` grabs every full - subtitle but only the English forced track. It accepts exclusions too: `-fsl all,-es` - keeps every forced subtitle except the Spanish one, and `-fsl -es` means the same. -- `-fso` / `--forced-subs-only`: keep only the forced subtitle tracks and drop every - other subtitle (implies `-fs`). `--s-lang` and `-fsl` still select the languages. -- `--sub-format`: set the output subtitle format, converting only when necessary. - Accepts codec names/values and common aliases (`srt`, `vtt`, `ass`, `ssa`, `ttml`, - and the other codec aliases), or the literal `original` to keep the source format. +Forced subtitles carry signs and foreign dialogue. unshackle drops them unless you add +[`-fs`, `-fsl` or `-fso`](cli-reference.md#language-subtitles). `-fsl` takes exclusions too: +`-fsl all,-es` keeps every forced subtitle except the Spanish one. With `-fso`, `--s-lang` +and `-fsl` still select the languages. -| Value | Format | -| --- | --- | -| `SRT` / `srt` | SubRip | -| `VTT` / `vtt` | WebVTT | -| `ASS` / `ass` | Advanced SubStation Alpha | -| `SSA` / `ssa` | SubStation Alpha | -| `TTML` / `ttml` | Timed Text Markup | -| `original` | Keep the source format, no conversion | +[`--sub-format`](cli-reference.md#language-subtitles) sets the subtitle format of the output, or +`original` keeps the source format. ```shell title="Convert subtitles to SRT" unshackle dl --sub-format srt EXAMPLE 81234567 @@ -756,15 +685,8 @@ when you want a part on its own. ### Other selection flags -| Flag | Behaviour | -| --- | --- | -| `--select-titles` | Interactively pick 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. | -| `--latest-episodes N` | Download only the N most recent episodes. The newest episodes can come from more than one season. A [split episode](#split-episodes) counts as one episode, and all its parts download. | -| `--max-downloads N` | Stop after N titles have downloaded. A skipped title, or a title already in the completion archive, does not count. With `--skip-dl` or `--no-mux`, a title counts when its run completes. Each part of a [split episode](#split-episodes) counts as one title. unshackle does not open the titles after the limit. | -| `--list-titles` | List every title the service returned, then stop. `-w`, `--latest-episode` and `--latest-episodes` are not applied to this listing. | - -When `--latest-episode` or `--latest-episodes` is set, `-w` has no effect. +[`--select-titles`, `--latest-episode`, `--latest-episodes` and `--max-downloads`](cli-reference.md#title-episode-selection) +also select the episodes to download. ```shell title="Grab just the newest episode" unshackle dl --latest-episode EXAMPLE 81234567 @@ -788,31 +710,9 @@ A season that the limit stops before its last episode gets no `season` post-scri ## Including and excluding track types You can restrict a download to certain track categories, either positively (only these) -or negatively (everything but these). - -**Only these types** (`*-only` flags): - -- `-V` / `--video-only` -- `-A` / `--audio-only` -- `-S` / `--subs-only` -- `-C` / `--chapters-only` - -**Skip these types** (`no-*` flags): - -- `-nv` / `--no-video` -- `-na` / `--no-audio` -- `-ns` / `--no-subs` -- `-nc` / `--no-chapters` -- `-nt` / `--no-attachments` (cover art, subtitle fonts, and files the service attaches) - -Additional track-type flags: - -- `-ad` / `--audio-description`: include descriptive (audio-description) tracks, which - unshackle drops by default. -- `-ado` / `--audio-description-only`: keep only the descriptive tracks and drop the - standard audio. It does not need `-ad`. Add `-A` to download no video or subtitles. -- `--skip-subtitle-errors`: if a subtitle fails to download, skip it and continue rather - than aborting the whole title. Video and audio failures remain fatal. +or negatively (everything but these). The [CLI reference](cli-reference.md#track-type-inclusion-exclusion) +gives the `*-only` and `no-*` flags, `-ad` and `-ado` for descriptive audio, and +`--skip-subtitle-errors`. !!! note "The `-only` kind flags" `-ado` and `-fso` each keep one kind of track inside its track type. They do not drop @@ -848,14 +748,12 @@ unshackle dl -nc EXAMPLE 81234567 ## Listing and dry runs -Before committing to a long download, inspect what unshackle *would* do: - -| Flag | Effect | -| --- | --- | -| `--list` | List the tracks the service exposes for each title, then stop. No selection, no download. | -| `--list-titles` | List every title the service returned, then stop. `-w`, `--latest-episode` and `--latest-episodes` are not applied to this listing. | -| `--skip-dl` | Skip downloading but still acquire the decryption keys. | -| `--all-drm` | License each track with both Widevine and PlayReady. See [Widevine and PlayReady on the same title](drm-and-cdm.md#widevine-and-playready-on-the-same-title). | +Before a long download, check what unshackle would do with +[`--list`](cli-reference.md#concurrency-caching-listing), +[`--list-titles`](cli-reference.md#title-episode-selection) or +[`--skip-dl`](cli-reference.md#drm-keys-decryption). To license +each track with both Widevine and PlayReady, see +[Widevine and PlayReady on the same title](drm-and-cdm.md#widevine-and-playready-on-the-same-title). ```shell title="See the track selection without downloading" unshackle dl -q 1080 -v H.265 -r HDR10 --list EXAMPLE 81234567 @@ -865,10 +763,8 @@ unshackle dl -q 1080 -v H.265 -r HDR10 --list EXAMPLE 81234567 ### Output location and folders -- `-o` / `--output`: override the output directory for this run (otherwise unshackle - uses the configured downloads directory). -- `--no-folder`: do not make a per-show folder for TV downloads. -- `--no-source`: remove the service source tag from the filename and path. +[`-o` / `--output`](cli-reference.md#output-muxing-files) sends one run to another directory, and +`--no-folder` and `--no-source` change the folder and the file name. ```shell title="Send this download somewhere specific" unshackle dl -o ~/Videos/incoming EXAMPLE 81234567 @@ -877,15 +773,8 @@ unshackle dl -o ~/Videos/incoming EXAMPLE 81234567 ### Muxing behaviour By default, `mkvmerge` muxes the tracks of a movie or an episode into a single Matroska -(`.mkv`) file. These flags change how unshackle assembles the output: - -| Flag | Behaviour | Default source | -| --- | --- | --- | -| `--no-mux` | Do not mux; keep the individual track files. | - | -| `--sample` | Download a short sample: 60 seconds from 2 minutes in, or `--sample START-END` for a window in seconds. | - | -| `--include-sample` | Download the full title, then also cut a 60 second sample from each muxed file into a `Sample` folder. | - | -| `--split-audio` | Write a separate output file per audio codec instead of merging all audio. | config `muxing.merge_audio` (on) | -| `--merge-video` | Mux video tracks that share a height, range, and codec into one file, so only language varies inside a file. | config `muxing.merge_video` (off) | +(`.mkv`) file. [`--no-mux`, `--sample`, `--include-sample`, `--split-audio` and +`--merge-video`](cli-reference.md#output-muxing-files) change how unshackle assembles the output. !!! note "`--sample` needs a segmented track" `--sample` downloads only the segments that hold the window, and `mkvmerge` cuts the output @@ -907,7 +796,7 @@ By default, `mkvmerge` muxes the tracks of a movie or an episode into a single M ### After the download -`--postscript ""` runs your own command once per output file, with unshackle's +[`--postscript ""`](cli-reference.md#output-muxing-files) runs your own command once per output file, with unshackle's metadata substituted into `{variable}` placeholders. It is repeatable, and it replaces the `post_scripts` config for that run. No `success` post-script operates under `--no-mux`, because that run writes no muxed output; a song is the exception, because `--no-mux` does not apply to it. @@ -930,8 +819,7 @@ post-scripts and for the full variable list, see ### Naming tags -- `--tag`: set the release group tag (overrides the configured tag). -- `--repack`: add a `REPACK` tag to the output filename. +[`--tag` and `--repack`](cli-reference.md#output-muxing-files) change the tags in the file name. ```shell title="Custom group tag and a REPACK label" unshackle dl --tag MYGRP --repack EXAMPLE 81234567 @@ -939,7 +827,7 @@ unshackle dl --tag MYGRP --repack EXAMPLE 81234567 ## Proxies -`--proxy` accepts a full proxy URI, a country or location code (resolved through your +[`--proxy`](cli-reference.md#network-proxy) accepts a full proxy URI, a country or location code (resolved through your configured proxy providers), or a `provider:region` form. See [Proxies & VPN](proxies-and-vpn.md#how-proxy-resolution-works) for the exact grammar. @@ -950,28 +838,14 @@ unshackle dl --proxy controld:yul EXAMPLE 81234567 unshackle dl --proxy 'http://user:pass@host:8080' EXAMPLE 81234567 ``` -Three related flags: - -- `--no-proxy`: force-disable all proxy use for this run. -- `--no-proxy-download`: bypass the proxy for **all downloads**. The manifest, - license, and authentication requests still go through the proxy. This is useful when you - need the proxy only to satisfy geo-checks, not to move the bulk of the data. -- `--proxy-download`: use a different proxy for **all downloads**. The manifest, - license, and authentication requests still go through `--proxy`. Takes the same forms - as `--proxy`. +[`--no-proxy`, `--no-proxy-download` and `--proxy-download`](cli-reference.md#network-proxy) change +which requests use the proxy. Use `--no-proxy-download` when you need the proxy only to pass +the geo-check of the service, not to move the bulk of the data. ## Performance and caching -| Flag | Purpose | -| --- | --- | -| `--workers N` | Threads used per track for segment downloads. Default depends on the downloader. | -| `--adaptive-workers` | Opt-in: start the per-track worker count at `--workers`, reduce it when the CDN returns errors, then raise it again while the extra workers add measured throughput. The count never goes above `--workers`. Off by default (fixed worker count). | -| `--download-processes N` | Opt-in: split a large segment batch across `N` download processes, each with its own worker pool. A single process tops out around 1.3 Gb/s (Python interpreter limit); `2` reaches 2.5GbE line rate on fast CDNs. Only engages for batches of 24+ segments. Ignored while `--speed-limit` (or serve's `global_speed_limit`) is set: the cap is a per-job budget, which extra processes cannot share, so the download stays in a single process. Also ignored when the service HTTP session carries state a child process cannot rebuild, such as a custom TLS adapter. The download stays in a single process instead of running with the wrong settings. Default `1`. | -| `--continue-downloads` | Opt-in: keep completed segment files when a download fails so the next run resumes instead of restarting from zero. One-off enable of the [`continue_downloads`](../reference/configuration/download.md#continue_downloads) config option, which documents what can and cannot resume. | -| `--downloads N` | Number of tracks downloaded concurrently. Default `1`. | -| `--slow [MIN-MAX]` | Add a delay between titles to look more like a real device. `--slow` alone means 60-120s; `--slow 20-40` sets a custom range. Minimum 20s. | -| `--no-cache` | Bypass the title cache for this download. | -| `--reset-cache` | Clear the title cache before fetching. | +The [concurrency and caching flags](cli-reference.md#concurrency-caching-listing) control the parallel +downloads, the speed limit, the delay between titles and the title cache. ```shell title="Two tracks at a time, eight threads each" unshackle dl --downloads 2 --workers 8 EXAMPLE 81234567 @@ -983,22 +857,19 @@ unshackle dl -w S01 --slow 30-60 EXAMPLE 81234567 ## Keys, vaults, and export -By default, unshackle checks your **key vaults** first and only asks a **CDM** to license -a content key when the vault misses. You can force one side or the other: - -- `--cdm-only`: only use the CDM (skip vaults). Over `--remote`, your own CDM licenses each track, and the run uses neither the server CDM nor the server vault. It needs a local CDM, and a remote session on the server's device fails. -- `--cdm `: use the named CDM device for this run, ignoring the `cdm` config mapping (including its quality and Widevine/PlayReady sub-entries). Over `--remote`, that device licenses the remote session, not the server CDM. -- `--vaults-only`: only use key vaults and never license through the CDM. A missing - content key fails. +By default, unshackle checks your **key vaults** and only asks a **CDM** for a licence +when no vault has the content key; [Keys, vaults, and caching](drm-and-cdm.md#keys-vaults-and-caching) +gives the full order. [`--cdm-only` and `--vaults-only`](cli-reference.md#drm-keys-decryption) force +one side or the other, and `--cdm` selects the CDM device for one run. ```shell title="Fetch keys only, no download" unshackle dl --skip-dl EXAMPLE 81234567 ``` -`--export` writes a `mediaexport` JSON file into the configured exports directory. It holds -the manifest, the DRM init data, the content keys, the KIDs of each track and the title -metadata for each title. For a DASH or ISM title, it also holds the manifest as the service -left it, with the ad periods that the service skips. `unshackle import` reads it to reconstruct +[`--export`](cli-reference.md#drm-keys-decryption) writes an export into the configured exports +directory. It holds the manifest, the DRM init data, the content keys, the KIDs of each track +and the title metadata for each title. For a DASH or ISM title, it also holds the manifest +snapshot: the manifest as the service left it, with the filtered periods that the download skips. `unshackle import` reads it to reconstruct a download later, and gives each track only the content keys for its KIDs. The import uses the saved manifest, so it skips the same periods and does not fetch the manifest again. The importer also reads the older unshackle `version: 2` files and unidl's own export files. @@ -1085,11 +956,11 @@ The [mediaexport](https://github.com/unshackle-dl/mediaexport) package specifies title language, the video track takes the language of the default audio track. When the master playlist gives no audio language either, the import stops with a message. -!!! note "Ad periods a service skipped stay skipped" +!!! note "Filtered periods stay filtered" Some services skip DASH periods, such as ads, by a rule of their own. The export also records the periods the service kept as `content_periods` on each manifest. An import that must fetch the manifest again, because the file has no saved manifest or another tool wrote - it, downloads only those periods, also when the new manifest gives an ad period a new ID. + it, downloads only those periods, also when the new manifest gives a filtered period a new ID. When the new manifest has none of the recorded periods, the import logs a warning and keeps every period. @@ -1103,15 +974,9 @@ of `--tmdb`, `--imdb` and `--tvdb`, and unshackle works the rest out from it. To lookups but keep the IDs you give, set [`disable_metadata`](../reference/configuration/misc.md#external-api-keys) in your config. -| Flag | Example | Purpose | -| --- | --- | --- | -| `--tmdb` | `--tmdb 27205` | Use this TMDB ID instead of an automatic search. Needs `tmdb_api_key`. | -| `--imdb` | `--imdb tt1375666` | Use this IMDb ID instead of an automatic search. Needs no API key. | -| `--tvdb` | `--tvdb 73871` | Use this TVDB ID instead of looking the series up. Needs `tvdb_api_key`. | -| `--anilist` | `--anilist 21` | Use this AniList ID instead of an automatic search. `mal:12345` is also accepted. Needs no API key. | -| `--enrich` | - | Overwrite the show title, year and original language with the external source's. **Requires** one of `--tmdb`, `--imdb`, `--tvdb`, or `--anilist`. | -| `--tvdb-order` | `--tvdb-order dvd` | Renumber episodes to a TVDB season order. Needs `tvdb_api_key`. | -| `-ce` / `--continuous-episodes` | - | Number each season on from the season before it, so season two starts at `S02E05` after four episodes. | +The [CLI reference](cli-reference.md#metadata-tagging) describes `--tmdb`, `--imdb`, `--tvdb`, +`--anilist`, `--enrich`, `--tvdb-order` and `--continuous-episodes`, and the rules for +combining the ID flags. ```shell title="Force the right IMDb match, and keep the service's own naming" unshackle dl --imdb tt1375666 EXAMPLE 81234567 @@ -1166,13 +1031,6 @@ Each ID goes to the providers that read that kind of ID, in Pair it with `--tmdb`, `--imdb` or `--tvdb` when the map has no entry for the title, or a wrong one. An ID that you give always wins over the map. -Give **one** of `--tmdb`, `--imdb` and `--tvdb`. You cannot combine them, because one ID -does the job on its own: unshackle finds the other two from it and writes all three to the -tags. -Passing two is an error rather than a silent choice between them. `--anilist` is the exception -and still pairs with one of the three, which is how you set the western ID of an anime title -yourself. - !!! note "The AniList ID map" An AniList match, from a search or from `--anilist`, has no TMDB, IMDb or TVDB ID. unshackle then looks the AniList ID up in the anime-lists ID map. It downloads the map (about 7 MB) the @@ -1190,12 +1048,6 @@ yourself. numbering, and when the two give different entries, it writes no AniList tag. A TMDB movie ID takes only the AniList entry of that movie. An AniList ID that you give with `--anilist` always wins over the map. -The ID you give must have a metadata provider that can find it, so unshackle makes sure of -that before it downloads anything. `--tmdb` without `tmdb_api_key`, or an ID whose metadata -providers your `metadata_providers` list leaves out, fails immediately with a message naming -what to set. `--imdb` needs no API key, because the `imdb` metadata provider is keyless -and in the default order. - With `--enrich`, the title, year and original language are all replaced with the external source's values, whether or not the service already filled them in. A field the source does not answer with is left alone, and unshackle logs which fields those were, so a metadata provider @@ -1228,8 +1080,8 @@ order the service used, then renumbers the episodes into the order you asked for unshackle dl --tvdb-order dvd EXAMPLE 81234567 ``` -Available orders are `official` (aired), `dvd`, `absolute`, `alternate`, and `regional`. Set -`tvdb_order` in your config to apply one by default. +Set [`tvdb_order`](../reference/configuration/misc.md#external-api-keys) in your config to apply +an order by default. !!! warning "Orders that do not cover the whole series" An order can leave out episodes the service carries. TVDB's `dvd` order does not @@ -1240,7 +1092,7 @@ Available orders are `official` (aired), `dvd`, `absolute`, `alternate`, and `re ### Continuous episode numbers Some anime release groups number each season on from the season before it. With -`--continuous-episodes`, a season two that follows a four-episode season one starts at +[`--continuous-episodes`](cli-reference.md#metadata-tagging), a season two that follows a four-episode season one starts at `S02E05`: ```shell title="Number season two on from season one" @@ -1253,62 +1105,3 @@ Season 0 and episode 0 keep their numbers, and a season that already starts past season before it is not changed. The renumbering runs before `--wanted`, so select episodes by their new numbers, for example `-w S02E05`. A whole-season selection such as `-w S05` matches episodes up to E999 only. - -## Configuration defaults - -You can set every flag on this page as a default in your configuration file so you do not -have to type it each time, and you can scope defaults per service. See -[Configuration file](../getting-started/configuration-file.md) for the `dl:` block and -per-service overrides. - -!!! tip "Explicit flags always win" - A value you pass on the command line (or through an environment variable) always takes - precedence over both the global `dl:` defaults and any per-service `dl:` overrides. - Config only fills in options you did not set explicitly. - -## Quick reference - -A condensed lookup of the most-used options. Use `unshackle dl --help` for the complete, -authoritative list. - -| Flag | Short | Meaning | -| --- | --- | --- | -| `--quality` | `-q` | Target resolution(s), e.g. `1080,720`. | -| `--vcodec` | `-v` | Video codec(s). | -| `--acodec` | `-a` | Audio codec(s). | -| `--range` | `-r` | Colour range(s). Default `SDR`. | -| `--channels` | `-c` | Audio channel layout. | -| `--noatmos` | `-naa` | Exclude Atmos audio. | -| `--lang` | `-l` | Video + audio language(s); default `orig`. `-` excludes, e.g. `all,-es`. | -| `--a-lang` | `-al` | Audio-only language override. `-` excludes. | -| `--v-lang` | `-vl` | Video-only language override. `-` excludes. | -| `--s-lang` | `-sl` | Subtitle language(s); default `all`. `-` excludes, e.g. `all,-es`. | -| `--forced-subs` | `-fs` | Include forced subtitles. | -| `--forced-s-lang` | `-fsl` | Forced subtitle language(s); implies `-fs`. `-` excludes. | -| `--sub-format` | | Output subtitle format. | -| `--sub-font` | | Font for subtitles converted to ASS; implies `--sub-format ASS`. | -| `--wanted` | `-w` | Episode/season range, an air date, or a number of the track list for a music release (`1-5`, `2x3`). | -| `--daily` | | Fill missing air dates from TVDB during `--enrich`. | -| `--select-titles` | | Interactively pick episodes or films. | -| `--latest-episode` | | Only the newest episode. | -| `--latest-episodes N` | | Only the N newest episodes. | -| `--max-downloads N` | | Stop after N downloaded titles. | -| `--video-only` / `--audio-only` / `--subs-only` | `-V` / `-A` / `-S` | Restrict track types. | -| `--no-video` / `--no-audio` / `--no-subs` / `--no-chapters` / `--no-attachments` | `-nv` / `-na` / `-ns` / `-nc` / `-nt` | Skip track types. | -| `--worst` | | Lowest-bitrate video at each requested resolution, or at the lowest resolution if none is set. | -| `--require-audio` | | Audio languages that must exist. The title fails if one is missing. | -| `--require-video` | | Video languages that must exist. The title fails if one is missing. | -| `--best-available` | | Degrade gracefully instead of failing. | -| `--skip-missing` | | Skip a title that misses a required language or track, and continue with the next title. | -| `--output` | `-o` | Output directory for this run. | -| `--split-audio` / `--merge-video` / `--no-mux` | | Muxing behaviour. | -| `--postscript` / `--no-postscript` | | Run a command after each output file, or run none. | -| `--proxy` / `--no-proxy` / `--no-proxy-download` / `--proxy-download` | | Proxy control. | -| `--workers` / `--downloads` / `--slow` | | Concurrency and pacing. | -| `--list` / `--list-titles` / `--skip-dl` | | Dry runs. | -| `--cdm-only` / `--vaults-only` | | Content key source control. | -| `--cdm ` | | Pin one CDM device, bypassing the `cdm` config mapping. | -| `--export` | | Export track info and keys to JSON. | -| `--tmdb` / `--imdb` / `--tvdb` / `--anilist` / `--enrich` | | Metadata overrides. | -| `--tvdb-order` | | Renumber episodes to a TVDB season order. | -| `-ce` / `--continuous-episodes` | | Number each season on from the season before it. | diff --git a/docs/guide/drm-and-cdm.md b/docs/guide/drm-and-cdm.md index d4797fc4..50e6d176 100644 --- a/docs/guide/drm-and-cdm.md +++ b/docs/guide/drm-and-cdm.md @@ -640,24 +640,20 @@ merged file once. The README of each plugin gives its device files, its tools an ## Keys, vaults, and caching -Fetching a license is comparatively slow and, for some services, rate-limited. +Fetching a licence is comparatively slow and, for some services, rate-limited. unshackle therefore resolves each key ID in this order before ever contacting a -license server: +licence server: -1. Keys already known for the current DRM object. -2. An in-process cache of content keys, for the current `dl` run. +1. The content keys that a remote server gives over `--remote`, or that an export holds + for `unshackle import`. +2. The content keys that the run already holds: from the service, or from an earlier track. 3. Your configured [key vaults](vaults.md). -4. Only if still missing, a live license request. +4. Only if still missing, a licence from the CDM. -After a successful license request, unshackle writes the recovered keys back to all -configured vaults, so future downloads can skip the license server. Two flags let you -control this trade-off on the `dl` command: - -| Flag | Effect | -|------|--------| -| `--vaults-only` | Never send a license request; use only cached/vault keys. Fails if a content key is missing. | -| `--cdm-only` | Ignore vaults for sourcing keys and always perform a fresh license request. Over `--remote`, your own CDM licenses each track, and the run uses neither the server CDM nor the server vault. A remote session on the server's device fails, and so does a run with no local CDM. | -| `--cdm ` | Use the named CDM device for this run instead of the one the `cdm` config maps for the service. Over `--remote`, that device licenses the remote session, not the server CDM. | +After a successful licence, unshackle writes the recovered keys back to all +configured vaults, so future downloads can skip the licence server. +[`--vaults-only`, `--cdm-only` and `--cdm`](cli-reference.md#drm-keys-decryption) change +this for one `dl` run. See [key vaults](vaults.md) for how to configure vault backends. @@ -680,7 +676,7 @@ debug_requests: true ## See also -- [Downloading](downloading.md): the `dl` command and its DRM-related flags. +- [CLI reference](cli-reference.md#drm-keys-decryption): the DRM-related flags of the `dl` command. - [Key vaults](vaults.md): caching content keys across downloads. - [Configuration](../reference/configuration/index.md): the full `unshackle.yaml` reference. - [Dependencies](../getting-started/installation.md): installing shaka-packager and mp4decrypt. diff --git a/docs/guide/output-and-naming.md b/docs/guide/output-and-naming.md index f0bbf6ec..1e3cbcbe 100644 --- a/docs/guide/output-and-naming.md +++ b/docs/guide/output-and-naming.md @@ -662,4 +662,4 @@ how the optional (`?`) variables appear and disappear. ## See also - [Configuration File](../getting-started/configuration-file.md): the full `unshackle.yaml` structure. -- [Downloading](downloading.md): the `dl` command and per-run flags like `-o`, `--no-folder`, `--tag`, and `--repack`. +- [CLI reference](cli-reference.md#output-muxing-files): the per-run flags like `-o`, `--no-folder`, `--tag`, and `--repack`. diff --git a/docs/guide/proxies-and-vpn.md b/docs/guide/proxies-and-vpn.md index a306a588..18f17466 100644 --- a/docs/guide/proxies-and-vpn.md +++ b/docs/guide/proxies-and-vpn.md @@ -46,7 +46,7 @@ unshackle dl --proxy nordvpn:us EXAMPLE 81234567 !!! tip "Set a default proxy in config" Like every `dl` flag, you can give `--proxy` a default in your configuration, so you do not have to pass it on every command. See - [Downloading](downloading.md) for how `dl` options and config defaults interact. + the [`dl`](../reference/configuration/download.md#dl) block for how `dl` options and config defaults interact. ### `--no-proxy-download` diff --git a/docs/guide/troubleshooting.md b/docs/guide/troubleshooting.md index f783f27f..e7958266 100644 --- a/docs/guide/troubleshooting.md +++ b/docs/guide/troubleshooting.md @@ -344,7 +344,7 @@ Each command reports how many files it removed and how much space it freed, then !!! example "The wrong titles/metadata keep coming back" **Symptom:** a service returns outdated titles even after the source changed. - **Inspect:** the title cache is likely serving stale data. Clear it with `unshackle env clear cache `, or bypass it for one run using the `dl` no-cache / reset-cache options (see [Downloading](downloading.md) and the [CLI Reference](cli-reference.md#dl)). + **Inspect:** the title cache is likely serving stale data. Clear it with `unshackle env clear cache `, or bypass it for one run using the `dl` no-cache / reset-cache options (see the [CLI Reference](cli-reference.md#concurrency-caching-listing)). !!! example "A config value doesn't seem to apply" **Symptom:** a setting you edited has no effect. diff --git a/docs/reference/configuration/download.md b/docs/reference/configuration/download.md index 0e448ebb..69c2264e 100644 --- a/docs/reference/configuration/download.md +++ b/docs/reference/configuration/download.md @@ -5,8 +5,8 @@ - **Type:** `dict`  ·  **Default:** `{}` Persistent defaults for the `dl` command. unshackle uses the block as Click's `default_map`, -so you can give any `dl` flag a default here. See [Downloading](../../guide/downloading.md) and the -[CLI Reference](../../guide/cli-reference.md) for what each flag does. +so you can give any `dl` flag a default here. See the +[CLI Reference](../../guide/cli-reference.md#dl) for what each flag does. **Config key naming.** A config key is the flag's long name with dashes replaced by underscores (`--best-available` → `best_available`, `--sub-format` → `sub_format`). A few diff --git a/tests/commands/test_dl_cli_reference.py b/tests/commands/test_dl_cli_reference.py new file mode 100644 index 00000000..f55efd75 --- /dev/null +++ b/tests/commands/test_dl_cli_reference.py @@ -0,0 +1,31 @@ +import re +from pathlib import Path + +from unshackle.commands.dl import dl + +CLI_REFERENCE = Path(__file__).parents[2] / "docs" / "guide" / "cli-reference.md" + + +def dl_section_flags() -> set[str]: + """The flags that start a code span in the `dl` section of the CLI reference.""" + text = CLI_REFERENCE.read_text(encoding="utf-8") + start = text.index("## `dl`") + section = text[start : text.index("\n## ", start)] + return set(re.findall(r"`(--?[a-zA-Z][\w-]*)", section)) + + +def dl_option_flags() -> set[str]: + return { + flag + for param in dl.cli.params + if param.param_type_name == "option" and not param.hidden + for flag in (*param.opts, *param.secondary_opts) + } + + +def test_every_dl_option_is_in_the_cli_reference() -> None: + assert dl_option_flags() - dl_section_flags() == set() + + +def test_every_long_flag_in_the_cli_reference_is_a_dl_option() -> None: + assert {flag for flag in dl_section_flags() if flag.startswith("--")} - dl_option_flags() == set() diff --git a/unshackle/commands/dl.py b/unshackle/commands/dl.py index a71231bd..b639177a 100644 --- a/unshackle/commands/dl.py +++ b/unshackle/commands/dl.py @@ -1013,20 +1013,20 @@ class dl: default=None, help="Add a delay between each Title download to act more like a real device. " "Use --slow for a 60-120s delay, or --slow MIN-MAX (e.g., --slow 20-40) for a custom range. " - "Minimum delay is 20 seconds.", + "MIN must be at least 5 seconds.", ) @click.option( "--list", "list_", is_flag=True, default=False, - help="Skip downloading and list available tracks and what tracks would have been downloaded.", + help="List every track of each title, then stop before track selection.", ) @click.option( "--list-titles", is_flag=True, default=False, - help="Skip downloading, only list available titles that would have been downloaded.", + help="List every title the service returned, then stop. -w and --latest-episode(s) do not apply.", ) @click.option( "--skip-dl", is_flag=True, default=False, help="Skip downloading while still retrieving the decryption keys." @@ -1077,7 +1077,12 @@ class dl: default=None, help="Proxy for the downloads only, in the same form as --proxy. Manifest, license, and auth use --proxy.", ) - @click.option("--no-folder", is_flag=True, default=False, help="Disable folder creation for TV Shows.") + @click.option( + "--no-folder", + is_flag=True, + default=False, + help="Write the files directly in the output directory, with no title folder.", + ) @click.option( "--no-source", is_flag=True, default=False, help="Disable the source tag from the output file name and path." ) diff --git a/unshackle/commands/kv.py b/unshackle/commands/kv.py index 57f45d4c..815f3aaa 100644 --- a/unshackle/commands/kv.py +++ b/unshackle/commands/kv.py @@ -377,7 +377,7 @@ def search(kid: str, service: str | None, vault_name: str | None) -> None: """ Examine configured Key Vault(s) for a KID and report the content key it finds. - KID must be 32 hex characters (no dashes). If you do not give --service, + KID must be 32 hex characters; unshackle removes dashes. If you do not give --service, unshackle scans every service table in each vault. For a vault that cannot show its tables, unshackle probes every locally installed service tag instead, so --service is much faster. If you do not give --vault, unshackle diff --git a/unshackle/core/api/routes.py b/unshackle/core/api/routes.py index be3b2b34..f5303f6c 100644 --- a/unshackle/core/api/routes.py +++ b/unshackle/core/api/routes.py @@ -1307,7 +1307,8 @@ async def download(request: web.Request) -> web.Response: type: boolean default: false description: >- - Make no folder for a series. + Write the files directly in the output directory, with no folder for the title, for every kind of + title. no_source: type: boolean default: false