1
Fork 0
mirror of https://github.com/thegeneralist01/archivr synced 2026-07-21 18:55:36 +02:00

fix(core): ignore per_item_quality for YTM playlist items

YouTube Music playlists force child_quality = Some("audio") because
yt-dlp can't download DRM-free audio-only tracks any other way. The
previous per_item_quality lookup could override this with e.g. "best",
defeating the invariant. Guard the lookup behind !is_audio so YTM items
are always downloaded as audio regardless of what the caller sends.
This commit is contained in:
TheGeneralist 2026-07-20 22:47:37 +02:00
parent 7499deeab0
commit 0ea61a29a1
Signed by: thegeneralist01
SSH key fingerprint: SHA256:pp9qddbCNmVNoSjevdvQvM5z0DHN7LTa8qBMbcMq/R4

View file

@ -1176,12 +1176,19 @@ pub fn perform_capture(
None => playlist_item.title.clone(),
};
// Per-item quality override keyed by yt-dlp video ID; fall back to playlist-level.
let effective_child_quality: Option<&str> = config
.per_item_quality
.get(&playlist_item.id)
.map(String::as_str)
.or(child_quality);
// Per-item quality override keyed by yt-dlp video ID; fall back to
// playlist-level quality. YTM playlists are always audio-only —
// per_item_quality overrides are ignored so the audio-only guarantee
// cannot be bypassed by a caller sending e.g. "best".
let effective_child_quality: Option<&str> = if is_audio {
Some("audio")
} else {
config
.per_item_quality
.get(&playlist_item.id)
.map(String::as_str)
.or(child_quality)
};
// Download the media.
match downloader::ytdlp::download(