1
Fork 0
mirror of https://github.com/thegeneralist01/archivr synced 2026-07-22 03:05:32 +02:00

fix(core): playlist total size includes children; per_item_quality as include-set

archive.rs: total_artifact_bytes for root entries now adds a correlated
subquery summing children's blob bytes so playlist/channel containers
show the real download size instead of 0.

capture.rs: non-empty per_item_quality map now acts as an include-set —
items whose yt-dlp ID is absent are skipped entirely. This wires the
UI's per-video delete button to actual capture exclusion. Empty map
preserves the existing behaviour (download everything).

routes.rs + capture.rs doc: comments updated to reflect both semantics
(empty = all / non-empty = only listed IDs) accurately.
This commit is contained in:
TheGeneralist 2026-07-21 13:18:27 +02:00
parent cca4742f89
commit e2f50a9856
Signed by: thegeneralist01
SSH key fingerprint: SHA256:pp9qddbCNmVNoSjevdvQvM5z0DHN7LTa8qBMbcMq/R4
3 changed files with 24 additions and 10 deletions

View file

@ -872,13 +872,14 @@ async fn capture_handler(
)));
}
}
// NOTE: the server does not enforce that every playlist item has a per_item_quality
// entry. Items without an override receive the global `quality` value, which
// yt-dlp applies as a format-selector cap (e.g. bestvideo[height<=1080]) and
// falls back gracefully to the best available format below that cap. The
// "must choose quality for unsupported videos" invariant is enforced by the
// per_item_quality semantics (enforced in capture.rs):
// - Absent or empty map: all playlist items are downloaded; quality is the
// global `quality` field applied as a yt-dlp cap with graceful fallback.
// - Non-empty map: ONLY items whose yt-dlp ID appears as a key are downloaded;
// absent IDs are skipped. This is how the frontend's delete-item button works.
// The "must choose quality for unsupported videos" invariant is enforced by the
// frontend before submission; a direct API caller bypassing the UI accepts
// yt-dlp's standard cap-and-fallback behavior.
// yt-dlp's standard cap-and-fallback behavior for items it includes.
let mounted = mounted_archive(&state, &archive_id)?;
let archive_paths =
archive::read_archive_paths(&mounted.archive_path).map_err(ApiError::from)?;