Add-to-playlist (Slices 0-3): - qbz-core: check_playlist_duplicates + pure compute_playlist_duplicates (reuses qbz_models::PlaylistDuplicateResult) + unit tests. - PlaylistDuplicateConfirmModal (Add all / Add new only / Cancel); the duplicate check runs on the Qobuz->Qobuz picker branch only (local/Plex add directly, mirroring Tauri); the track-id Vec lives Rust-side in a stash, never in Slint. - Inline create-and-add in the picker (online create_playlist, offline -> local playlist per D8) + client-side filter (Slint 1.16 has no string contains, routed through a Rust callback) + success toasts. Playlist importer (1:1 Tauri port): - New headless crate qbz-playlist-import (Spotify/Apple/Tidal/Deezer scrapers, Qobuz matcher, importer, progress sink, shared http client; copy-not-move from src-tauri, zero tauri deps; 40 unit tests green). - PlaylistImportModal (two-step fetch-preview -> import with live progress bar / log / summary) + controller + sidebar PLAYLISTS menu entry point. Reco logging staged behind TODO(reco-v1) markers (golden rule: playlist recommendations ship in Slint v1 once the reco engine is extracted to a shared crate). cc
73 lines
1.8 KiB
Rust
73 lines
1.8 KiB
Rust
//! Data models for playlist import
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
|
pub enum ImportProvider {
|
|
Spotify,
|
|
AppleMusic,
|
|
Tidal,
|
|
Deezer,
|
|
}
|
|
|
|
impl ImportProvider {
|
|
pub fn as_str(&self) -> &'static str {
|
|
match self {
|
|
ImportProvider::Spotify => "spotify",
|
|
ImportProvider::AppleMusic => "apple_music",
|
|
ImportProvider::Tidal => "tidal",
|
|
ImportProvider::Deezer => "deezer",
|
|
}
|
|
}
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct ImportTrack {
|
|
pub title: String,
|
|
pub artist: String,
|
|
pub album: Option<String>,
|
|
pub duration_ms: Option<u64>,
|
|
pub isrc: Option<String>,
|
|
pub provider_id: Option<String>,
|
|
pub provider_url: Option<String>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct ImportPlaylist {
|
|
pub provider: ImportProvider,
|
|
pub provider_id: String,
|
|
pub name: String,
|
|
pub description: Option<String>,
|
|
pub tracks: Vec<ImportTrack>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct TrackMatch {
|
|
pub source: ImportTrack,
|
|
pub qobuz_track_id: Option<u64>,
|
|
pub qobuz_title: Option<String>,
|
|
pub qobuz_artist: Option<String>,
|
|
pub score: f32,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct ImportSummary {
|
|
pub provider: ImportProvider,
|
|
pub playlist_name: String,
|
|
pub total_tracks: u32,
|
|
pub matched_tracks: u32,
|
|
pub skipped_tracks: u32,
|
|
pub qobuz_playlist_ids: Vec<u64>,
|
|
pub parts_created: u32,
|
|
pub matches: Vec<TrackMatch>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct ImportProgress {
|
|
pub phase: String,
|
|
pub current: u32,
|
|
pub total: u32,
|
|
pub matched_so_far: u32,
|
|
pub current_track: Option<String>,
|
|
}
|