From f7a38732f189202772dce3a6167cfa34efae4565 Mon Sep 17 00:00:00 2001 From: imSp4rky Date: Tue, 28 Jul 2026 21:22:14 -0600 Subject: [PATCH] feat(dl): extend --select-titles to movie listings --- docs/guide/cli-reference.md | 2 +- docs/guide/downloading.md | 4 ++-- unshackle/commands/dl.py | 24 +++++++++++++++++++++++- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/docs/guide/cli-reference.md b/docs/guide/cli-reference.md index a0571a07..c19c9424 100644 --- a/docs/guide/cli-reference.md +++ b/docs/guide/cli-reference.md @@ -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. | diff --git a/docs/guide/downloading.md b/docs/guide/downloading.md index 98cc3f95..1086e706 100644 --- a/docs/guide/downloading.md +++ b/docs/guide/downloading.md @@ -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. | diff --git a/unshackle/commands/dl.py b/unshackle/commands/dl.py index 83ed073d..3695160f 100644 --- a/unshackle/commands/dl.py +++ b/unshackle/commands/dl.py @@ -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)))