refactor(frontend): retire Slint application
cx
This commit is contained in:
720 files changed
+93
-273809
No files matched your search
@@ -1012,84 +1012,6 @@ pub async fn download_purchase_track(
|
||||
Ok(file_path)
|
||||
}
|
||||
|
||||
/// Download-ONLY variant of the single-track primitive: identical CDN fetch +
|
||||
/// `.part`→rename pipeline as `download_purchase_track`, but it does **NOT**
|
||||
/// write the `downloaded_purchases` registry. Returns the final on-disk path.
|
||||
///
|
||||
/// **This function's original rationale was WRONG, and it is kept only because
|
||||
/// `qbz-slint` calls it.** New code must not use it. Verified against the
|
||||
/// reference on 2026-08-16:
|
||||
///
|
||||
/// The comment here used to claim that Svelte's `executeAlbumDownload` marks a
|
||||
/// track `'complete'` first and then writes the registry as a best-effort step
|
||||
/// that swallows failure, and therefore that an album-path registry failure
|
||||
/// leaves the track `'complete'` but unregistered. That misreads the reference.
|
||||
/// `executeAlbumDownload` awaits `downloadTrack`, which invokes
|
||||
/// `v2_purchases_download_track` — and THAT command writes the registry itself
|
||||
/// and propagates the error with `?` (`legacy_compat.rs:3019-3021`). So a
|
||||
/// registry failure throws out of `downloadTrack`, is caught by the loop's
|
||||
/// `catch`, and the track is marked **`'failed'`**, exactly as on the
|
||||
/// single-track path. The `markTrackDownloaded(...).catch(() => {})` that follows
|
||||
/// (`purchaseDownloadStore.ts:147`) is a SECOND, backfill-only write whose sole
|
||||
/// effect is filling the `album_id` column; its swallowed failure costs that
|
||||
/// column and nothing else.
|
||||
///
|
||||
/// Consequence: this "write the file, register separately" split has no basis in
|
||||
/// the reference, and the Slint controller's use of it is the one silent
|
||||
/// divergence in the purchases port — it leaves files on disk with no registry
|
||||
/// row while reporting success. The Qt controller uses
|
||||
/// `download_purchase_track` with `Some(album_id)` instead, which registers
|
||||
/// inside the same call and propagates.
|
||||
///
|
||||
/// Addendum B.2 (extension from RESPONSE, registry/qualityDir from REQUESTED),
|
||||
/// B.3 (silent overwrite), and B.5 (restrictions ignored) hold identically to
|
||||
/// `download_purchase_track`.
|
||||
pub async fn download_purchase_track_file_only(
|
||||
client: &QobuzClient,
|
||||
track_id: u64,
|
||||
format_id: u32,
|
||||
destination: &str,
|
||||
quality_dir: &str,
|
||||
) -> Result<String, String> {
|
||||
// UNSIGNED on the purchase path (contract §11-6): the vendor's own desktop
|
||||
// client sends `/track/get` without a signature, and so did the reference.
|
||||
// The entitlement proof is the signature on `getFileUrl` below, which is
|
||||
// untouched.
|
||||
let track = client
|
||||
.get_track_for_purchase(track_id)
|
||||
.await
|
||||
.map_err(|e| format!("Failed to fetch track {}: {}", track_id, e))?;
|
||||
let stream = client
|
||||
.get_track_file_url_by_format(track_id, format_id)
|
||||
.await
|
||||
.map_err(|e| format!("Failed to get download URL for track {}: {}", track_id, e))?;
|
||||
|
||||
let data = QobuzClient::download_audio(&stream.url).await?;
|
||||
|
||||
let artist_name = track
|
||||
.performer
|
||||
.as_ref()
|
||||
.map(|artist| artist.name.clone())
|
||||
.unwrap_or_else(|| "Unknown Artist".to_string());
|
||||
let album_title = track
|
||||
.album
|
||||
.as_ref()
|
||||
.map(|album| album.title.clone())
|
||||
.unwrap_or_else(|| "Singles".to_string());
|
||||
|
||||
write_track_file(
|
||||
&data,
|
||||
&artist_name,
|
||||
&album_title,
|
||||
quality_dir,
|
||||
track.track_number,
|
||||
&track.title,
|
||||
stream.format_id,
|
||||
&stream.mime_type,
|
||||
destination,
|
||||
)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
Reference in new issue
Block a user