mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-12 03:55:05 +00:00
feat(dl): extend --select-titles to movie listings
This commit is contained in:
@@ -106,7 +106,7 @@ The special language tokens `orig`, `all`, and `best` are honoured everywhere a
|
||||
| Flag | Description |
|
||||
|---|---|
|
||||
| `-w`, `--wanted` | Wanted episodes, e.g. `S01-S05,S07`, `S01E01-S02E03`. Supports exclusions with a leading `-` (e.g. `-S03`). |
|
||||
| `--select-titles` | Interactively select titles (series only). **Cannot combine with `-w`.** |
|
||||
| `--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. |
|
||||
| `--list-titles` | List titles only; do not download. |
|
||||
|
||||
|
||||
@@ -349,7 +349,7 @@ with `-` to exclude it.
|
||||
|
||||
| Flag | Behaviour |
|
||||
| --- | --- |
|
||||
| `--select-titles` | Interactively pick episodes from a list (Series only). **Cannot combine with `-w`.** |
|
||||
| `--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. |
|
||||
| `--list-titles` | List every title the service returned, then stop. `-w`/`--latest-episode` are not applied to this listing. |
|
||||
|
||||
@@ -558,7 +558,7 @@ authoritative list.
|
||||
| `--forced-subs` | `-fs` | Include forced subtitles. |
|
||||
| `--sub-format` | | Output subtitle format. |
|
||||
| `--wanted` | `-w` | Episode/season range. |
|
||||
| `--select-titles` | | Interactively pick episodes. |
|
||||
| `--select-titles` | | Interactively pick episodes or films. |
|
||||
| `--latest-episode` | | Only the newest episode. |
|
||||
| `--video-only` / `--audio-only` / `--subs-only` | `-V` / `-A` / `-S` | Restrict track types. |
|
||||
| `--no-video` / `--no-audio` / `--no-subs` / `--no-chapters` | `-nv` / `-na` / `-ns` / `-nc` | Skip track types. |
|
||||
|
||||
@@ -503,7 +503,7 @@ class dl:
|
||||
"--select-titles",
|
||||
is_flag=True,
|
||||
default=False,
|
||||
help="Interactively select downloads from a list. Only use with Series to select Episodes.",
|
||||
help="Interactively select downloads from a list: episodes of a series, or films when a title has more than one.",
|
||||
)
|
||||
@click.option(
|
||||
"-w",
|
||||
@@ -1517,6 +1517,28 @@ class dl:
|
||||
if music_titles and list_:
|
||||
return
|
||||
|
||||
if select_titles and isinstance(titles, Movies) and len(titles) > 1:
|
||||
console.print(Padding(Rule("[rule.text]Select Titles"), (1, 2)))
|
||||
|
||||
selection_start = time.time()
|
||||
selected_idx = select_multiple(
|
||||
[str(movie) for movie in titles],
|
||||
minimal_count=1,
|
||||
page_size=8,
|
||||
return_indices=True,
|
||||
)
|
||||
if not selected_idx:
|
||||
console.print(Padding(":x: Selection Cancelled...", (0, 5, 1, 5)))
|
||||
return
|
||||
start_time += time.time() - selection_start
|
||||
|
||||
keep = set(selected_idx)
|
||||
for i in range(len(titles) - 1, -1, -1):
|
||||
if i not in keep:
|
||||
del titles[i]
|
||||
|
||||
console.print(Padding(f"[text]Total selected: {len(titles)}[/]", (0, 5)))
|
||||
|
||||
# Enables manual selection for Series when --select-titles is set
|
||||
if select_titles and isinstance(titles, Series):
|
||||
console.print(Padding(Rule("[rule.text]Select Titles"), (1, 2)))
|
||||
|
||||
Reference in New Issue
Block a user