Skip to content

Server-backed series monitors, quality for season downloads, and preparation progress #466

Open

Description

@Quick104

Silo-Server/silo-server#1880 lets season, series, and monitored-series downloads use a bitrate preset instead of always coming in original quality. It also reports how far along the server is with each download it still has to prepare. The iOS client ships all of it in Silo-Server/silo-apple#597. The phone app is behind on four points:

  • A series download is forced to Original (DownloadEnqueuer.startSeries), and the UI has no season download. startSeason exists but nothing calls it.
  • Monitors are local only. DownloadSubscription lives in Room and DownloadSubscriptionWorker evaluates it on the device. Nothing uses the server's monitor API, and no screen creates a monitor, so MonitoredDownloadsCard stays empty.
  • A preparing download shows "Preparing…" with no queue position or progress, and nothing re-reads the list. DownloadWorker retries /file on 409 every 30 seconds for 30 attempts and then fails the download. A bitrate season queues one encode per episode and the server runs 2 at a time by default, so later episodes can wait longer than that.
  • The quality picker only appears for a single download.

Android TV has no downloads today, so this issue covers the phone app.

What the server adds

All of it is additive and gated by flags on GET /api/v2/capabilities/downloads. The contract is docs/downloads-api.md in silo-server, §3, §4.1, §4.2, §5, and §8.

  • bulk_quality: POST /api/v2/downloads with series: true accepts any value in quality_presets. Add season_number for one season.

    • The server resolves the preset per episode. Prepared episodes start preparing.
    • An episode the preset can't be prepared for, such as a 4K source when 4K transcoding is off, is listed in skipped with the new reason quality_unavailable. The rest of the batch still registers.
    • Keep quality unchanged while following page.next_cursor.
    • Without the flag, send original. Anything else gets 501 bulk_quality_unavailable.
  • monitor_quality: monitors (/api/v2/downloads/subscriptions, §8) gain a quality field, default original, on create, PATCH, and every read.

    • New episodes register in the monitor's quality. Downloads already registered keep theirs.
    • The server checks a changed quality against the account's transcode permission. A quality sent unchanged isn't re-checked.
    • Without the flag, the field is absent and monitors download originals.
  • preparation_progress: each preparing entry in GET /api/v2/downloads carries preparation:

    preparation is absent when progress can't be read; show a plain preparing state then. Each server node refreshes these values at most every 5 seconds.

Monitors themselves predate #1880: create, list, PATCH/DELETE with If-Match, and bounded sync, gated by series_monitoring, subscription_reads, subscription_mutations, and bounded_subscription_sync. They are device-scoped.

Work

Capability and models:

  • Decode bulk_quality, monitor_quality, preparation_progress, subscription_reads, subscription_mutations, and bounded_subscription_sync on DownloadCapability. Decode preparation on the download entry, quality on the server monitor, and the quality_unavailable skip reason. An unknown preparation.state must still decode and show as a plain preparing state.

Season and series downloads:

  • Add a season download, sent as one series: true batch with season_number, in place of the per-episode loop in startSeason.
  • Offer the quality picker for season and series downloads when bulk_quality is set, starting from the default in Settings.
  • Handle 429 rate_limited on a batch. The server checks a season against the account's concurrent download limit as a whole, and prepared rows count toward it until they're ready. With the default limit of 3, an 8-episode season is refused outright.

Monitors on the server:

  • Replace the Room monitors with server monitors when subscription_mutations is set:
    • Create, edit, pause, and stop through /api/v2/downloads/subscriptions.
    • Call POST /api/v2/downloads/subscriptions/sync after a create, resume, or widening edit, on app open, and from the periodic worker. Follow page.next_cursor until page.has_more is false.
    • Then re-read GET /api/v2/downloads and enqueue the newly registered rows.
    • Enforce delete_watched and max_storage_bytes on the device (§11.8).
    • Decide what happens to existing Room monitors: migrate the series ones, or drop them, since users can't create them today.
  • Offer a quality on create and edit when monitor_quality is set.
    • Prefill an existing monitor's stored quality, even if it's no longer in quality_presets.
    • On PATCH, send quality only when it changed, and leave out an unchanged mode. The server re-validates whatever it receives, so resending stored values can fail after a permission change.
  • Never offer a quality the server doesn't list. When quality_presets changes after a profile switch or permission change, reset a one-time or new-monitor choice to the Settings default.

Preparation progress:

  • Show preparation on each preparing row in the Downloads tab and on the item page, with the iOS wording:
    • queued: "Waiting to prepare · next in line" or "Waiting to prepare · 3rd in line". Without a position: "Waiting to prepare".
    • running: "Preparing · 35% · 6 min left" with a progress ring. Under a minute: "under a minute left". Over an hour: "1 hr 5 min left". Before progress arrives: "Preparing on server…".
    • retrying: "Preparing · trying again soon".
    • paused: "Preparation paused on the server".
  • While any download is preparing, re-read GET /api/v2/downloads every 15 seconds and stop when none is. iOS does this app-wide; the same read moves rows to ready.
  • Expect progress to arrive in bursts. On a source with many subtitle tracks, a running encode can report the same fraction for minutes while remaining_seconds grows, then jump. Don't read a frozen value as a failure.
  • Don't fail a download because its file is still preparing. Wait for the listed status to reach ready or failed instead of giving up after a fixed number of /file retries.
  • Give rows that a monitor sync registered a title before their file is ready. They have no local sidecar. iOS reads their offline manifests (§4.6), at most 4 at a time, as soon as they're listed, and retries failures with backoff from 15 seconds to 5 minutes.

UI, following iOS:

  • Replace the series page's "Download episode / Download series" menu with one Download action that opens a sheet with two tabs:
    • One Time: this episode, this season, or all episodes, plus Quality.
    • Monitor: All Episodes, Future Episodes, or Last Season (only modes in monitoring_modes), plus Quality, Delete after watching, and Storage limit. The button reads "Start Monitoring", or "Save" for an existing monitor, which also offers Stop Monitoring. Keep an existing monitor's rule listed even if the server stops advertising it, and keep the storage limit in bytes so a limit another client wrote survives an edit.
  • Show a banner on a monitored series' page with the monitor's status, for example "Preparing Episode 1 · Future episodes · 2 Mbps".
  • Replace MonitoredDownloadsCard with a Monitored row in the Downloads tab that opens the list of monitored series. Each shows its rule, quality, and status: paused, at its storage limit, downloading, waiting and why, next episode and air date, up to date, or "Monitoring" when the airing calendar hasn't loaded and nothing is in flight.
  • Settings: the quality footer says the setting is the default for every download and monitor and that the Download sheet can change it. When only bulk_quality is set, it says monitors download originals.
  • Tests: decoding with and without each flag and field, the status-line wording, resetting a quality the server no longer lists, not sending an unchanged monitor quality or rule, and monitor sync paging.

References

The evidence page has the iOS screens against a server running #1880: the Download sheet with season and monitor quality, the limit error, preparing rows with queue positions, progress and a paused job, the monitor banner, the Monitored list, and the Settings footer.

Evidence: https://evidence.siloserver.org/r/silo-apple/downloads-monitoring-quality/

AI disclosure

Drafted with Claude Code (claude-opus-5-5[1m]) from the server contract, the iOS implementation, a read of silo-android main at 844ff74, and the captures on the evidence page.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions