fix(qt): play a downloaded album from Local Library through the offline tier

A CMAF download's `local_tracks.file_path` is the BUNDLE DIRECTORY
(`tracks-cmaf/<qobuz_id>/`, holding `init.mp4` and an encrypted
`segments.bin`), not a playable container. `LocalSource::playback` handed
it back as a `PlaybackTicket::File`, the read failed with EISDIR, and the
audible step reported it as

  audible: file not available at …/tracks-cmaf/266725026 (drive unmounted?)

— a message about a drive, for a bundle sitting on the local disk. The bar
adopted the track anyway, so the album looked like it was playing and no
audio came out.

Three funnels reach the audible step and only two excluded an offline row:
`play_current_if_local` (auto-advance) and
`playback_qt::play_resolved_offline_aware`. The Local Library PLAY funnel
did not, nor did its hand-copy in `local_album_actions`. Only qbz-core's
offline tier can decrypt the bundle, and the row carries the real Qobuz
catalog id precisely so that tier can be asked for it.

- `local_playback::play_audible` is now the ONLY copy of the audible step
  and routes an offline row to the offline tier; `local_album_actions`
  drops its copy and calls it.
- `LocalSource::playback` refuses an offline row with `BadIdShape` instead
  of emitting a ticket that lies. The test is on the row data, never
  `is_dir()`: a stat there would block for the mount timeout on the
  unreachable share the audible step's bounded probe exists to survive.
- Tests run the row through the real `local_queue_track`, because the two
  halves that must agree are its source word and the badge the router reads.

Verified by driving the window: album play, track-row play and skip-next all
log `[Core] track ... served from OFFLINE cache` and decode at 44.1 kHz /
24-bit; a plain user-file album still plays through the local audible step at
96 kHz / 24-bit. qbz-qt 431/431, qbz-source 91/91.

cc
This commit is contained in:
vicrodh committed 2026-08-20 18:16:33 -06:00
1 parent 900517db57
commit 8c3514b899
3 files changed
+122 -22

No files matched your search

+27
View File
@@ -722,6 +722,33 @@ impl Source for LocalSource {
why: "a normalised local track id is always numeric",
})?;
let row = self.track_row(row_id).ok_or_else(|| self.not_found(item))?;
// An OFFLINE row is recognised here and REFUSED here, which is the
// discipline `BadIdShape` exists for: say no at the moment of the
// mistake instead of forwarding a shape that fails two layers down.
//
// A CMAF download's `local_tracks.file_path` is the BUNDLE DIRECTORY
// (`…/audio/tracks-cmaf/<qobuz_id>/`, holding `init.mp4` and an
// AES-encrypted `segments.bin`), not a playable container. Returned as
// a `File` ticket it reached `std::fs::read`, which reported it as
//
// audible: file not available at …/tracks-cmaf/266725026 (drive unmounted?)
//
// — a message about a drive, for a bundle sitting on the local disk.
// Only `qbz-core`'s offline tier can decrypt it, and it is asked for by
// the QOBUZ catalog id the row carries in `QueueTrack.id`, not by this
// row id. NO fs call is made to decide this: a `is_dir()` here would
// block for the mount timeout on exactly the unreachable share the
// audible step's bounded probe exists to survive.
if SourceBadge::from_word(row.source.as_deref()) == SourceBadge::Offline {
return Err(SourceError::BadIdShape {
by: SourceId::LOCAL,
id: item.id().to_string(),
why: "an offline (qobuz_download) row is a CMAF bundle only qbz-core's offline \
tier can read — play it by its Qobuz catalog id, not as a local file",
});
}
let path = PathBuf::from(&row.file_path);
// The player keys on the QUEUE's id, which is what every caller passes