feat(dl): add --max-downloads to stop a run after N downloaded titles

This commit is contained in:
imSp4rky
2026-12-04 12:33:18 -07:00
parent 516ae82f4d
commit 8e850d168e
10 changed files with 119 additions and 2 deletions
+1
View File
@@ -128,6 +128,7 @@ unshackle honours the special language tokens `orig`, `all`, and `best` everywhe
| `--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. |
### Track-type inclusion / exclusion
+13
View File
@@ -761,6 +761,7 @@ when you want a part on its own.
| `--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.
@@ -773,6 +774,17 @@ unshackle dl --latest-episode EXAMPLE 81234567
unshackle dl --latest-episodes 3 EXAMPLE 81234567
```
`--latest-episodes` takes the newest episodes. `--max-downloads` takes the first episodes in order.
With `--skip-existing`, it takes the next episodes that the
[completion archive](../reference/configuration/download.md#completion-archive) does not have, so
the same command can run each day:
```shell title="Grab the next two episodes not downloaded yet"
unshackle dl --skip-existing --max-downloads 2 -w S01 EXAMPLE 81234567
```
A season that the limit stops before its last episode gets no `season` post-script event.
## Including and excluding track types
You can restrict a download to certain track categories, either positively (only these)
@@ -1280,6 +1292,7 @@ authoritative list.
| `--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. |