Skip to content

feat(downloads): random episode selection + Custom Amount (Any)#1199

Open
Darkmadda wants to merge 6 commits into
edde746:mainfrom
Darkmadda:feat/download_random_episodes
Open

feat(downloads): random episode selection + Custom Amount (Any)#1199
Darkmadda wants to merge 6 commits into
edde746:mainfrom
Darkmadda:feat/download_random_episodes

Conversation

@Darkmadda

Copy link
Copy Markdown
Contributor

Summary

Adds the ability to download/sync random episodes of TV shows, and splits "Custom amount" into (Unwatched) and (Any) variants.

Changes

Random episodes toggle

  • A sticky "Random episodes" switch is pinned atop the show/season download-options dialog (showOptionPickerDialog gained an optional toggle header). Flipping it doesn't dismiss the dialog.
  • When enabled, the count-limited options — Next 5, Next 10, Custom Amount (Unwatched), Custom Amount (Any) — fill their quota with randomly chosen episodes instead of release order. It's a no-op for "All episodes" / "Unwatched only" (no quota to randomize).

Custom Amount split

  • Renamed "Custom amount" → Custom Amount (Unwatched).
  • Added Custom Amount (Any) below it — same count dialog, but includes watched episodes (filter = all).

Sync persistence

  • Both Custom variants and the random flag persist into keep-synced rules. Show/season sync rules now honor downloadFilter (previously hardcoded to unwatched) and a new randomEpisodes flag.
  • Keep-synced is now offered for every show choice except "All episodes" (including Custom Amount (Any)).

Correctness / no churn

  • Random fills only the deficit and never re-randomizes already-downloaded episodes, so repeated reconciles don't thrash.
  • "Any" rules (downloadFilter == 'all') are exempted from the watched-auto-delete cleanup — their watched episodes are retained rather than deleted and re-downloaded.

Database

  • Schema v16 adds SyncRules.randomEpisodes (bool, default false) via the standard additive migration. Existing rules keep their current in-order, unwatched behavior. downloadFilter already existed (default 'unwatched'), so honoring it for show/season rules is backward-compatible.

i18n

  • New base-locale strings: downloads.randomEpisodes, downloads.customAmountUnwatched, downloads.customAmountAny (replacing the now-unused customAmount). Other locales fall back to base.

Testing

Sync-rule executor test suite passes; analyzer clean. Verified manually: random Next-N queues a random unwatched subset; Custom Amount (Any) grabs N random episodes incl. watched; a synced random-unwatched rule refills with new random episodes after watching; a synced (Any) rule's watched episodes survive the cleanup; non-random and existing rules are unchanged after migration.

🤖 Generated with Claude Code

Darkmadda and others added 6 commits May 30, 2026 01:45
Add a "Random episodes" toggle to the show/season download-options dialog. When enabled, the count-limited options (Next 5, Next 10, Custom Amount) fill their quota with randomly chosen episodes instead of release order. The toggle is a sticky switch pinned atop the dialog (it does not dismiss on flip).

Split "Custom amount" into Custom Amount (Unwatched) and a new Custom Amount (Any). The (Any) variant uses the same count dialog but includes watched episodes too. Both Custom variants, and random, persist into keep-synced rules: show/season sync rules now honor downloadFilter (previously hardcoded unwatched) and a new randomEpisodes flag.

Random fills only the deficit and never re-randomizes existing downloads, so reconciles do not thrash. "Any" rules (downloadFilter=all) are exempted from the watched-auto-delete cleanup so their watched episodes are retained instead of deleted-and-redownloaded.

Schema v16 adds SyncRules.randomEpisodes (default false); existing rules keep in-order, unwatched behavior. New i18n strings added to the base locale (others fall back).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ownload_random_episodes

# Conflicts:
#	lib/utils/download_utils.dart
…nload_random_episodes

# Conflicts:
#	lib/i18n/strings.g.dart
#	lib/services/sync_rule_executor.dart
#	lib/utils/download_utils.dart
…nload_random_episodes

# Conflicts:
#	lib/i18n/strings.g.dart
#	lib/i18n/strings_en.g.dart
# Conflicts:
#	lib/i18n/strings.g.dart
#	lib/i18n/strings_en.g.dart
…ownload_random_episodes

# Conflicts:
#	lib/i18n/strings.g.dart
#	lib/i18n/strings_en.g.dart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants