Merge pull request #85 from vicrodh/pre-release

[pull] pre-release from vicrodh:pre-release
This commit is contained in:
Afonso Jorge Ramos authored and GitHub committed 2026-07-31 10:15:40 +02:00
commit 3ea0a3119d
74 files changed
+3462 -407

No files matched your search

+1 -1
View File
@@ -157,7 +157,7 @@ jobs:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
- name: system deps
run: sudo apt-get update && sudo apt-get install -y libasound2-dev libdbus-1-dev libssl-dev
run: sudo apt-get update && sudo apt-get install -y libasound2-dev libjack-jackd2-dev libdbus-1-dev libssl-dev
- name: slint-free dep-graph gate
run: |
set -euo pipefail
+1 -1
View File
@@ -189,7 +189,7 @@ jobs:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
- name: system deps
run: sudo apt-get update && sudo apt-get install -y libasound2-dev libdbus-1-dev libssl-dev
run: sudo apt-get update && sudo apt-get install -y libasound2-dev libjack-jackd2-dev libdbus-1-dev libssl-dev
- name: slint-free dep-graph gate
run: |
set -euo pipefail
+42 -111
View File
@@ -33,7 +33,15 @@ No API keys needed. No telemetry. No tracking. Just music.
## Why QBZ
Browsers cap audio output at 48 kHz and resample everything through WebAudio. QBZ uses a native playback pipeline with direct device control so your DAC receives the original resolution — up to 24-bit / 192 kHz — with no forced resampling.
QBZ exists as the player we wish a streaming company would give its users. It exists to fill the gap of an official client on Linux, because we don't like being second class citizens.
But it is just as important to understand what QBZ is not, and never will be. It is not a web wrapper; I did not just package the web player and "Linuxify" it. It is not a download tool, and it never will be. I built QBZ and not TDL, SPTFY or DZR because I believe music belongs to the artists, and Qobuz is, so far, the fairest option and the one with the best quality. That is why QBZ exists.
It will never have a built-in equalizer or DSP, either. The point is to send audio to your DAC untouched, bit for bit, and any processing would break that. If you want an EQ or effects, add them at the system level, for example with EasyEffects on PipeWire or a JACK graph, which make it easy.
You can download songs to listen to them offline, but they carry the same locks as the official client and the same usage window once your membership expires.
On the technical side: browsers cap audio output at 48 kHz and resample everything through WebAudio. QBZ uses a native playback pipeline with direct device control, so your DAC receives the original resolution, up to 24-bit / 192 kHz, with no forced resampling.
## Installation
@@ -196,18 +204,6 @@ Multi-device playback control using Qobuz's real-time streaming protocol. Consid
- Server-authoritative queue sync across all devices
- Bidirectional transport: play, pause, skip, seek, shuffle, repeat, volume
### Headless Daemon (qbzd)
Run QBZ without a screen: `qbzd` is a standalone ~25 MB binary (shipped inside the deb/rpm
packages and as its own tarball) that turns any Linux box — a Raspberry Pi, a NAS, the
living-room mini-PC — into a bit-perfect **Qobuz Connect endpoint** that appears in the
official Qobuz apps like a hardware streamer.
- Daemon + full CLI + terminal setup wizard (TUI) in one binary
- Browser-based login that works over SSH; one-file settings hand-off from desktop QBZ
- HiFi wizard with copyable audio-stack config blocks (clipboard works over SSH)
- Full manual: **[Headless Daemon (qbzd) — Wiki](https://github.com/vicrodh/qbz/wiki/Headless-Daemon)**
### Casting
- **Chromecast** and **DLNA/UPnP** discovery and streaming
@@ -247,9 +243,41 @@ official Qobuz apps like a hardware streamer.
- Mini player
- Album booklets download to your device — the old in-app PDF reader was dropped in 2.0 to keep the binary lean
- Configurable keyboard shortcuts, UI scale presets (XS–XL)
- **7 languages:** English, Spanish, German, French, Portuguese, Russian, Japanese
- **8 languages:** English, Spanish, German, French, Portuguese, Russian, Japanese, Dutch
- **Offline mode** usable without ever logging into Qobuz, with fully offline playlists and automatic reconnection
## Headless Daemon (qbzd)
<p align="center">
<img src="static/readme-qbzd.png" alt="qbzd — headless daemon CLI and TUI" width="760" />
</p>
Run QBZ without a screen: `qbzd` is a standalone ~25 MB binary (shipped inside the deb/rpm
packages and as its own tarball) that turns any Linux box — a Raspberry Pi, a NAS, the
living-room mini-PC — into a bit-perfect **Qobuz Connect endpoint** that appears in the
official Qobuz apps like a hardware streamer.
- Daemon + full CLI + terminal setup wizard (TUI) in one binary
- Browser-based login that works over SSH; one-file settings hand-off from desktop QBZ
- HiFi wizard with copyable audio-stack config blocks (clipboard works over SSH)
- MPRIS out of the box, live JSON events (`qbzd watch`), service files for systemd/OpenRC/runit
Full manual: **[Headless Daemon (qbzd) — Wiki](https://github.com/vicrodh/qbz/wiki/Headless-Daemon)**
## Kiosk Mode
For Raspberry screens and handheld consoles.
<p align="center">
<img src="static/readme-kiosk.jpeg" alt="QBZ Kiosk Mode on a handheld console" width="720" />
</p>
A touch-first face for touchscreens and small panels: set `QBZ_PROFILE=kiosk` and QBZ boots
a big-target shell with its own NavRail, touch scrolling, an on-screen keyboard, and a
centerpiece Now Playing with cover↔lyrics toggle and queue/history tabs. Switch between
Kiosk and Desktop live from the Now Playing layout menu; fullscreen is opt-in via
`QBZ_KIOSK_FULLSCREEN=1`.
## Tech Stack
As of 2.0, QBZ is a single native Rust process: the **Slint UI runs in-process** and talks to the same Rust core crates directly through callbacks and shared state — there is no browser engine, no webview, and no IPC bridge to serialize across (the old Tauri command-invoke boundary is gone entirely).
@@ -455,93 +483,6 @@ If QBZ fails to start, try `QBZ_RENDERER=software qbz` first.
User guides, audio configuration, integrations, and troubleshooting: **[QBZ Wiki](https://github.com/vicrodh/qbz/wiki)** (work in progress).
## Diagram
As of 2.0 there is no webview and no IPC bridge: the Slint UI runs in the same process as the Rust core and calls it directly through callbacks/shared state.
```mermaid
flowchart TD
subgraph group_ui["UI (Slint, in-process — no webview, no IPC)"]
node_ui_views["qbz-ui<br/>Slint views (.slint)"]
node_ui_bin["qbz binary<br/>entrypoint, window/renderer setup, wiring"]
node_ui_remote["Qconnect Transport<br/>in-process client<br/>[qconnect_transport.rs]"]
end
subgraph group_app["Application Layer (Rust, direct calls)"]
node_app_audio["Audio Orchestration<br/>backend + device mgmt"]
node_app_player["Player Orchestration<br/>playback engine"]
node_app_library["Library Orchestration<br/>library service"]
node_app_cache["Offline Cache<br/>local cache"]
node_app_cast["Casting<br/>device handoff"]
node_app_connect["Qconnect Service<br/>remote control bridge"]
end
subgraph group_crates["Rust Core Crates"]
node_rust_player["qbz-player<br/>playback core"]
node_rust_audio["qbz-audio<br/>audio backend"]
node_rust_cache["qbz-cache<br/>audio cache"]
node_rust_qobuz["qbz-qobuz<br/>api client"]
node_rust_library["qbz-library<br/>library index"]
node_rust_cast["qbz-cast<br/>cast stack"]
node_rust_connect["qconnect stack<br/>protocol stack"]
node_rust_integrations["qbz-integrations<br/>external services"]
end
subgraph group_packaging["Packaging"]
node_packaging_ci["Packaging & CI<br/>release automation<br/>[workflows]"]
end
node_ui_views -->|"callbacks / shared state"| node_ui_bin
node_ui_remote -->|"bridges"| node_app_connect
node_ui_bin -->|"drives, in-process"| node_app_player
node_ui_bin -->|"queries, in-process"| node_app_library
node_ui_bin -->|"controls, in-process"| node_app_audio
node_ui_bin -->|"reads/writes, in-process"| node_app_cache
node_ui_bin -->|"controls, in-process"| node_app_cast
node_ui_bin -->|"syncs, in-process"| node_rust_integrations
node_app_player -->|"uses"| node_rust_player
node_app_audio -->|"uses"| node_rust_audio
node_app_player -->|"prefetches"| node_rust_cache
node_app_library -->|"indexes"| node_rust_library
node_app_library -->|"enriches"| node_rust_qobuz
node_app_cast -->|"delegates"| node_rust_cast
node_app_connect -->|"implements"| node_rust_connect
node_packaging_ci -.->|"builds"| node_ui_bin
node_packaging_ci -.->|"bundles"| node_ui_views
click node_ui_views "https://github.com/vicrodh/qbz/tree/main/crates/qbz-ui"
click node_ui_bin "https://github.com/vicrodh/qbz/tree/main/crates/qbz/src"
click node_ui_remote "https://github.com/vicrodh/qbz/blob/main/crates/qbz/src/qconnect_transport.rs"
click node_app_audio "https://github.com/vicrodh/qbz/tree/main/crates/qbz-audio/src"
click node_app_player "https://github.com/vicrodh/qbz/tree/main/crates/qbz-player/src"
click node_app_library "https://github.com/vicrodh/qbz/tree/main/crates/qbz-library/src"
click node_app_cache "https://github.com/vicrodh/qbz/tree/main/crates/qbz-offline-cache/src"
click node_app_cast "https://github.com/vicrodh/qbz/tree/main/crates/qbz-cast/src"
click node_app_connect "https://github.com/vicrodh/qbz/blob/main/crates/qbz/src/qconnect_transport.rs"
click node_rust_player "https://github.com/vicrodh/qbz/tree/main/crates/qbz-player/src"
click node_rust_audio "https://github.com/vicrodh/qbz/tree/main/crates/qbz-audio/src"
click node_rust_cache "https://github.com/vicrodh/qbz/tree/main/crates/qbz-cache/src"
click node_rust_qobuz "https://github.com/vicrodh/qbz/tree/main/crates/qbz-qobuz/src"
click node_rust_library "https://github.com/vicrodh/qbz/tree/main/crates/qbz-library/src"
click node_rust_cast "https://github.com/vicrodh/qbz/tree/main/crates/qbz-cast/src"
click node_rust_connect "https://github.com/vicrodh/qbz/tree/main/crates/qconnect-protocol/src"
click node_rust_integrations "https://github.com/vicrodh/qbz/tree/main/crates/qbz-integrations/src"
click node_packaging_ci "https://github.com/vicrodh/qbz/blob/main/.github/workflows"
classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_ui_views,node_ui_bin,node_ui_remote toneBlue
class node_app_audio,node_app_player,node_app_library,node_app_cache,node_app_cast,node_app_connect toneAmber
class node_rust_player,node_rust_audio,node_rust_cache,node_rust_qobuz,node_rust_library,node_rust_cast,node_rust_connect,node_rust_integrations toneMint
class node_packaging_ci toneIndigo
```
## Open Source
QBZ is MIT-licensed. No telemetry, no tracking, no hidden services. Built for Linux and macOS audio enthusiasts.
@@ -564,13 +505,3 @@ Contributions welcome. Please read `CONTRIBUTING.md` before submitting issues or
## License
MIT
## Fancy charts
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=vicrodh/qbz&type=date&theme=dark&legend=top-left" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=vicrodh/qbz&type=date&legend=top-left" />
<img alt="Star History Chart" src="https://api.star-history.com/chart?repos=vicrodh/qbz&type=date&legend=top-left" />
</picture>
+1 -69
View File
@@ -2615,10 +2615,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
dependencies = [
"cfg-if",
"js-sys",
"libc",
"wasi",
"wasm-bindgen",
]
[[package]]
@@ -2628,11 +2626,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd"
dependencies = [
"cfg-if",
"js-sys",
"libc",
"r-efi 5.3.0",
"wasip2",
"wasm-bindgen",
]
[[package]]
@@ -4212,12 +4208,6 @@ dependencies = [
"hashbrown 0.17.1",
]
[[package]]
name = "lru-slab"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154"
[[package]]
name = "lyon_algorithms"
version = "1.0.20"
@@ -5943,6 +5933,7 @@ dependencies = [
"rand 0.10.1",
"reqwest",
"rusqlite",
"rustls",
"serde",
"serde_json",
"tokio",
@@ -5998,7 +5989,6 @@ dependencies = [
"mdns-sd",
"rupnp",
"rust_cast",
"rustls",
"serde",
"serde_json",
"thiserror 2.0.18",
@@ -6526,61 +6516,6 @@ dependencies = [
"serde",
]
[[package]]
name = "quinn"
version = "0.11.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9e20a958963c291dc322d98411f541009df2ced7b5a4f2bd52337638cfccf20"
dependencies = [
"bytes",
"cfg_aliases",
"pin-project-lite",
"quinn-proto",
"quinn-udp",
"rustc-hash 2.1.1",
"rustls",
"socket2 0.6.3",
"thiserror 2.0.18",
"tokio",
"tracing",
"web-time",
]
[[package]]
name = "quinn-proto"
version = "0.11.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "434b42fec591c96ef50e21e886936e66d3cc3f737104fdb9b737c40ffb94c098"
dependencies = [
"bytes",
"getrandom 0.3.4",
"lru-slab",
"rand 0.9.3",
"ring",
"rustc-hash 2.1.1",
"rustls",
"rustls-pki-types",
"slab",
"thiserror 2.0.18",
"tinyvec",
"tracing",
"web-time",
]
[[package]]
name = "quinn-udp"
version = "0.5.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "addec6a0dcad8a8d96a771f815f0eaf55f9d1805756410b39f5fa81332574cbd"
dependencies = [
"cfg_aliases",
"libc",
"once_cell",
"socket2 0.6.3",
"tracing",
"windows-sys 0.60.2",
]
[[package]]
name = "quote"
version = "1.0.45"
@@ -7001,7 +6936,6 @@ dependencies = [
"log",
"percent-encoding",
"pin-project-lite",
"quinn",
"rustls",
"rustls-pki-types",
"serde",
@@ -7280,7 +7214,6 @@ dependencies = [
"aws-lc-rs",
"log",
"once_cell",
"ring",
"rustls-pki-types",
"rustls-webpki",
"subtle",
@@ -7305,7 +7238,6 @@ version = "1.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be040f8b0a225e40375822a563fa9524378b9d63112f53e19ffff34df5d33fdd"
dependencies = [
"web-time",
"zeroize",
]
+1 -1
View File
@@ -59,7 +59,7 @@ serde = { version = "1", features = ["derive"] }
serde_json = "1"
# HTTP
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls", "cookies", "stream"] }
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls-webpki-roots-no-provider", "cookies", "stream"] }
# Logging
log = "0.4"
+3
View File
@@ -24,3 +24,6 @@ chrono = { workspace = true }
md-5 = { workspace = true }
base64 = { workspace = true }
rand = "0.10"
# TLS provider selection
rustls = { version = "0.23", features = ["aws_lc_rs"] }
+17
View File
@@ -10,3 +10,20 @@ pub mod session_store;
pub mod shell;
pub mod settings;
pub mod user_data;
/// Install the rustls process-level `CryptoProvider` (aws-lc-rs) exactly once.
///
/// Idempotent (a second call is a no-op); harmless if some other component
/// already installed a default (`install_default` then returns Err, ignored).
pub fn ensure_crypto_provider() {
use std::sync::Once;
static INIT: Once = Once::new();
INIT.call_once(|| {
if rustls::crypto::aws_lc_rs::default_provider()
.install_default()
.is_err()
{
log::debug!("[app] rustls CryptoProvider already installed");
}
});
}
+8 -8
View File
@@ -4,7 +4,7 @@
//! This module bypasses rodio/CPAL completely for direct hardware access.
#[cfg(target_os = "linux")]
use alsa::pcm::{Access, Format, HwParams, PCM};
use alsa::pcm::{Access, Format, Frames, HwParams, PCM};
#[cfg(target_os = "linux")]
use alsa::{Direction, ValueOr};
#[cfg(target_os = "linux")]
@@ -213,13 +213,13 @@ impl AlsaDirectStream {
// Set buffer size (larger buffer for high-res audio)
let buffer_size = if sample_rate >= 192000 {
// 500ms buffer for 192kHz+ (like MPD config)
(sample_rate / 2) as i64
(sample_rate / 2) as Frames
} else if sample_rate >= 96000 {
// 250ms buffer for 96kHz
(sample_rate / 4) as i64
(sample_rate / 4) as Frames
} else {
// 125ms buffer for lower rates
(sample_rate / 8) as i64
(sample_rate / 8) as Frames
};
hwp.set_buffer_size_near(buffer_size)
@@ -300,11 +300,11 @@ impl AlsaDirectStream {
hwp.set_rate(carrier_rate, ValueOr::Nearest)
.map_err(|e| format!("Failed to set DoP carrier rate {}: {}", carrier_rate, e))?;
let buffer_size = if carrier_rate >= 192000 {
(carrier_rate / 2) as i64
(carrier_rate / 2) as Frames
} else if carrier_rate >= 96000 {
(carrier_rate / 4) as i64
(carrier_rate / 4) as Frames
} else {
(carrier_rate / 8) as i64
(carrier_rate / 8) as Frames
};
hwp.set_buffer_size_near(buffer_size)
.map_err(|e| format!("Failed to set buffer size: {}", e))?;
@@ -388,7 +388,7 @@ impl AlsaDirectStream {
.map_err(|e| format!("Failed to set channels: {}", e))?;
hwp.set_rate(rate, ValueOr::Nearest)
.map_err(|e| format!("Failed to set native DSD rate {}: {}", rate, e))?;
let buffer_size = (rate / 4) as i64; // 250 ms
let buffer_size = (rate / 4) as Frames; // 250 ms
hwp.set_buffer_size_near(buffer_size)
.map_err(|e| format!("Failed to set buffer size: {}", e))?;
hwp.set_period_size_near(buffer_size / 10, ValueOr::Nearest)
-6
View File
@@ -8,12 +8,6 @@ description = "Casting support for QBZ - Chromecast, DLNA"
# Chromecast
rust_cast = "0.21"
# TLS provider selection. rust_cast uses rustls; in the multi-crate binary both
# the aws-lc-rs and ring providers end up enabled (reqwest pulls ring), so
# rustls can't auto-pick one and panics on connect. We install aws-lc-rs
# explicitly before connecting (see `ensure_crypto_provider`).
rustls = { version = "0.23", features = ["aws_lc_rs"] }
# mDNS discovery
mdns-sd = "0.11"
-3
View File
@@ -75,9 +75,6 @@ impl ChromecastHandle {
/// Connect to a Chromecast device
pub fn connect(&self, ip: String, port: u16) -> Result<(), CastError> {
// rust_cast opens a rustls TLS channel; make sure a CryptoProvider is
// installed first (the worker thread would otherwise panic).
crate::ensure_crypto_provider();
let (reply_tx, reply_rx) = mpsc::channel();
self.sender
.send(CastCommand::Connect {
-3
View File
@@ -60,9 +60,6 @@ pub struct DlnaConnection {
impl DlnaConnection {
/// Connect to a DLNA device and discover service URLs
pub async fn connect(device: DiscoveredDlnaDevice) -> Result<Self, DlnaError> {
// Defensive: the device-description fetch may go over TLS in some
// setups; ensure a rustls CryptoProvider is installed (idempotent).
crate::ensure_crypto_provider();
let device_url: Uri = device
.url
.parse()
-22
View File
@@ -38,25 +38,3 @@ pub use dlna::{
/// Cast device type alias for backwards compatibility
pub type CastDevice = CastDeviceConnection;
/// Install the rustls process-level `CryptoProvider` (aws-lc-rs) exactly once.
///
/// `rust_cast` opens a TLS control channel to the Chromecast via rustls. In the
/// full QBZ binary BOTH the `aws-lc-rs` and `ring` providers are enabled (reqwest
/// pulls `ring`, rust_cast pulls `aws-lc-rs`), so rustls can't auto-select one
/// and panics with "Could not automatically determine the process-level
/// CryptoProvider". Installing one explicitly before any TLS use fixes it.
///
/// Idempotent (a second call is a no-op); harmless if some other component
/// already installed a default (`install_default` then returns Err, ignored).
pub fn ensure_crypto_provider() {
use std::sync::Once;
static INIT: Once = Once::new();
INIT.call_once(|| {
if rustls::crypto::aws_lc_rs::default_provider()
.install_default()
.is_err()
{
log::debug!("[cast] rustls CryptoProvider already installed");
}
});
}
+3 -2
View File
@@ -992,7 +992,8 @@ impl<A: FrontendAdapter + Send + Sync + 'static> QbzCore<A> {
/// Get a track's lyrics document (synced/unsynced), or `None` if the track
/// has none. Thin wrapper over `QobuzClient::get_lyrics` so headless callers
/// (qbzd) avoid the `client()` escape hatch.
/// (qbzd) avoid the `client()` escape hatch. Original-only fetch (no
/// translation target — the headless surface has no translation toggle).
pub async fn get_lyrics(
&self,
track_id: u64,
@@ -1000,7 +1001,7 @@ impl<A: FrontendAdapter + Send + Sync + 'static> QbzCore<A> {
let client = self.client.read().await;
let client = client.as_ref().ok_or(CoreError::NotInitialized)?;
client.get_lyrics(track_id).await.map_err(CoreError::Api)
client.get_lyrics(track_id, None).await.map_err(CoreError::Api)
}
/// Get artist by ID
+137 -1
View File
@@ -22,6 +22,9 @@ use crate::validate::{
use crate::{RecoCatalog, RecoInputs};
const DISPLAY_CAP: usize = 20;
/// Public alias for the paint layer (it composes the visible rows after
/// filtering/dedup, so it needs the canonical per-rail visible cap).
pub const ARTIST_DISPLAY_CAP: usize = DISPLAY_CAP;
const PLAYLIST_CAP: usize = 30;
const VALIDATE_CONCURRENCY: usize = 6;
const ARTIST_SEEDS: usize = 6;
@@ -239,7 +242,13 @@ async fn similar_artist_row(
}
let candidates: Vec<ArtistCandidate> = round_robin(groups).into_iter().take(45).collect();
let pool = validate_artist_pool(inputs.catalog, inputs.cache, candidates).await;
rotate_take(pool, inputs.rotation_seed, DISPLAY_CAP)
// Rotate for daily variety but do NOT truncate at DISPLAY_CAP: the paint
// layer composes the visible rows AFTER followed/blacklisted/dismissed
// filtering + cross-rail dedup (compose_artist_rails) and keeps the
// remaining validated candidates as backfill overflow — they ride the
// results blob, so replacements need no extra network.
let take = pool.len();
rotate_take(pool, inputs.rotation_seed, take)
}
/// "More like the artists you love" — your COMMON taste (overall top).
@@ -258,6 +267,59 @@ pub async fn build_rec_artists_recent(
similar_artist_row(inputs, history, "1month").await
}
// ── Display composition (filter + cross-rail dedup + backfill split) ────────
/// One artist rail after display composition: the visible rows (the first
/// `cap` survivors) plus the retained overflow (the remaining survivors, in
/// pool order), which the paint layer keeps for live backfill after a
/// "not interested" dismissal.
#[derive(Debug, Clone, Default)]
pub struct ArtistRailComposition {
pub visible: Vec<ArtistReco>,
pub overflow: Vec<ArtistReco>,
}
/// Compose the two Recommended-Artist rails for display:
///
/// - drop every candidate whose Qobuz id is in `excluded` (the frontend folds
/// followed / blacklisted / dismissed ids into that set; fail-soft = pass
/// an empty set),
/// - dedup WITHIN and ACROSS rails: an id shows in at most one rail — the
/// COMMON rail is composed first and wins — and overflow ids are claimed
/// too, so a common-overflow id cannot resurface in recent's visible,
/// - the first `cap` survivors per rail are visible; the rest is overflow.
pub fn compose_artist_rails(
common_pool: Vec<ArtistReco>,
recent_pool: Vec<ArtistReco>,
excluded: &HashSet<u64>,
cap: usize,
) -> (ArtistRailComposition, ArtistRailComposition) {
let mut seen: HashSet<u64> = HashSet::new();
let common = compose_one_rail(common_pool, excluded, &mut seen, cap);
let recent = compose_one_rail(recent_pool, excluded, &mut seen, cap);
(common, recent)
}
fn compose_one_rail(
pool: Vec<ArtistReco>,
excluded: &HashSet<u64>,
seen: &mut HashSet<u64>,
cap: usize,
) -> ArtistRailComposition {
let mut out = ArtistRailComposition::default();
for reco in pool {
if excluded.contains(&reco.qobuz_artist_id) || !seen.insert(reco.qobuz_artist_id) {
continue;
}
if out.visible.len() < cap {
out.visible.push(reco);
} else {
out.overflow.push(reco);
}
}
out
}
// ── Recommended Albums (Last.fm: your artists' top albums, not scrobbled) ───
pub async fn build_rec_albums(inputs: &RecoInputs<'_>, history: &ExtHistory) -> Vec<AlbumReco> {
@@ -637,3 +699,77 @@ pub async fn build_editorial(inputs: &RecoInputs<'_>) -> (Vec<AlbumReco>, Vec<Ar
(top_albums, top_artists)
}
// ── Tests ───────────────────────────────────────────────────────────────────
#[cfg(test)]
mod tests {
use super::*;
fn reco(id: u64) -> ArtistReco {
ArtistReco {
qobuz_artist_id: id,
name: format!("Artist {id}"),
image_url: String::new(),
subtitle: String::new(),
source: RecoSource::LastFm,
}
}
fn ids(recos: &[ArtistReco]) -> Vec<u64> {
recos.iter().map(|r| r.qobuz_artist_id).collect()
}
#[test]
fn compose_excludes_ids_from_visible_and_overflow() {
let common = vec![reco(1), reco(2), reco(3), reco(4)];
let recent = vec![reco(5), reco(6)];
let excluded = HashSet::from([2, 4, 5]);
let (c, r) = compose_artist_rails(common, recent, &excluded, 2);
assert_eq!(ids(&c.visible), vec![1, 3]);
assert!(c.overflow.is_empty(), "excluded ids leave no overflow");
assert_eq!(ids(&r.visible), vec![6]);
}
#[test]
fn compose_dedups_cross_rail_common_wins() {
let common = vec![reco(1), reco(2)];
let recent = vec![reco(2), reco(3)];
let (c, r) = compose_artist_rails(common, recent, &HashSet::new(), 20);
assert_eq!(ids(&c.visible), vec![1, 2]);
assert_eq!(ids(&r.visible), vec![3], "id 2 appears only in common");
}
#[test]
fn compose_dedups_within_rail() {
let common = vec![reco(1), reco(1), reco(2)];
let (c, _r) = compose_artist_rails(common, Vec::new(), &HashSet::new(), 20);
assert_eq!(ids(&c.visible), vec![1, 2]);
}
#[test]
fn compose_splits_visible_and_overflow_in_order() {
let common: Vec<ArtistReco> = (1..=5).map(reco).collect();
let excluded = HashSet::from([1]);
let (c, _r) = compose_artist_rails(common, Vec::new(), &excluded, 3);
// The exclusion punches a hole in the first window; the next
// candidates move up into the visible rows, the rest is overflow —
// both in pool order (the backfill contract).
assert_eq!(ids(&c.visible), vec![2, 3, 4]);
assert_eq!(ids(&c.overflow), vec![5]);
}
#[test]
fn compose_cross_rail_dedup_also_covers_overflow() {
// An id sitting in common's OVERFLOW must not resurface in recent's
// visible rows (it is still claimed for potential backfill).
let common: Vec<ArtistReco> = (1..=3).map(reco).collect();
let recent = vec![reco(3), reco(4)];
let (c, r) = compose_artist_rails(common, recent, &HashSet::new(), 2);
assert_eq!(ids(&c.visible), vec![1, 2]);
assert_eq!(ids(&c.overflow), vec![3]);
assert_eq!(ids(&r.visible), vec![4], "id 3 is claimed by common");
assert!(r.overflow.is_empty());
}
}
+1
View File
@@ -27,6 +27,7 @@ use qbz_integrations::{LastFmClient, ListenBrainzClient, MusicBrainzClient};
use qbz_models::{Album, Artist, Track};
pub use cache::RecoCache;
pub use carousels::{compose_artist_rails, ArtistRailComposition, ARTIST_DISPLAY_CAP};
pub use types::{
AlbumReco, ArtistReco, ExternalCarousels, ExtHistory, LocalHistory, RecoSource, TrackReco,
};
+1 -1
View File
@@ -10,7 +10,7 @@ license = "MIT"
tokio = { version = "1", features = ["sync", "time"] }
# HTTP client
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] }
reqwest = { workspace = true, default-features = false, features = ["json", "rustls-tls-webpki-roots-no-provider"] }
# Serialization
serde = { version = "1", features = ["derive"] }
+4 -1
View File
@@ -40,7 +40,10 @@ pub mod wsync;
pub use cache::{CachedLyrics, LyricsCacheDb, LyricsCacheStats};
pub use lrc::{emit_lrc, parse_lrc, parse_plain, LrcSpan, MAX_SUNG_MS};
pub use model::{build_cache_key, LyricsDoc, LyricsLine, LyricsPayload, LyricsProvider, Word};
pub use model::{
build_cache_key, derive_has_translation, LyricsDoc, LyricsKind, LyricsLine, LyricsPayload,
LyricsProvider, TranslatedLyrics, Word,
};
pub use providers::LyricsData;
pub use service::{
HttpLyricsProviders, LyricsOutcome, LyricsProviders, LyricsRequest, LyricsResponse,
+71 -6
View File
@@ -81,6 +81,38 @@ pub struct LyricsLine {
pub words: Option<Vec<Word>>,
}
/// Synchronization kind of a lyrics content block — mirrors the Android v10
/// mapper's dispatch on the wire `type` (wsync -> word-synced, lsync ->
/// line-synced, plain -> plain).
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
pub enum LyricsKind {
LineSynced,
Plain,
WordSynced,
}
/// A translated lyrics block (Qobuz API v10). Reuses [`LyricsLine`]/[`Word`]:
/// synced translations carry the SAME timestamps as the original, so sync and
/// karaoke stay keyed on the original timings while the translation renders
/// as static text under each line.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct TranslatedLyrics {
pub kind: LyricsKind,
/// ISO 639-1 of the translation (the language it was fetched with).
pub lang: Option<String>,
pub lines: Vec<LyricsLine>,
}
/// Derive `has_translation` (client-derived, NEVER a wire field): the
/// requested language is listed in the document's `translation_langs`.
/// False when no language was requested.
pub fn derive_has_translation(translation_langs: &[String], requested_lang: Option<&str>) -> bool {
match requested_lang {
Some(lang) => translation_langs.iter().any(|candidate| candidate == lang),
None => false,
}
}
/// Parsed, render-ready lyrics document.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct LyricsDoc {
@@ -92,6 +124,14 @@ pub struct LyricsDoc {
pub translation_langs: Vec<String>,
/// Songwriter credits display string (Qobuz metadata passthrough).
pub writers: Option<String>,
/// Embedded translation (Qobuz v10 only; `None` for other providers and
/// for original-only fetches). Boxed: rare + large, keep the doc small.
#[serde(default)]
pub translation: Option<Box<TranslatedLyrics>>,
/// Client-derived (see [`derive_has_translation`]): a translation for the
/// requested language is available. False when none was requested.
#[serde(default)]
pub has_translation: bool,
}
impl LyricsDoc {
@@ -103,6 +143,8 @@ impl LyricsDoc {
provider,
translation_langs: Vec::new(),
writers: None,
translation: None,
has_translation: false,
}
}
@@ -116,6 +158,8 @@ impl LyricsDoc {
provider,
translation_langs: Vec::new(),
writers: None,
translation: None,
has_translation: false,
}
}
@@ -127,6 +171,8 @@ impl LyricsDoc {
provider,
translation_langs: Vec::new(),
writers: None,
translation: None,
has_translation: false,
}
}
@@ -152,13 +198,19 @@ impl LyricsDoc {
/// Build from a cached row. Readers PREFER the native wsync document when
/// present (amended Q5): word timestamps survive the cache; the LRC column
/// stays the cross-frontend lingua franca.
pub fn from_cached(payload: &LyricsPayload, qobuz_wsync_json: Option<&str>) -> Self {
/// stays the cross-frontend lingua franca. `requested_lang` (the active
/// translation target, if any) drives the client-derived `has_translation`
/// on the served document.
pub fn from_cached(
payload: &LyricsPayload,
qobuz_wsync_json: Option<&str>,
requested_lang: Option<&str>,
) -> Self {
if payload.provider == LyricsProvider::Qobuz {
if let Some(json) = qobuz_wsync_json {
match serde_json::from_str::<crate::wsync::QobuzWsync>(json) {
Ok(wsync) => {
let doc = wsync.to_doc();
let doc = wsync.to_doc(requested_lang);
if !doc.lines.is_empty() {
return doc;
}
@@ -297,22 +349,35 @@ mod tests {
{"line":"hello","start":1000,"end":2000,
"words":[{"word":"hello","start":1000,"end":2000}]}
]}"#;
let doc = LyricsDoc::from_cached(&payload, Some(wsync_json));
let doc = LyricsDoc::from_cached(&payload, Some(wsync_json), None);
assert!(doc.synced);
let words = doc.lines[0].words.as_ref().expect("native words preserved");
assert_eq!(words[0].text, "hello");
// Without the column, the LRC path applies (no words).
let doc = LyricsDoc::from_cached(&payload, None);
let doc = LyricsDoc::from_cached(&payload, None, None);
assert!(doc.synced);
assert!(doc.lines[0].words.is_none());
// Corrupt wsync json degrades to the LRC path instead of erroring.
let doc = LyricsDoc::from_cached(&payload, Some("{not json"));
let doc = LyricsDoc::from_cached(&payload, Some("{not json"), None);
assert!(doc.synced);
assert!(doc.lines[0].words.is_none());
}
#[test]
fn has_translation_derivation() {
let langs = vec!["pt".to_string(), "de".to_string(), "es".to_string()];
// Requested lang listed -> true.
assert!(derive_has_translation(&langs, Some("es")));
// Requested lang NOT listed -> false (track lacks that language).
assert!(!derive_has_translation(&langs, Some("ja")));
// No language requested -> false, even when translations exist.
assert!(!derive_has_translation(&langs, None));
// Empty list (feature off) -> false.
assert!(!derive_has_translation(&[], Some("es")));
}
#[test]
fn plain_text_joins_lines() {
let doc = LyricsDoc::from_plain_text("a\n\n b \nc", LyricsProvider::Ovh);
+274 -18
View File
@@ -38,9 +38,11 @@ use tokio::sync::Mutex;
use qbz_qobuz::{QobuzClient, QobuzLyricsContent, QobuzLyricsDocument};
use crate::cache::{CachedLyrics, LyricsCacheDb, LyricsCacheStats};
use crate::model::{build_cache_key, LyricsDoc, LyricsPayload, LyricsProvider};
use crate::model::{
build_cache_key, derive_has_translation, LyricsDoc, LyricsPayload, LyricsProvider,
};
use crate::providers::{fetch_lrclib, fetch_lyrics_ovh, LyricsData};
use crate::wsync::QobuzWsync;
use crate::wsync::{translated_from_content, QobuzWsync};
/// What kind of source the playing track comes from. The Qobuz primary step
/// only applies to Qobuz catalog tracks with a real track_id; local-library /
@@ -63,6 +65,12 @@ pub struct LyricsRequest {
pub album: Option<String>,
pub duration_secs: Option<u64>,
pub offline: bool,
/// Active translation target (ISO 639-1, Qobuz API v10). `None` = the
/// default original-only fetch; `Some(lang)` asks the Qobuz primary for
/// a translation and drives the client-derived `has_translation` on the
/// served document. Only the Qobuz provider is affected — the external
/// fallback chain never sees it.
pub language: Option<String>,
}
/// Served lyrics: the wire-compatible payload plus the parsed document
@@ -96,10 +104,15 @@ pub struct LyricsResponse {
/// fakes and the chain logic stays headless-testable.
#[async_trait]
pub trait LyricsProviders: Send + Sync {
/// Qobuz primary (two-step: signed lyricsUrl + CDN doc).
/// `Ok(None)` = typed miss; `Err` = transport/auth/offline failure —
/// both degrade silently to the fallback chain.
async fn qobuz(&self, track_id: u64) -> Result<Option<QobuzLyricsDocument>, String>;
/// Qobuz primary (two-step: signed lyricsUrl + CDN doc). `language` is the
/// optional translation target (ISO 639-1, v10); `None` fetches
/// original-only. `Ok(None)` = typed miss; `Err` = transport/auth/offline
/// failure — both degrade silently to the fallback chain.
async fn qobuz(
&self,
track_id: u64,
language: Option<&str>,
) -> Result<Option<QobuzLyricsDocument>, String>;
/// LRCLIB. `Ok(None)` = no match; `Err` = transport error (the chain
/// retries exactly once).
@@ -128,9 +141,13 @@ impl HttpLyricsProviders {
#[async_trait]
impl LyricsProviders for HttpLyricsProviders {
async fn qobuz(&self, track_id: u64) -> Result<Option<QobuzLyricsDocument>, String> {
async fn qobuz(
&self,
track_id: u64,
language: Option<&str>,
) -> Result<Option<QobuzLyricsDocument>, String> {
self.client
.get_lyrics(track_id)
.get_lyrics(track_id, language)
.await
.map_err(|e| e.to_string())
}
@@ -263,11 +280,40 @@ fn dedupe_key(request: &LyricsRequest) -> String {
)
),
};
format!("{}|offline:{}", identity, request.offline)
// The translation target is part of the identity: a refetch WITH a
// language must never join an in-flight original-only resolution.
format!(
"{}|offline:{}|lang:{}",
identity,
request.offline,
request.language.as_deref().unwrap_or("")
)
}
fn cached_result(cached: CachedLyrics) -> LyricsResult {
let doc = LyricsDoc::from_cached(&cached.payload, cached.qobuz_wsync_json.as_deref());
/// A cached entry satisfies a language request only when its stored native
/// wsync document carries a translation FOR THAT language (the content's own
/// `lang` records it, spec §A.5); anything else falls through to a refetch.
/// Original-only requests (`None`) are served by any synced hit, as before.
fn cached_serves_language(cached: &CachedLyrics, language: Option<&str>) -> bool {
match language {
None => true,
Some(lang) => cached
.qobuz_wsync_json
.as_deref()
.and_then(|json| serde_json::from_str::<QobuzWsync>(json).ok())
.and_then(|wsync| wsync.translation)
.and_then(|content| content.lang().map(str::to_owned))
.map(|cached_lang| cached_lang == lang)
.unwrap_or(false),
}
}
fn cached_result(cached: CachedLyrics, requested_lang: Option<&str>) -> LyricsResult {
let doc = LyricsDoc::from_cached(
&cached.payload,
cached.qobuz_wsync_json.as_deref(),
requested_lang,
);
LyricsResult {
payload: cached.payload,
doc,
@@ -306,7 +352,10 @@ async fn run_chain(
.or_else(|| db.get_by_cache_key(&cache_key).ok().flatten());
return Ok(match cached {
Some(cached) => respond(LyricsOutcome::Found(cached_result(cached))),
Some(cached) => respond(LyricsOutcome::Found(cached_result(
cached,
request.language.as_deref(),
))),
None => respond(LyricsOutcome::NotAvailableOffline),
});
}
@@ -330,10 +379,14 @@ async fn run_chain(
.as_ref()
.map(|s| !s.trim().is_empty())
.unwrap_or(false);
if has_synced {
return Ok(respond(LyricsOutcome::Found(cached_result(cached))));
if has_synced && cached_serves_language(&cached, request.language.as_deref()) {
return Ok(respond(LyricsOutcome::Found(cached_result(
cached,
request.language.as_deref(),
))));
}
// plain-only cache: fall through to re-fetch for synced
// plain-only cache — or a synced entry without a translation for
// the requested language: fall through to re-fetch (spec §A.5).
}
} // lock released before any network round-trip
@@ -360,7 +413,11 @@ async fn run_chain(
let qobuz_fut = async {
if request.source == LyricsSourceKind::Qobuz {
if let Some(track_id) = request.track_id {
match inner.providers.qobuz(track_id).await {
match inner
.providers
.qobuz(track_id, request.language.as_deref())
.await
{
Ok(Some(document)) => return Some(document),
Ok(None) => log::debug!("[Lyrics] Qobuz miss for track {}", track_id),
Err(e) => {
@@ -397,7 +454,7 @@ async fn run_chain(
let mut qobuz_plain_candidate: Option<LyricsResult> = None;
if let Some(document) = qobuz_doc {
if let Some(wsync) = QobuzWsync::from_document(&document) {
let doc = wsync.to_doc();
let doc = wsync.to_doc(request.language.as_deref());
if !doc.lines.is_empty() {
let mut payload = base_payload(LyricsProvider::Qobuz);
payload.plain = Some(doc.plain_text());
@@ -421,6 +478,14 @@ async fn run_chain(
let mut doc = LyricsDoc::from_plain_text(&blob, LyricsProvider::Qobuz);
doc.translation_langs = document.translation_langs.clone();
doc.writers = document.writers.clone();
doc.translation = document
.translation
.as_ref()
.map(|content| Box::new(translated_from_content(content)));
doc.has_translation = derive_has_translation(
&document.translation_langs,
request.language.as_deref(),
);
let mut payload = base_payload(LyricsProvider::Qobuz);
payload.plain = Some(blob.trim().to_string());
qobuz_plain_candidate = Some(LyricsResult { payload, doc });
@@ -493,13 +558,23 @@ mod tests {
qobuz_calls: AtomicUsize,
lrclib_calls: AtomicUsize,
ovh_calls: AtomicUsize,
/// Language argument observed on each qobuz call (threading proof).
qobuz_languages: StdMutex<Vec<Option<String>>>,
delay_ms: Option<u64>,
}
#[async_trait]
impl LyricsProviders for FakeProviders {
async fn qobuz(&self, _track_id: u64) -> Result<Option<QobuzLyricsDocument>, String> {
async fn qobuz(
&self,
_track_id: u64,
language: Option<&str>,
) -> Result<Option<QobuzLyricsDocument>, String> {
self.qobuz_calls.fetch_add(1, Ordering::SeqCst);
self.qobuz_languages
.lock()
.unwrap()
.push(language.map(str::to_owned));
if let Some(ms) = self.delay_ms {
tokio::time::sleep(Duration::from_millis(ms)).await;
}
@@ -549,6 +624,32 @@ mod tests {
.unwrap()
}
fn wsync_document_with_translation() -> QobuzLyricsDocument {
serde_json::from_str(
r#"{
"track_id": 100, "album_id": "alb",
"translation_langs": ["es", "fr"], "writers": "W. Riter",
"original": {"type": "wsync", "lang": "en", "lines": [
{"line": "first line", "start": 1000, "end": 3000,
"words": [{"word": "first", "start": 1000, "end": 1800},
{"word": "line", "start": 1800, "end": 3000}]},
{"line": "second line", "start": 9000, "end": 11000,
"words": [{"word": "second", "start": 9000, "end": 9900},
{"word": "line", "start": 9900, "end": 11000}]}
]},
"translation": {"type": "wsync", "lang": "es", "lines": [
{"line": "primera linea", "start": 1000, "end": 3000,
"words": [{"word": "primera", "start": 1000, "end": 1800},
{"word": "linea", "start": 1800, "end": 3000}]},
{"line": "segunda linea", "start": 9000, "end": 11000,
"words": [{"word": "segunda", "start": 9000, "end": 9900},
{"word": "linea", "start": 9900, "end": 11000}]}
]}
}"#,
)
.unwrap()
}
fn plain_document() -> QobuzLyricsDocument {
serde_json::from_str(
r#"{
@@ -593,6 +694,7 @@ mod tests {
album: Some("Album".into()),
duration_secs: Some(200),
offline: false,
language: None,
}
}
@@ -797,6 +899,160 @@ mod tests {
assert_eq!(providers.lrclib_calls.load(Ordering::SeqCst), 2);
}
// ---------- translation (v10) ----------
#[tokio::test]
async fn language_threads_to_qobuz_and_translation_is_mapped() {
let providers = Arc::new(FakeProviders::default());
providers
.qobuz_queue
.lock()
.unwrap()
.push_back(Ok(Some(wsync_document_with_translation())));
let (service, _dir) = service_with(providers.clone()).await;
let mut translated = request();
translated.language = Some("es".into());
let response = service.get(translated).await.unwrap();
let result = found(&response);
// The language reached the provider; the doc carries the mapped
// translation (wsync -> WordSynced, native word stamps, same timings).
assert_eq!(
providers.qobuz_languages.lock().unwrap().as_slice(),
&[Some("es".to_string())]
);
assert!(result.doc.has_translation);
let translation = result.doc.translation.as_ref().expect("translation mapped");
assert_eq!(translation.kind, crate::LyricsKind::WordSynced);
assert_eq!(translation.lang.as_deref(), Some("es"));
assert_eq!(translation.lines.len(), 2);
assert_eq!(translation.lines[0].text, "primera linea");
assert_eq!(translation.lines[0].time_ms, Some(1000));
let words = translation.lines[0].words.as_ref().expect("words survive");
assert_eq!(words[0].text, "primera");
// Sync stays keyed on the ORIGINAL lines/timings.
assert_eq!(result.doc.lines[0].text, "first line");
}
#[tokio::test]
async fn translation_survives_the_cache_for_the_same_language() {
let providers = Arc::new(FakeProviders::default());
providers
.qobuz_queue
.lock()
.unwrap()
.push_back(Ok(Some(wsync_document_with_translation())));
let (service, _dir) = service_with(providers.clone()).await;
let mut translated = request();
translated.language = Some("es".into());
service.get(translated.clone()).await.unwrap();
// Same language again -> synced cache hit WITH the stored
// translation; no second provider call.
let response = service.get(translated).await.unwrap();
let result = found(&response);
assert!(result.payload.cached);
assert!(result.doc.has_translation);
let translation = result.doc.translation.as_ref().expect("cached translation");
assert_eq!(translation.lang.as_deref(), Some("es"));
assert!(translation.lines[0].words.is_some());
assert_eq!(providers.qobuz_calls.load(Ordering::SeqCst), 1);
}
#[tokio::test]
async fn different_language_refetches_original_only_uses_the_cache() {
let providers = Arc::new(FakeProviders::default());
{
let mut q = providers.qobuz_queue.lock().unwrap();
q.push_back(Ok(Some(wsync_document_with_translation())));
q.push_back(Ok(Some(wsync_document_with_translation())));
}
let (service, _dir) = service_with(providers.clone()).await;
// Seed the cache with the es translation.
let mut es = request();
es.language = Some("es".into());
service.get(es).await.unwrap();
// A request for a DIFFERENT language misses the stored translation
// and refetches (spec §A.5: the stored translation records its lang).
let mut fr = request();
fr.language = Some("fr".into());
let response = service.get(fr).await.unwrap();
assert!(!found(&response).payload.cached);
assert_eq!(providers.qobuz_calls.load(Ordering::SeqCst), 2);
// Original-only requests are still served by the synced cache hit.
let response = service.get(request()).await.unwrap();
let result = found(&response);
assert!(result.payload.cached);
assert!(!result.doc.has_translation);
assert_eq!(providers.qobuz_calls.load(Ordering::SeqCst), 2);
// The default fetch sent NO language.
assert_eq!(
providers.qobuz_languages.lock().unwrap().as_slice(),
&[Some("es".to_string()), Some("fr".to_string())]
);
}
#[tokio::test]
async fn default_fetch_maps_original_only_even_when_langs_are_listed() {
let providers = Arc::new(FakeProviders::default());
providers
.qobuz_queue
.lock()
.unwrap()
.push_back(Ok(Some(wsync_document())));
let (service, _dir) = service_with(providers.clone()).await;
let response = service.get(request()).await.unwrap();
let result = found(&response);
// translation_langs passthrough present, but nothing was requested:
// no translation, has_translation false.
assert_eq!(result.doc.translation_langs, vec!["es"]);
assert!(result.doc.translation.is_none());
assert!(!result.doc.has_translation);
assert_eq!(
providers.qobuz_languages.lock().unwrap().as_slice(),
&[None]
);
}
#[tokio::test]
async fn plain_original_with_plain_translation_is_mapped() {
let providers = Arc::new(FakeProviders::default());
providers
.qobuz_queue
.lock()
.unwrap()
.push_back(Ok(Some(serde_json::from_str(
r#"{
"track_id": 100, "album_id": "alb",
"translation_langs": ["de"],
"original": {"type": "plain", "lang": "en",
"lines": [{"line": "plain one"}, {"line": "plain two"}]},
"translation": {"type": "plain", "lang": "de",
"lines": [{"line": "einfach eins"}, {"line": "einfach zwei"}]}
}"#,
)
.unwrap())));
let (service, _dir) = service_with(providers.clone()).await;
let mut translated = request();
translated.language = Some("de".into());
let response = service.get(translated).await.unwrap();
let result = found(&response);
assert_eq!(result.payload.provider, LyricsProvider::Qobuz);
assert!(!result.doc.synced);
assert!(result.doc.has_translation);
let translation = result.doc.translation.as_ref().expect("translation mapped");
assert_eq!(translation.kind, crate::LyricsKind::Plain);
assert_eq!(translation.lines.len(), 2);
assert_eq!(translation.lines[0].text, "einfach eins");
}
// ---------- cache policy ----------
#[tokio::test]
+208 -5
View File
@@ -10,14 +10,18 @@
//! live captures `qbz-nix-docs/qobuz-api/lyrics-doc-wsync.json`), so a wire
//! content union parses as a [`QobuzWsync`] and a stored [`QobuzWsync`] is
//! wire-shaped. The Qobuz wrapper metadata (`translation_langs`, `writers`)
//! is carried as additive optional fields so it survives the cache.
//! and the v10 `translation` block are carried as additive optional fields
//! so they survive the cache.
use serde::{Deserialize, Serialize};
use qbz_qobuz::{QobuzLyricsContent, QobuzLyricsDocument};
use crate::lrc::{emit_lrc, LrcSpan};
use crate::model::{LyricsDoc, LyricsLine, LyricsProvider, Word};
use crate::model::{
derive_has_translation, LyricsDoc, LyricsKind, LyricsLine, LyricsProvider, TranslatedLyrics,
Word,
};
/// Discriminator tag — always `"wsync"` on output; accepts `"lsync"` on input
/// (the yaml's guess, kept as alias like the wire DTO does) and defaults when
@@ -43,6 +47,13 @@ pub struct QobuzWsync {
pub translation_langs: Vec<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub writers: Option<String>,
/// Embedded translation (API v10), kept in the wire content-union shape
/// so it persists verbatim inside the cache JSON; the content's own
/// `lang` records which language the translation is for (a request for a
/// DIFFERENT language refetches). `serde(default)` — no DB migration:
/// rows written before this member existed still deserialize.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub translation: Option<QobuzLyricsContent>,
}
/// One synced line, wire-shaped. Gap separator lines come as
@@ -99,6 +110,7 @@ impl QobuzWsync {
.collect(),
translation_langs: doc.translation_langs.clone(),
writers: doc.writers.clone(),
translation: doc.translation.clone(),
}),
QobuzLyricsContent::Plain { .. } => None,
}
@@ -107,8 +119,10 @@ impl QobuzWsync {
/// Convert to the domain model. Gap separator lines (empty text) and
/// unplaceable lines (text without a `start` stamp) are skipped — in
/// wsync the previous line already carries its explicit `end`, so nothing
/// is lost. Native word stamps are preserved.
pub fn to_doc(&self) -> LyricsDoc {
/// is lost. Native word stamps are preserved. `requested_lang` (the
/// active translation target, if any) drives the client-derived
/// `has_translation`; the embedded translation maps like the original.
pub fn to_doc(&self, requested_lang: Option<&str>) -> LyricsDoc {
let lines: Vec<LyricsLine> = self
.lines
.iter()
@@ -142,6 +156,11 @@ impl QobuzWsync {
provider: LyricsProvider::Qobuz,
translation_langs: self.translation_langs.clone(),
writers: self.writers.clone(),
translation: self
.translation
.as_ref()
.map(|content| Box::new(translated_from_content(content))),
has_translation: derive_has_translation(&self.translation_langs, requested_lang),
}
}
@@ -165,6 +184,69 @@ impl QobuzWsync {
}
}
/// Map a wire content union to the domain [`TranslatedLyrics`] — used for a
/// document's embedded `translation` block. Kind dispatch mirrors the
/// Android v10 mapper (`qt6.java`): wsync (any word stamps) -> WordSynced,
/// lsync (synced, no words) -> LineSynced, plain -> Plain. Synced lines keep
/// their stamps (the SAME timings as the original) and are filtered exactly
/// like `to_doc`, so translation lines stay 1:1 aligned with the rendered
/// original lines.
pub(crate) fn translated_from_content(content: &QobuzLyricsContent) -> TranslatedLyrics {
match content {
QobuzLyricsContent::Synced { lang, lines } => {
let mapped: Vec<LyricsLine> = lines
.iter()
.filter(|line| !line.line.trim().is_empty())
.filter_map(|line| {
let start = line.start?;
Some(LyricsLine {
time_ms: Some(start),
end_ms: line.end,
text: line.line.clone(),
words: if line.words.is_empty() {
None
} else {
Some(
line.words
.iter()
.map(|word| Word {
start: word.start,
end: word.end,
text: word.word.clone(),
})
.collect(),
)
},
})
})
.collect();
let kind = if mapped.iter().any(|line| line.words.is_some()) {
LyricsKind::WordSynced
} else {
LyricsKind::LineSynced
};
TranslatedLyrics {
kind,
lang: lang.clone(),
lines: mapped,
}
}
QobuzLyricsContent::Plain { lang, lines } => TranslatedLyrics {
kind: LyricsKind::Plain,
lang: lang.clone(),
lines: lines
.iter()
.map(|line| LyricsLine {
time_ms: None,
end_ms: None,
text: line.line.clone(),
words: None,
})
.collect(),
},
}
}
#[cfg(test)]
mod tests {
use super::*;
@@ -228,7 +310,7 @@ mod tests {
#[test]
fn to_doc_skips_gaps_and_preserves_words() {
let wsync = QobuzWsync::from_document(&sample_document()).unwrap();
let doc = wsync.to_doc();
let doc = wsync.to_doc(None);
assert!(doc.synced);
assert_eq!(doc.provider, LyricsProvider::Qobuz);
assert_eq!(doc.lines.len(), 2); // gap separator dropped from render model
@@ -282,4 +364,125 @@ mod tests {
let parsed: QobuzWsync = serde_json::from_str(lsync).unwrap();
assert_eq!(parsed.lines[0].start, Some(1));
}
fn sample_document_with_translation() -> QobuzLyricsDocument {
// v10 shape: the document embeds a `translation` block (same content
// union as `original`) when a `language` was requested.
let json = r#"{
"album_id": "gvcirtodd95kc",
"track_id": 266725027,
"translation_langs": ["pt", "de", "fr", "es", "it"],
"writers": "Billie Eilish O'Connell",
"original": {
"type": "wsync",
"lang": "en",
"lines": [
{"line": "Oh, mm-mm", "start": 1750, "end": 4770,
"words": [
{"word": "Oh,", "start": 1750, "end": 2480},
{"word": "mm-mm", "start": 2480, "end": 4770}
]}
]
},
"translation": {
"type": "wsync",
"lang": "es",
"lines": [
{"line": "Oh, mm-mm (es)", "start": 1750, "end": 4770,
"words": [
{"word": "Oh,", "start": 1750, "end": 2480},
{"word": "mm-mm", "start": 2480, "end": 4770}
]}
]
}
}"#;
serde_json::from_str(json).expect("valid translation fixture")
}
#[test]
fn from_document_carries_the_embedded_translation() {
let wsync =
QobuzWsync::from_document(&sample_document_with_translation()).expect("synced doc");
let translation = wsync.translation.expect("translation preserved");
assert_eq!(translation.lang(), Some("es"));
assert_eq!(translation.line_count(), 1);
// 9.x documents (no `translation` member) keep `translation: None`.
let wsync = QobuzWsync::from_document(&sample_document()).expect("synced doc");
assert!(wsync.translation.is_none());
}
#[test]
fn to_doc_maps_translation_and_derives_has_translation() {
let wsync = QobuzWsync::from_document(&sample_document_with_translation()).unwrap();
// Requested lang listed -> has_translation; translation mapped with
// kind dispatch (wsync -> WordSynced) and native word stamps.
let doc = wsync.to_doc(Some("es"));
assert!(doc.has_translation);
let translation = doc.translation.expect("translation mapped");
assert_eq!(translation.kind, LyricsKind::WordSynced);
assert_eq!(translation.lang.as_deref(), Some("es"));
assert_eq!(translation.lines.len(), 1);
assert_eq!(translation.lines[0].time_ms, Some(1750));
let words = translation.lines[0].words.as_ref().expect("words survive");
assert_eq!(words[1].text, "mm-mm");
assert_eq!(words[1].start, 2480);
// Requested lang NOT in translation_langs -> no has_translation (the
// mapped block may still be present; the caller renders original-only).
let doc = wsync.to_doc(Some("ja"));
assert!(!doc.has_translation);
// No language requested -> has_translation false by construction.
let doc = wsync.to_doc(None);
assert!(!doc.has_translation);
assert!(doc.translation.is_some());
}
#[test]
fn translation_kind_dispatch_covers_lsync_and_plain() {
// lsync: synced without words -> LineSynced.
let content: QobuzLyricsContent = serde_json::from_str(
r#"{"type":"lsync","lang":"fr","lines":[{"line":"salut","start":100,"end":200}]}"#,
)
.unwrap();
let translated = translated_from_content(&content);
assert_eq!(translated.kind, LyricsKind::LineSynced);
assert_eq!(translated.lines[0].time_ms, Some(100));
assert!(translated.lines[0].words.is_none());
// plain: text-only lines -> Plain, no stamps.
let content: QobuzLyricsContent = serde_json::from_str(
r#"{"type":"plain","lang":"de","lines":[{"line":"hallo"},{"line":"welt"}]}"#,
)
.unwrap();
let translated = translated_from_content(&content);
assert_eq!(translated.kind, LyricsKind::Plain);
assert_eq!(translated.lines.len(), 2);
assert_eq!(translated.lines[0].time_ms, None);
}
#[test]
fn stored_json_with_translation_round_trips_and_old_rows_still_load() {
let wsync = QobuzWsync::from_document(&sample_document_with_translation()).unwrap();
let json = serde_json::to_string(&wsync).unwrap();
let back: QobuzWsync = serde_json::from_str(&json).unwrap();
assert_eq!(back, wsync);
assert_eq!(
back.translation.as_ref().and_then(|t| t.lang().map(str::to_owned)),
Some("es".to_string())
);
// NO DB migration: a row written BEFORE the translation member
// existed must still deserialize (serde default -> None).
let old_format = r#"{"type":"wsync","lang":"en","translation_langs":["es","fr"],
"lines":[{"line":"hi","start":1,"end":2,
"words":[{"word":"hi","start":1,"end":2}]}]}"#;
let parsed: QobuzWsync = serde_json::from_str(old_format).unwrap();
assert!(parsed.translation.is_none());
let doc = parsed.to_doc(Some("es"));
assert!(doc.translation.is_none());
assert!(doc.has_translation, "lang listed -> has_translation");
}
}
+51
View File
@@ -127,6 +127,14 @@ pub struct UserSession {
pub subscription_label: String,
#[serde(default)]
pub subscription_valid_until: Option<String>,
/// Account territory (ISO 3166-1 alpha-2, e.g. "FR") from the login
/// response. `serde(default)` keeps pre-v10 persisted sessions loadable.
#[serde(default)]
pub country_code: Option<String>,
/// Account language (ISO 639-1, e.g. "fr") from the login response —
/// the default target for lyrics translation ("Auto").
#[serde(default)]
pub language_code: Option<String>,
}
// ============ Stream Types ============
@@ -1475,3 +1483,46 @@ pub struct ArtistStoryAuthor {
#[serde(default)]
pub slug: Option<String>,
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn user_session_deserializes_pre_v10_json() {
// Sessions persisted before the country/language capture must still
// load: both new fields default to None (feature stays Auto-off).
let json = r#"{
"user_auth_token": "token",
"user_id": 1705826,
"email": "a@b.c",
"display_name": "Tester",
"subscription_label": "Studio",
"subscription_valid_until": null
}"#;
let session: UserSession = serde_json::from_str(json).expect("old session json loads");
assert_eq!(session.country_code, None);
assert_eq!(session.language_code, None);
assert_eq!(session.user_id, 1705826);
}
#[test]
fn user_session_round_trips_country_and_language() {
let json = r#"{
"user_auth_token": "token",
"user_id": 1705826,
"email": "a@b.c",
"display_name": "Tester",
"subscription_label": "Studio",
"subscription_valid_until": null,
"country_code": "FR",
"language_code": "fr"
}"#;
let session: UserSession = serde_json::from_str(json).expect("v10 session json loads");
assert_eq!(session.country_code.as_deref(), Some("FR"));
assert_eq!(session.language_code.as_deref(), Some("fr"));
let back: UserSession =
serde_json::from_str(&serde_json::to_string(&session).unwrap()).unwrap();
assert_eq!(back.language_code.as_deref(), Some("fr"));
}
}
+32 -11
View File
@@ -6,8 +6,12 @@
//! `qbz-nix-docs/qobuz-api/` before freezing the serde structs.
//!
//! Usage:
//! cargo run -p qbz-qobuz --example lyrics_probe # default track ids
//! cargo run -p qbz-qobuz --example lyrics_probe 123 456 # explicit ids
//! cargo run -p qbz-qobuz --example lyrics_probe # default track ids
//! cargo run -p qbz-qobuz --example lyrics_probe 123 456 # explicit ids
//! cargo run -p qbz-qobuz --example lyrics_probe --lang=es 123 # + translation target
//!
//! `--lang=<iso639-1>` exercises the v10 `language` query param (translation
//! request); omitted = original-only fetch.
//!
//! Strictly read-only: login + GETs, no mutations.
@@ -41,15 +45,23 @@ const DEFAULT_TRACK_IDS: &[u64] = &[266725027, 29006863, 34];
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let _ = log::set_logger(&LOGGER).map(|_| log::set_max_level(log::LevelFilter::Debug));
let args: Vec<u64> = std::env::args()
.skip(1)
.filter_map(|a| a.parse().ok())
.collect();
let track_ids: Vec<u64> = if args.is_empty() {
let mut language: Option<String> = None;
let mut ids: Vec<u64> = Vec::new();
for arg in std::env::args().skip(1) {
if let Some(lang) = arg.strip_prefix("--lang=") {
language = Some(lang.to_string());
} else if let Ok(id) = arg.parse() {
ids.push(id);
}
}
let track_ids: Vec<u64> = if ids.is_empty() {
DEFAULT_TRACK_IDS.to_vec()
} else {
args
ids
};
if let Some(lang) = &language {
eprintln!("[probe] translation target language: {}", lang);
}
let client = QobuzClient::new()?;
let warm = client.init().await?;
@@ -135,7 +147,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
}
// Step 1 raw: signed GET /track/lyricsUrl
let (status, body) = match client.get_lyrics_url_raw(track_id).await {
let (status, body) = match client.get_lyrics_url_raw(track_id, language.as_deref()).await {
Ok(pair) => pair,
Err(e) => {
println!("[lyricsUrl] transport error: {}", e);
@@ -146,7 +158,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("[lyricsUrl] raw body:\n{}", body);
// Typed step 1
let urls = match client.get_lyrics_url(track_id).await {
let urls = match client.get_lyrics_url(track_id, language.as_deref()).await {
Ok(Some(urls)) => urls,
Ok(None) => {
println!("[lyricsUrl] typed result: MISS (no lyrics)");
@@ -179,7 +191,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
}
// Typed full chain
match client.get_lyrics(track_id).await {
match client.get_lyrics(track_id, language.as_deref()).await {
Ok(Some(doc)) => {
let content = doc.original.as_ref().expect("get_lyrics guarantees original");
println!(
@@ -189,6 +201,15 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
doc.translation_langs,
doc.writers
);
match doc.translation.as_ref() {
Some(translation) => println!(
"[get_lyrics] embedded translation: {} with {} lines (lang: {:?})",
if translation.is_synced() { "SYNCED" } else { "PLAIN" },
translation.line_count(),
translation.lang()
),
None => println!("[get_lyrics] no embedded translation"),
}
}
Ok(None) => println!("[get_lyrics] typed result: MISS"),
Err(e) => println!("[get_lyrics] typed error: {}", e),
+52
View File
@@ -146,6 +146,19 @@ pub fn parse_login_response(response: &serde_json::Value) -> Result<UserSession>
.and_then(|c| c.get("parameters"))
.and_then(parse_subscription_valid_until);
// Account territory + language (snake_case wire names, verbatim in
// Qobuz's own embedded /user/login fixture — see qbz-nix-docs
// offline-mode/tauri-review-2026-06-09/10-subscription-trial-offline-
// gating.md §1.2). Absent on older captures -> None (feature stays off).
let country_code = user
.get("country_code")
.and_then(|v| v.as_str())
.map(str::to_string);
let language_code = user
.get("language_code")
.and_then(|v| v.as_str())
.map(str::to_string);
// Check if user has valid subscription
let has_subscription = credential
.and_then(|c| c.get("parameters"))
@@ -163,6 +176,8 @@ pub fn parse_login_response(response: &serde_json::Value) -> Result<UserSession>
display_name,
subscription_label,
subscription_valid_until,
country_code,
language_code,
})
}
@@ -201,4 +216,41 @@ mod tests {
let sig = sign_get_file_url(123456, 27, 1234567890, "testsecret");
assert_eq!(sig.len(), 32);
}
fn login_response(user_extra: serde_json::Value) -> serde_json::Value {
let mut user = serde_json::json!({
"id": 1705826,
"email": "a@b.c",
"display_name": "Tester",
"credential": {"parameters": {"short_label": "Studio"}}
});
user.as_object_mut()
.unwrap()
.extend(user_extra.as_object().unwrap().clone());
serde_json::json!({
"user_auth_token": "token",
"user": user,
})
}
#[test]
fn parse_login_response_captures_country_and_language() {
let response = login_response(serde_json::json!({
"country_code": "FR",
"language_code": "fr",
}));
let session = parse_login_response(&response).expect("valid login response");
assert_eq!(session.country_code.as_deref(), Some("FR"));
assert_eq!(session.language_code.as_deref(), Some("fr"));
}
#[test]
fn parse_login_response_tolerates_missing_country_and_language() {
// Older captures / partial payloads: both stay None (feature off),
// the rest of the session parses as before.
let response = login_response(serde_json::json!({}));
let session = parse_login_response(&response).expect("valid login response");
assert_eq!(session.country_code, None);
assert_eq!(session.language_code, None);
}
}
+148 -12
View File
@@ -13,7 +13,9 @@ use super::bundle::{self, BundleTokens};
use super::endpoints::{self, paths};
use super::error::{ApiError, Result};
use super::forbidden_breaker::ForbiddenBreaker;
use super::lyrics::{QobuzLyricsDocument, QobuzLyricsUrls};
use super::lyrics::{
merge_translation_into, QobuzLyricsContent, QobuzLyricsDocument, QobuzLyricsUrls,
};
use qbz_models::*;
const USER_AGENT: &str = "Mozilla/5.0 (X11; Linux x86_64; rv:120.0) Gecko/20100101 Firefox/120.0";
@@ -324,6 +326,17 @@ impl QobuzClient {
*self.session.write().await = Some(session);
}
/// Account language (ISO 639-1) of the active session, if the login
/// response carried one — the "Auto" target for lyrics translation.
/// `None` pre-login and for pre-v10 persisted sessions.
pub async fn session_language_code(&self) -> Option<String> {
self.session
.read()
.await
.as_ref()
.and_then(|s| s.language_code.clone())
}
/// Exchange an OAuth code for a full user session.
///
/// This implements the new Qobuz OAuth flow:
@@ -1397,14 +1410,27 @@ impl QobuzClient {
/// client, so this is the only way diagnostic tooling (e.g.
/// `examples/lyrics_probe.rs`) can observe the exact wire shape; the
/// typed [`Self::get_lyrics_url`] builds on it.
pub async fn get_lyrics_url_raw(&self, track_id: u64) -> Result<(u16, String)> {
///
/// `language` (ISO 639-1, API v10) requests a translation; it is appended
/// to the signed param list ONLY when `Some` (`sign_request` sorts the
/// kv pairs alphabetically, so signing needs no change). Pass `None` for
/// the original-only fetch.
pub async fn get_lyrics_url_raw(
&self,
track_id: u64,
language: Option<&str>,
) -> Result<(u16, String)> {
let url = endpoints::build_url(paths::TRACK_LYRICS_URL);
// Signing method name per the concatenation convention ("trackget" at
// get_track, "trackgetFileUrl" in auth.rs): path with slashes removed,
// case preserved -> "tracklyricsUrl". Verified against the live API
// 2026-06-10 (HTTP 200 with a valid envelope).
let mut params = vec![("track_id", track_id.to_string())];
if let Some(language) = language {
params.push(("language", language.to_string()));
}
let response = self
.signed_get_auth(&url, "tracklyricsUrl", &[("track_id", track_id.to_string())])
.signed_get_auth(&url, "tracklyricsUrl", &params)
.await?;
let status = response.status().as_u16();
let body = response.text().await?;
@@ -1418,8 +1444,12 @@ impl QobuzClient {
/// `Err` is reserved for transport/auth/offline failures — the lyrics
/// orchestrator degrades those to a miss as well (spec §1.1); nothing in
/// this path is ever a user-facing error.
pub async fn get_lyrics_url(&self, track_id: u64) -> Result<Option<QobuzLyricsUrls>> {
let (status, body) = self.get_lyrics_url_raw(track_id).await?;
pub async fn get_lyrics_url(
&self,
track_id: u64,
language: Option<&str>,
) -> Result<Option<QobuzLyricsUrls>> {
let (status, body) = self.get_lyrics_url_raw(track_id, language).await?;
if status != 200 {
// Live-observed miss: HTTP 404 with body
// {"status":"error","code":404,"message":"No lyrics found"}
@@ -1458,14 +1488,74 @@ impl QobuzClient {
/// — a pre-signed CloudFront URL (`Expires`/`Signature`/`Key-Pair-Id`);
/// no `X-App-Id`/auth headers are sent (verified live 2026-06-10, HTTP
/// 200 on a bare GET). `Ok(None)` = typed miss, same contract as
/// [`Self::get_lyrics_url`]; a document without `original` content also
/// counts as a miss.
pub async fn get_lyrics(&self, track_id: u64) -> Result<Option<QobuzLyricsDocument>> {
let urls = match self.get_lyrics_url(track_id).await? {
/// [`Self::get_lyrics_url`]; a document without usable content counts as
/// a miss.
///
/// `language` (ISO 639-1, API v10) requests a translation; `None` fetches
/// original-only (the default flow). LIVE WIRE (verified 2026-07-22):
/// when a translation is requested AND available, `lyrics_url` points at
/// the TRANSLATED document (`<id>-<lang>.json`), which carries ONLY
/// `translation` and no `original` — so this fn then fetches the
/// original-only document too and merges both into one bilingual
/// document. When requested but NOT available the signed CDN URL 403s →
/// typed miss (fail soft). When the document has an `original` but does
/// not EMBED a `translation` block, the envelope's
/// `translation_requested.lyrics_url` is fetched as a fallback and its
/// content becomes the translation (fail soft: any gap in that fallback
/// just leaves the document original-only).
pub async fn get_lyrics(
&self,
track_id: u64,
language: Option<&str>,
) -> Result<Option<QobuzLyricsDocument>> {
let doc = match self.fetch_lyrics_doc(track_id, language).await? {
Some(doc) => doc,
None => return Ok(None),
};
if language.is_some() && doc.original.is_none() && doc.translation.is_some() {
// Translation-only document (the common v10 live shape): fetch the
// original document separately and merge into one bilingual doc.
return match self.fetch_lyrics_doc(track_id, None).await? {
Some(mut original_doc) if original_doc.original.is_some() => {
merge_translation_into(&mut original_doc, doc);
Ok(Some(original_doc))
}
_ => {
log::debug!(
"[API] get_lyrics({}) translation found but original doc missing -> no lyrics",
track_id
);
Ok(None)
}
};
}
// Preserve the original-only miss semantics: a document with neither
// `original` nor a mergeable `translation` is unusable.
if doc.original.is_none() {
log::debug!(
"[API] get_lyrics({}) document without original content -> no lyrics",
track_id
);
return Ok(None);
}
Ok(Some(doc))
}
/// One lyrics round trip (signed lyricsUrl + bare CDN GET). Accepts any
/// document carrying `original` OR `translation` content; the caller
/// decides which shapes are usable (see [`Self::get_lyrics`]).
async fn fetch_lyrics_doc(
&self,
track_id: u64,
language: Option<&str>,
) -> Result<Option<QobuzLyricsDocument>> {
let urls = match self.get_lyrics_url(track_id, language).await? {
Some(urls) => urls,
None => return Ok(None),
};
let lyrics_url = match urls.lyrics_url {
let lyrics_url = match urls.lyrics_url.clone() {
Some(url) => url,
None => return Ok(None),
};
@@ -1482,10 +1572,17 @@ impl QobuzClient {
}
let body = response.text().await?;
match serde_json::from_str::<QobuzLyricsDocument>(&body) {
Ok(doc) if doc.original.is_some() => Ok(Some(doc)),
Ok(mut doc) if doc.original.is_some() || doc.translation.is_some() => {
if language.is_some() && doc.original.is_some() && doc.translation.is_none() {
doc.translation = self
.fetch_translation_fallback(track_id, &urls)
.await;
}
Ok(Some(doc))
}
Ok(_) => {
log::debug!(
"[API] get_lyrics({}) document without original content -> no lyrics",
"[API] get_lyrics({}) document without any lyrics content -> no lyrics",
track_id
);
Ok(None)
@@ -1501,6 +1598,45 @@ impl QobuzClient {
}
}
/// Fallback translation source (spec §B.3): when the main document did
/// not embed a `translation` block, fetch the document the envelope's
/// `translation_requested.lyrics_url` points at (same bare CDN GET) and
/// take its content as the translation. Every failure mode degrades to
/// `None` — translation is best-effort, never an error.
async fn fetch_translation_fallback(
&self,
track_id: u64,
urls: &QobuzLyricsUrls,
) -> Option<QobuzLyricsContent> {
let translation_url = urls
.translation_requested
.as_ref()
.and_then(|t| t.lyrics_url.as_deref())?;
let response = self.http().ok()?.get(translation_url).send().await.ok()?;
if !response.status().is_success() {
log::debug!(
"[API] get_lyrics({}) translation doc status={} -> original only",
track_id,
response.status()
);
return None;
}
let body = response.text().await.ok()?;
match serde_json::from_str::<QobuzLyricsDocument>(&body) {
// The translation document carries its content under `original`
// (same wrapper shape as the main document).
Ok(doc) => doc.original,
Err(e) => {
log::debug!(
"[API] get_lyrics({}) unparsable translation doc ({}) -> original only",
track_id,
e
);
None
}
}
}
/// Get artist by ID (basic info only - no albums, faster response)
pub async fn get_artist_basic(&self, artist_id: u64) -> Result<Artist> {
let url = endpoints::build_url(paths::ARTIST_GET);
+3 -2
View File
@@ -58,6 +58,7 @@ pub use cmaf::{
pub use error::{ApiError, Result};
pub use link_resolver::{resolve_link, LinkResolverError, ResolvedLink};
pub use lyrics::{
QobuzLyricsContent, QobuzLyricsDocument, QobuzLyricsLine, QobuzLyricsPlainLine,
QobuzLyricsPublisher, QobuzLyricsTranslation, QobuzLyricsUrls, QobuzLyricsWord,
merge_translation_into, QobuzLyricsContent, QobuzLyricsDocument, QobuzLyricsLine,
QobuzLyricsPlainLine, QobuzLyricsPublisher, QobuzLyricsTranslation, QobuzLyricsUrls,
QobuzLyricsWord,
};
+229 -11
View File
@@ -21,7 +21,7 @@
//! All fields stay serde-tolerant (`Option` / `#[serde(default)]`) — the
//! endpoint is a beta-era delta and may still move.
use serde::{Deserialize, Deserializer};
use serde::{Deserialize, Deserializer, Serialize};
/// Accept either a JSON string or a JSON number and normalize to `String`.
///
@@ -62,15 +62,16 @@ pub struct QobuzLyricsUrls {
/// URL to the original-language lyrics document (Qobuz CDN host).
#[serde(default)]
pub lyrics_url: Option<String>,
/// Present only when the `translation` query param was sent AND a matching
/// translation exists (yaml:208-213). We never send `translation` in v1,
/// so this stays `None` (confirmed absent in the live capture).
/// Present only when the `language` query param was sent AND a matching
/// translation exists (yaml:208-213). Absent when no translation was
/// requested (confirmed absent in the live capture) or none is available
/// for the requested language.
#[serde(default)]
pub translation_requested: Option<QobuzLyricsTranslation>,
}
/// Translation pointer inside [`QobuzLyricsUrls`] (yaml `LyricsTranslationDto`, `:221-231`).
/// Unverified live (v1 never requests translations); kept yaml-shaped + tolerant.
/// Kept yaml-shaped + tolerant.
#[derive(Debug, Clone, Deserialize)]
pub struct QobuzLyricsTranslation {
#[serde(default)]
@@ -92,7 +93,8 @@ pub struct QobuzLyricsDocument {
/// ISO 639-1 codes a translation exists for (e.g. `["pt","de","fr","es","it"]`).
#[serde(default)]
pub translation_langs: Vec<String>,
/// Publisher copyright entries with applicability zones.
/// Publisher copyright entries with applicability zones. Parsed but never
/// enforced (owner decision 2026-07-22: no zone/copyright gating).
#[serde(default)]
pub publishers: Vec<QobuzLyricsPublisher>,
/// Songwriter credits as a single display string.
@@ -101,6 +103,31 @@ pub struct QobuzLyricsDocument {
/// The actual lyrics content (the yaml's "LyricsContentDto" union).
#[serde(default)]
pub original: Option<QobuzLyricsContent>,
/// Translated lyrics content (NEW in API v10) — same union shape as
/// `original`. LIVE WIRE (verified 2026-07-22): when `language` is
/// requested and available, the step-1 `lyrics_url` itself points at the
/// TRANSLATED document (`<id>-<lang>.json`), which carries ONLY this
/// `translation` block and no `original` — the client must fetch the
/// original document separately and merge. `translation_requested` was
/// not observed in practice (kept as a fallback source only).
#[serde(default)]
pub translation: Option<QobuzLyricsContent>,
}
/// Merge a translation-only document into its original document (v10 live
/// wire: a `language` request returns a document carrying ONLY `translation`).
/// Moves the `translation` block over and unions `translation_langs`.
/// `original` keeps its own content/writers/publishers.
pub fn merge_translation_into(
original: &mut QobuzLyricsDocument,
mut translated: QobuzLyricsDocument,
) {
original.translation = translated.translation.take();
for lang in translated.translation_langs.drain(..) {
if !original.translation_langs.contains(&lang) {
original.translation_langs.push(lang);
}
}
}
/// One publisher credit inside [`QobuzLyricsDocument`] (live-only; not in the yaml).
@@ -118,8 +145,9 @@ pub struct QobuzLyricsPublisher {
/// Live discriminator is `"wsync"` (word-synced — richer than the yaml's
/// `"lsync"` guess: per-word timestamps inside each line). `"lsync"` is kept
/// as an alias in case line-only documents exist in the catalog (same shape
/// minus `words`, which defaults to empty).
#[derive(Debug, Clone, Deserialize)]
/// minus `words`, which defaults to empty). `Serialize` exists so the lyrics
/// cache can persist a document's embedded translation verbatim.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(tag = "type")]
pub enum QobuzLyricsContent {
/// Time-synced lyrics; line + per-word timestamps, ms from track start.
@@ -154,6 +182,14 @@ impl QobuzLyricsContent {
QobuzLyricsContent::Plain { lines, .. } => lines.len(),
}
}
/// ISO 639-1 of the content's language, when the document carries it.
pub fn lang(&self) -> Option<&str> {
match self {
QobuzLyricsContent::Synced { lang, .. } => lang.as_deref(),
QobuzLyricsContent::Plain { lang, .. } => lang.as_deref(),
}
}
}
/// One synced line.
@@ -162,7 +198,7 @@ impl QobuzLyricsContent {
/// required): instrumental-gap separator lines come as `{"line":"","words":[]}`
/// with NO `start`/`end` at all — both must be `Option`. Regular lines carry
/// line-level `start`/`end` plus per-word stamps (lyrics-doc-wsync.json).
#[derive(Debug, Clone, Deserialize)]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct QobuzLyricsLine {
#[serde(default)]
pub line: String,
@@ -178,7 +214,7 @@ pub struct QobuzLyricsLine {
}
/// One word inside a synced line (live-only; not in the yaml).
#[derive(Debug, Clone, Deserialize)]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct QobuzLyricsWord {
#[serde(default)]
pub word: String,
@@ -193,7 +229,7 @@ pub struct QobuzLyricsWord {
/// One plain line. Live wire form is an object `{"line": "..."}`
/// (lyrics-doc-plain.json); the yaml guessed bare strings (`:287-303`) —
/// accept both.
#[derive(Debug, Clone)]
#[derive(Debug, Clone, Serialize, PartialEq)]
pub struct QobuzLyricsPlainLine {
pub line: String,
}
@@ -229,8 +265,18 @@ mod tests {
// synced/plain docs are truncated to a few lines here to avoid vendoring
// full copyrighted lyrics in the repo — the STRUCTURE is verbatim).
const URL_RESPONSE: &str = include_str!("../tests/fixtures/lyrics-url-response.json");
const URL_RESPONSE_TRANSLATION: &str =
include_str!("../tests/fixtures/lyrics-url-response-translation.json");
const DOC_WSYNC: &str = include_str!("../tests/fixtures/lyrics-doc-wsync.json");
const DOC_PLAIN: &str = include_str!("../tests/fixtures/lyrics-doc-plain.json");
const DOC_WSYNC_TRANSLATION: &str =
include_str!("../tests/fixtures/lyrics-doc-wsync-translation.json");
const DOC_LSYNC_TRANSLATION: &str =
include_str!("../tests/fixtures/lyrics-doc-lsync-translation.json");
const DOC_PLAIN_TRANSLATION: &str =
include_str!("../tests/fixtures/lyrics-doc-plain-translation.json");
const DOC_TRANSLATION_ONLY: &str =
include_str!("../tests/fixtures/lyrics-doc-translation-only.json");
const MISS_RESPONSE: &str = include_str!("../tests/fixtures/lyrics-miss-response.json");
#[test]
@@ -320,6 +366,178 @@ mod tests {
assert_eq!(urls.album_id.as_deref(), Some("2"));
}
#[test]
fn deserialize_lyrics_url_response_with_translation_requested() {
// v10: when a `language` was requested and a translation exists, the
// envelope carries the `translation_requested` pointer (yaml
// `LyricsTranslationDto`).
let urls: QobuzLyricsUrls =
serde_json::from_str(URL_RESPONSE_TRANSLATION).expect("parse translation envelope");
assert_eq!(urls.track_id.as_deref(), Some("266725027"));
let requested = urls
.translation_requested
.expect("translation_requested present");
assert_eq!(requested.lang.as_deref(), Some("es"));
assert!(requested
.lyrics_url
.as_deref()
.unwrap_or("")
.starts_with("https://"));
}
#[test]
fn deserialize_document_with_wsync_translation() {
let doc: QobuzLyricsDocument =
serde_json::from_str(DOC_WSYNC_TRANSLATION).expect("parse wsync+translation document");
assert_eq!(doc.translation_langs.len(), 5);
let original = doc.original.expect("original present");
assert!(original.is_synced());
assert_eq!(original.lang(), Some("en"));
let translation = doc.translation.expect("embedded translation present");
assert!(translation.is_synced());
assert_eq!(translation.lang(), Some("es"));
match &translation {
QobuzLyricsContent::Synced { lines, .. } => {
assert_eq!(lines.len(), 3);
assert_eq!(lines[0].line, "Primera linea traducida");
assert_eq!(lines[0].words.len(), 3);
assert_eq!(lines[0].words[2].word, "traducida");
assert!(lines[1].start.is_none(), "gap line without stamps");
}
_ => unreachable!(),
}
}
#[test]
fn deserialize_document_with_lsync_translation() {
// Line-synced variant: lsync alias on BOTH original and translation,
// no per-word stamps.
let doc: QobuzLyricsDocument =
serde_json::from_str(DOC_LSYNC_TRANSLATION).expect("parse lsync+translation document");
let original = doc.original.expect("original present");
assert!(original.is_synced());
let translation = doc.translation.expect("translation present");
match &translation {
QobuzLyricsContent::Synced { lang, lines } => {
assert_eq!(lang.as_deref(), Some("fr"));
assert_eq!(lines.len(), 2);
assert!(lines[0].words.is_empty());
assert_eq!(lines[1].start, Some(5000));
}
_ => panic!("expected synced translation"),
}
}
#[test]
fn deserialize_document_with_plain_translation() {
let doc: QobuzLyricsDocument =
serde_json::from_str(DOC_PLAIN_TRANSLATION).expect("parse plain+translation document");
let original = doc.original.expect("original present");
assert!(!original.is_synced());
let translation = doc.translation.expect("translation present");
match &translation {
QobuzLyricsContent::Plain { lang, lines } => {
assert_eq!(lang.as_deref(), Some("de"));
assert_eq!(lines.len(), 2);
assert_eq!(lines[0].line, "Einfache Uebersetzung eins");
}
_ => panic!("expected plain translation"),
}
}
#[test]
fn document_without_translation_stays_none() {
// 9.x back-compat: existing captures have no `translation` member.
for fixture in [DOC_WSYNC, DOC_PLAIN] {
let doc: QobuzLyricsDocument =
serde_json::from_str(fixture).expect("parse 9.x document");
assert!(doc.translation.is_none());
}
}
#[test]
fn empty_translation_langs_means_feature_off() {
// Feature-off document: no translations offered at all.
let json = r#"{"track_id": 1, "translation_langs": [],
"original": {"type": "plain", "lang": "en", "lines": [{"line": "hi"}]}}"#;
let doc: QobuzLyricsDocument = serde_json::from_str(json).expect("parse");
assert!(doc.translation_langs.is_empty());
assert!(doc.translation.is_none());
// Missing member entirely behaves the same.
let json = r#"{"track_id": 1,
"original": {"type": "plain", "lang": "en", "lines": [{"line": "hi"}]}}"#;
let doc: QobuzLyricsDocument = serde_json::from_str(json).expect("parse");
assert!(doc.translation_langs.is_empty());
}
#[test]
fn deserialize_translation_only_document() {
// v10 LIVE WIRE (verified 2026-07-22, track 266725027 with
// language=es): a translation request returns a document carrying
// ONLY `translation` — no `original` at all.
let doc: QobuzLyricsDocument = serde_json::from_str(DOC_TRANSLATION_ONLY)
.expect("parse translation-only document");
assert!(doc.original.is_none(), "no original on the translated doc");
assert_eq!(doc.translation_langs.len(), 5);
let translation = doc.translation.expect("translation present");
assert!(translation.is_synced(), "lsync alias maps to Synced");
assert_eq!(translation.lang(), Some("es"));
match &translation {
QobuzLyricsContent::Synced { lines, .. } => {
assert_eq!(lines.len(), 4);
assert!(lines[1].start.is_none(), "gap line without stamps");
assert_eq!(lines[2].line, "Podría comerme a esa chica para el almuerzo");
}
_ => unreachable!(),
}
}
#[test]
fn merge_translation_into_original_document() {
// The get_lyrics merge path: original doc (9.x shape) + translation-
// only doc combine into one bilingual document.
let mut original: QobuzLyricsDocument =
serde_json::from_str(DOC_WSYNC).expect("parse original document");
assert!(original.translation.is_none());
let translated: QobuzLyricsDocument =
serde_json::from_str(DOC_TRANSLATION_ONLY).expect("parse translation-only document");
merge_translation_into(&mut original, translated);
assert!(original.original.is_some(), "original content kept");
let translation = original.translation.expect("merged translation");
assert_eq!(translation.lang(), Some("es"));
// translation_langs unioned WITHOUT duplicates (both fixtures carry
// the same 5 codes).
assert_eq!(original.translation_langs.len(), 5);
let mut sorted = original.translation_langs.clone();
sorted.sort();
sorted.dedup();
assert_eq!(sorted.len(), original.translation_langs.len());
// Writers/publishers stay the original document's.
assert!(original.writers.is_some());
}
#[test]
fn content_serializes_back_to_wire_shape() {
// The lyrics cache persists an embedded translation verbatim, so the
// content union must round-trip through serde.
let doc: QobuzLyricsDocument =
serde_json::from_str(DOC_WSYNC_TRANSLATION).expect("parse");
let translation = doc.translation.expect("translation present");
let json = serde_json::to_string(&translation).expect("serialize");
let value: serde_json::Value = serde_json::from_str(&json).unwrap();
assert_eq!(value["type"], "wsync");
assert_eq!(value["lang"], "es");
assert_eq!(value["lines"][0]["words"][0]["word"], "Primera");
let back: QobuzLyricsContent = serde_json::from_str(&json).expect("re-parse");
assert_eq!(back.lang(), Some("es"));
assert_eq!(back.line_count(), 3);
}
#[test]
fn lsync_alias_parses_yaml_shape() {
// The yaml's "lsync" guess ({line,start,end}, no words) must still
@@ -0,0 +1,23 @@
{
"album_id": "abc123",
"track_id": 111111111,
"translation_langs": ["fr"],
"publishers": [],
"writers": "Writer Three",
"original": {
"type": "lsync",
"lang": "en",
"lines": [
{"line": "Line-synced original one", "start": 1000, "end": 4000},
{"line": "Line-synced original two", "start": 5000, "end": 9000}
]
},
"translation": {
"type": "lsync",
"lang": "fr",
"lines": [
{"line": "Traduction synchronisee un", "start": 1000, "end": 4000},
{"line": "Traduction synchronisee deux", "start": 5000, "end": 9000}
]
}
}
@@ -0,0 +1,23 @@
{
"album_id": "def456",
"track_id": 222222222,
"translation_langs": ["de"],
"publishers": [],
"writers": null,
"original": {
"type": "plain",
"lang": "en",
"lines": [
{"line": "Plain original one"},
{"line": "Plain original two"}
]
},
"translation": {
"type": "plain",
"lang": "de",
"lines": [
{"line": "Einfache Uebersetzung eins"},
{"line": "Einfache Uebersetzung zwei"}
]
}
}
@@ -0,0 +1,22 @@
{
"album_id": "gvcirtodd95kc",
"track_id": 266725027,
"translation_langs": ["pt", "de", "fr", "es", "it"],
"publishers": [
{
"copyright": "Kobalt Music Publishing Ltd., Universal Music Publishing Group",
"zones": ["WW"]
}
],
"writers": "Billie EIlish O'Connell, Finneas O'Connell",
"translation": {
"type": "lsync",
"lang": "es",
"lines": [
{ "line": "Oh, mm-mm", "start": 1750, "end": 4770 },
{ "line": "" },
{ "line": "Podría comerme a esa chica para el almuerzo", "start": 5320, "end": 6990 },
{ "line": "Sí, ella baila en mi lengua", "start": 7230, "end": 8840 }
]
}
}
@@ -0,0 +1,63 @@
{
"album_id": "gvcirtodd95kc",
"track_id": 266725027,
"translation_langs": ["pt", "de", "fr", "es", "it"],
"publishers": [
{"copyright": "(c) Example Publishing", "zones": ["WW"]}
],
"writers": "Writer One, Writer Two",
"original": {
"type": "wsync",
"lang": "en",
"lines": [
{
"line": "First original line",
"start": 1750,
"end": 4770,
"words": [
{"word": "First", "start": 1750, "end": 2480},
{"word": "original", "start": 2480, "end": 3600},
{"word": "line", "start": 3600, "end": 4770}
]
},
{"line": "", "words": []},
{
"line": "Second original line",
"start": 19690,
"end": 22180,
"words": [
{"word": "Second", "start": 19690, "end": 20560},
{"word": "original", "start": 20560, "end": 21310},
{"word": "line", "start": 21310, "end": 22180}
]
}
]
},
"translation": {
"type": "wsync",
"lang": "es",
"lines": [
{
"line": "Primera linea traducida",
"start": 1750,
"end": 4770,
"words": [
{"word": "Primera", "start": 1750, "end": 2900},
{"word": "linea", "start": 2900, "end": 3800},
{"word": "traducida", "start": 3800, "end": 4770}
]
},
{"line": "", "words": []},
{
"line": "Segunda linea traducida",
"start": 19690,
"end": 22180,
"words": [
{"word": "Segunda", "start": 19690, "end": 20800},
{"word": "linea", "start": 20800, "end": 21500},
{"word": "traducida", "start": 21500, "end": 22180}
]
}
]
}
}
@@ -0,0 +1,9 @@
{
"track_id": 266725027,
"album_id": "gvcirtodd95kc",
"lyrics_url": "https://ga-cdn.qobuz.com/lyrics/266725027/original.json?Expires=2000000000&Signature=example&Key-Pair-Id=EXAMPLE",
"translation_requested": {
"lyrics_url": "https://ga-cdn.qobuz.com/lyrics/266725027/es.json?Expires=2000000000&Signature=example&Key-Pair-Id=EXAMPLE",
"lang": "es"
}
}
@@ -4682,8 +4682,8 @@ msgstr "QBZ läuft in einer Snap-Sandbox. Manche Audio-Schnittstellen müssen ei
msgid "Exclusive DAC access (bit-perfect)"
msgstr "Exklusiver DAC-Zugriff (Bit-perfekt)"
msgid "Recommended for exclusive mode: lets QBZ ask PipeWire to hand over the DAC cleanly (D-Bus device reservation)."
msgstr "Empfohlen für den exklusiven Modus: QBZ kann PipeWire bitten, den DAC sauber zu übergeben (D-Bus-Gerätereservierung)."
msgid "Recommended for exclusive mode: lets QBZ ask PipeWire to hand over the DAC cleanly (D-Bus device reservation). Without it, PipeWire keeps holding the DAC and other apps keep mixing through it even with ALSA + hw + Exclusive selected."
msgstr "Für den exklusiven Modus empfohlen: QBZ kann PipeWire bitten, den DAC sauber zu übergeben (D-Bus-Gerätereservierung). Ohne sie hält PipeWire den DAC weiter und andere Apps mischen trotz gewähltem ALSA + hw + Exklusiv weiter darüber."
msgid "Music on NAS or external drives"
msgstr "Musik auf NAS oder externen Laufwerken"
@@ -4778,3 +4778,38 @@ msgstr "Meistgespielte Alben"
# Most Played Albums View-all — per-card play count
msgid "{} plays"
msgstr "{} Wiedergaben"
# Lyrics translation (Qobuz API v10) — floating-toggle tooltips, flyout row, error toast
msgid "Show lyrics translation"
msgstr "Songtext-Übersetzung anzeigen"
msgid "Hide lyrics translation"
msgstr "Songtext-Übersetzung ausblenden"
msgid "Translation language"
msgstr "Übersetzungssprache"
msgid "Auto (account language)"
msgstr "Automatisch (Kontosprache)"
msgid "Translation is not available right now. Please try again later."
msgstr "Die Übersetzung ist gerade nicht verfügbar. Bitte versuche es später erneut."
# Discover Recommendations — reco-scoped dismissals (Not interested management)
msgid "Dismissed artists only leave your Recommendations — they still appear in search and everywhere else."
msgstr "Abgelehnte Künstler verschwinden nur aus deinen Empfehlungen — sie erscheinen weiterhin in der Suche und überall sonst."
msgid "No dismissed artists"
msgstr "Keine abgelehnten Künstler"
msgid "To stop seeing an artist in Recommendations, open its card menu and choose Not interested."
msgstr "Um einen Künstler nicht mehr in Empfehlungen zu sehen, öffne das Menü seiner Karte und wähle Nicht interessiert."
msgid "{} won't appear in Recommendations anymore"
msgstr "{} erscheint nicht mehr in Empfehlungen"
msgid "Artist dismissed from Recommendations"
msgstr "Künstler aus Empfehlungen abgelehnt"
msgid "{} restored to Recommendations"
msgstr "{} wieder in Empfehlungen aufgenommen"
@@ -475,8 +475,8 @@ msgstr "QBZ is running inside a Snap sandbox. Some audio interfaces need one-tim
msgid "Exclusive DAC access (bit-perfect)"
msgstr "Exclusive DAC access (bit-perfect)"
msgid "Recommended for exclusive mode: lets QBZ ask PipeWire to hand over the DAC cleanly (D-Bus device reservation)."
msgstr "Recommended for exclusive mode: lets QBZ ask PipeWire to hand over the DAC cleanly (D-Bus device reservation)."
msgid "Recommended for exclusive mode: lets QBZ ask PipeWire to hand over the DAC cleanly (D-Bus device reservation). Without it, PipeWire keeps holding the DAC and other apps keep mixing through it even with ALSA + hw + Exclusive selected."
msgstr "Recommended for exclusive mode: lets QBZ ask PipeWire to hand over the DAC cleanly (D-Bus device reservation). Without it, PipeWire keeps holding the DAC and other apps keep mixing through it even with ALSA + hw + Exclusive selected."
msgid "Music on NAS or external drives"
msgstr "Music on NAS or external drives"
@@ -571,3 +571,41 @@ msgstr "Most Played Albums"
# Most Played Albums View-all — per-card play count
msgid "{} plays"
msgstr "{} plays"
# Lyrics translation (Qobuz API v10) — floating-toggle tooltips, flyout row, error toast
msgid "Show lyrics translation"
msgstr "Show lyrics translation"
msgid "Hide lyrics translation"
msgstr "Hide lyrics translation"
msgid "Translation language"
msgstr "Translation language"
msgid "Auto (account language)"
msgstr "Auto (account language)"
msgid "Translation is not available right now. Please try again later."
msgstr "Translation is not available right now. Please try again later."
# Discover Recommendations — Not interested (reco-scoped dismissals)
msgid "Not interested"
msgstr "Not interested"
msgid "Dismissed artists only leave your Recommendations — they still appear in search and everywhere else."
msgstr "Dismissed artists only leave your Recommendations — they still appear in search and everywhere else."
msgid "No dismissed artists"
msgstr "No dismissed artists"
msgid "To stop seeing an artist in Recommendations, open its card menu and choose Not interested."
msgstr "To stop seeing an artist in Recommendations, open its card menu and choose Not interested."
msgid "{} won't appear in Recommendations anymore"
msgstr "{} won't appear in Recommendations anymore"
msgid "Artist dismissed from Recommendations"
msgstr "Artist dismissed from Recommendations"
msgid "{} restored to Recommendations"
msgstr "{} restored to Recommendations"
@@ -4712,8 +4712,8 @@ msgstr "QBZ se está ejecutando dentro de un sandbox de Snap. Algunas interfaces
msgid "Exclusive DAC access (bit-perfect)"
msgstr "Acceso exclusivo al DAC (bit-perfect)"
msgid "Recommended for exclusive mode: lets QBZ ask PipeWire to hand over the DAC cleanly (D-Bus device reservation)."
msgstr "Recomendado para el modo exclusivo: permite que QBZ le pida a PipeWire que entregue el DAC limpiamente (reserva de dispositivo por D-Bus)."
msgid "Recommended for exclusive mode: lets QBZ ask PipeWire to hand over the DAC cleanly (D-Bus device reservation). Without it, PipeWire keeps holding the DAC and other apps keep mixing through it even with ALSA + hw + Exclusive selected."
msgstr "Recomendado para el modo exclusivo: permite a QBZ pedirle a PipeWire que entregue el DAC limpiamente (reserva de dispositivo por D-Bus). Sin esto, PipeWire retiene el DAC y otras aplicaciones siguen mezclando a través de él incluso con ALSA + hw + Exclusivo seleccionado."
msgid "Music on NAS or external drives"
msgstr "Música en NAS o discos externos"
@@ -4808,3 +4808,38 @@ msgstr "Álbumes más escuchados"
# Most Played Albums View-all — per-card play count
msgid "{} plays"
msgstr "{} reproducciones"
# Lyrics translation (Qobuz API v10) — floating-toggle tooltips, flyout row, error toast
msgid "Show lyrics translation"
msgstr "Mostrar traducción de la letra"
msgid "Hide lyrics translation"
msgstr "Ocultar traducción de la letra"
msgid "Translation language"
msgstr "Idioma de traducción"
msgid "Auto (account language)"
msgstr "Automático (idioma de la cuenta)"
msgid "Translation is not available right now. Please try again later."
msgstr "La traducción no está disponible ahora mismo. Inténtalo de nuevo más tarde."
# Discover Recommendations — reco-scoped dismissals (Not interested management)
msgid "Dismissed artists only leave your Recommendations — they still appear in search and everywhere else."
msgstr "Los artistas descartados solo desaparecen de tus Recomendaciones — siguen apareciendo en la búsqueda y en el resto de la app."
msgid "No dismissed artists"
msgstr "No hay artistas descartados"
msgid "To stop seeing an artist in Recommendations, open its card menu and choose Not interested."
msgstr "Para dejar de ver un artista en Recomendaciones, abre el menú de su tarjeta y elige No me interesa."
msgid "{} won't appear in Recommendations anymore"
msgstr "{} ya no aparecerá en Recomendaciones"
msgid "Artist dismissed from Recommendations"
msgstr "Artista descartado de Recomendaciones"
msgid "{} restored to Recommendations"
msgstr "{} restaurado en Recomendaciones"
@@ -4682,8 +4682,8 @@ msgstr "QBZ s'exécute dans un sandbox Snap. Certaines interfaces audio doivent
msgid "Exclusive DAC access (bit-perfect)"
msgstr "Accès exclusif au DAC (bit-perfect)"
msgid "Recommended for exclusive mode: lets QBZ ask PipeWire to hand over the DAC cleanly (D-Bus device reservation)."
msgstr "Recommandé pour le mode exclusif : permet à QBZ de demander à PipeWire de céder le DAC proprement (réservation de périphérique D-Bus)."
msgid "Recommended for exclusive mode: lets QBZ ask PipeWire to hand over the DAC cleanly (D-Bus device reservation). Without it, PipeWire keeps holding the DAC and other apps keep mixing through it even with ALSA + hw + Exclusive selected."
msgstr "Recommandé pour le mode exclusif : permet à QBZ de demander à PipeWire de céder le DAC proprement (réservation de périphérique D-Bus). Sans cela, PipeWire conserve le DAC et d'autres applications continuent de mixer dessus même avec ALSA + hw + Exclusif sélectionné."
msgid "Music on NAS or external drives"
msgstr "Musique sur NAS ou disques externes"
@@ -4778,3 +4778,38 @@ msgstr "Albums les plus écoutés"
# Most Played Albums View-all — per-card play count
msgid "{} plays"
msgstr "{} lectures"
# Lyrics translation (Qobuz API v10) — floating-toggle tooltips, flyout row, error toast
msgid "Show lyrics translation"
msgstr "Afficher la traduction des paroles"
msgid "Hide lyrics translation"
msgstr "Masquer la traduction des paroles"
msgid "Translation language"
msgstr "Langue de traduction"
msgid "Auto (account language)"
msgstr "Automatique (langue du compte)"
msgid "Translation is not available right now. Please try again later."
msgstr "La traduction n'est pas disponible pour le moment. Veuillez réessayer plus tard."
# Discover Recommendations — reco-scoped dismissals (Not interested management)
msgid "Dismissed artists only leave your Recommendations — they still appear in search and everywhere else."
msgstr "Les artistes écartés disparaissent uniquement de vos Recommandations — ils restent visibles dans la recherche et partout ailleurs."
msgid "No dismissed artists"
msgstr "Aucun artiste écarté"
msgid "To stop seeing an artist in Recommendations, open its card menu and choose Not interested."
msgstr "Pour ne plus voir un artiste dans Recommandations, ouvrez le menu de sa carte et choisissez Pas intéressé."
msgid "{} won't appear in Recommendations anymore"
msgstr "{} n'apparaîtra plus dans Recommandations"
msgid "Artist dismissed from Recommendations"
msgstr "Artiste écarté des Recommandations"
msgid "{} restored to Recommendations"
msgstr "{} rétabli dans Recommandations"
@@ -4670,8 +4670,8 @@ msgstr "QBZ は Snap サンドボックス内で動作しています。一部
msgid "Exclusive DAC access (bit-perfect)"
msgstr "DAC 排他アクセス(ビットパーフェクト)"
msgid "Recommended for exclusive mode: lets QBZ ask PipeWire to hand over the DAC cleanly (D-Bus device reservation)."
msgstr "排他モードに推奨:PipeWire に DAC のクリーンな引き渡しを要求できます(D-Bus デバイス予約)。"
msgid "Recommended for exclusive mode: lets QBZ ask PipeWire to hand over the DAC cleanly (D-Bus device reservation). Without it, PipeWire keeps holding the DAC and other apps keep mixing through it even with ALSA + hw + Exclusive selected."
msgstr "排他モードに推奨:QBZ が PipeWire に DAC の引き渡しを要求できます(D-Bus デバイス予約)。これがないと PipeWire が DAC を保持し続け、ALSA + hw + Exclusive を選択していても他のアプリの音が混ざり続けます。"
msgid "Music on NAS or external drives"
msgstr "NAS や外部ドライブの音楽"
@@ -4766,3 +4766,38 @@ msgstr "最も再生したアルバム"
# Most Played Albums View-all — per-card play count
msgid "{} plays"
msgstr "{} 回再生"
# Lyrics translation (Qobuz API v10) — floating-toggle tooltips, flyout row, error toast
msgid "Show lyrics translation"
msgstr "歌詞の翻訳を表示"
msgid "Hide lyrics translation"
msgstr "歌詞の翻訳を隠す"
msgid "Translation language"
msgstr "翻訳言語"
msgid "Auto (account language)"
msgstr "自動(アカウントの言語)"
msgid "Translation is not available right now. Please try again later."
msgstr "翻訳は現在利用できません。後でもう一度お試しください。"
# Discover Recommendations — reco-scoped dismissals (Not interested management)
msgid "Dismissed artists only leave your Recommendations — they still appear in search and everywhere else."
msgstr "除外したアーティストは「おすすめ」からのみ消えます — 検索やその他の場所には引き続き表示されます。"
msgid "No dismissed artists"
msgstr "除外したアーティストはいません"
msgid "To stop seeing an artist in Recommendations, open its card menu and choose Not interested."
msgstr "おすすめにアーティストを表示しないようにするには、そのカードのメニューを開いて「興味なし」を選んでください。"
msgid "{} won't appear in Recommendations anymore"
msgstr "{} はおすすめに表示されなくなります"
msgid "Artist dismissed from Recommendations"
msgstr "アーティストをおすすめから除外しました"
msgid "{} restored to Recommendations"
msgstr "{} をおすすめに復元しました"
@@ -4694,8 +4694,8 @@ msgstr "QBZ draait in een Snap-sandbox. Sommige audio-interfaces moeten eenmalig
msgid "Exclusive DAC access (bit-perfect)"
msgstr "Exclusieve DAC-toegang (bit-perfect)"
msgid "Recommended for exclusive mode: lets QBZ ask PipeWire to hand over the DAC cleanly (D-Bus device reservation)."
msgstr "Aanbevolen voor de exclusieve modus: laat QBZ PipeWire vragen de DAC netjes vrij te geven (D-Bus-apparaatreservering)."
msgid "Recommended for exclusive mode: lets QBZ ask PipeWire to hand over the DAC cleanly (D-Bus device reservation). Without it, PipeWire keeps holding the DAC and other apps keep mixing through it even with ALSA + hw + Exclusive selected."
msgstr "Aanbevolen voor exclusieve modus: laat QBZ PipeWire vragen de DAC netjes over te dragen (D-Bus-apparaatreservering). Zonder dit houdt PipeWire de DAC vast en mixen andere apps er nog steeds doorheen, zelfs met ALSA + hw + Exclusief geselecteerd."
msgid "Music on NAS or external drives"
msgstr "Muziek op NAS of externe schijven"
@@ -4790,3 +4790,38 @@ msgstr "Meest afgespeelde albums"
# Most Played Albums View-all — per-card play count
msgid "{} plays"
msgstr "{} keer afgespeeld"
# Lyrics translation (Qobuz API v10) — floating-toggle tooltips, flyout row, error toast
msgid "Show lyrics translation"
msgstr "Songtekstvertaling tonen"
msgid "Hide lyrics translation"
msgstr "Songtekstvertaling verbergen"
msgid "Translation language"
msgstr "Vertaaltaal"
msgid "Auto (account language)"
msgstr "Automatisch (accounttaal)"
msgid "Translation is not available right now. Please try again later."
msgstr "Vertaling is nu niet beschikbaar. Probeer het later opnieuw."
# Discover Recommendations — reco-scoped dismissals (Not interested management)
msgid "Dismissed artists only leave your Recommendations — they still appear in search and everywhere else."
msgstr "Afgewezen artiesten verdwijnen alleen uit je Aanbevelingen — ze blijven zichtbaar in zoekresultaten en overal elders."
msgid "No dismissed artists"
msgstr "Geen afgewezen artiesten"
msgid "To stop seeing an artist in Recommendations, open its card menu and choose Not interested."
msgstr "Om een artiest niet meer in Aanbevelingen te zien, open je het kaartmenu en kies je Niet geïnteresseerd."
msgid "{} won't appear in Recommendations anymore"
msgstr "{} verschijnt niet meer in Aanbevelingen"
msgid "Artist dismissed from Recommendations"
msgstr "Artiest afgewezen voor Aanbevelingen"
msgid "{} restored to Recommendations"
msgstr "{} hersteld in Aanbevelingen"
@@ -4682,8 +4682,8 @@ msgstr "O QBZ está a correr dentro de uma sandbox Snap. Algumas interfaces de
msgid "Exclusive DAC access (bit-perfect)"
msgstr "Acesso exclusivo ao DAC (bit-perfect)"
msgid "Recommended for exclusive mode: lets QBZ ask PipeWire to hand over the DAC cleanly (D-Bus device reservation)."
msgstr "Recomendado para o modo exclusivo: permite ao QBZ pedir ao PipeWire que entregue o DAC de forma limpa (reserva de dispositivo via D-Bus)."
msgid "Recommended for exclusive mode: lets QBZ ask PipeWire to hand over the DAC cleanly (D-Bus device reservation). Without it, PipeWire keeps holding the DAC and other apps keep mixing through it even with ALSA + hw + Exclusive selected."
msgstr "Recomendado para o modo exclusivo: permite ao QBZ pedir ao PipeWire que entregue o DAC limpamente (reserva de dispositivo via D-Bus). Sem isto, o PipeWire mantém o DAC e outras aplicações continuam a misturar através dele mesmo com ALSA + hw + Exclusivo selecionado."
msgid "Music on NAS or external drives"
msgstr "Música em NAS ou discos externos"
@@ -4778,3 +4778,38 @@ msgstr "Álbuns mais tocados"
# Most Played Albums View-all — per-card play count
msgid "{} plays"
msgstr "{} reproduções"
# Lyrics translation (Qobuz API v10) — floating-toggle tooltips, flyout row, error toast
msgid "Show lyrics translation"
msgstr "Mostrar tradução da letra"
msgid "Hide lyrics translation"
msgstr "Ocultar tradução da letra"
msgid "Translation language"
msgstr "Idioma da tradução"
msgid "Auto (account language)"
msgstr "Automático (idioma da conta)"
msgid "Translation is not available right now. Please try again later."
msgstr "A tradução não está disponível de momento. Tente novamente mais tarde."
# Discover Recommendations — reco-scoped dismissals (Not interested management)
msgid "Dismissed artists only leave your Recommendations — they still appear in search and everywhere else."
msgstr "Artistas dispensados só saem das suas Recomendações — continuam aparecendo na busca e em todo o resto."
msgid "No dismissed artists"
msgstr "Nenhum artista dispensado"
msgid "To stop seeing an artist in Recommendations, open its card menu and choose Not interested."
msgstr "Para deixar de ver um artista em Recomendações, abra o menu do seu cartão e escolha Não tenho interesse."
msgid "{} won't appear in Recommendations anymore"
msgstr "{} não aparecerá mais em Recomendações"
msgid "Artist dismissed from Recommendations"
msgstr "Artista dispensado das Recomendações"
msgid "{} restored to Recommendations"
msgstr "{} restaurado em Recomendações"
@@ -4696,8 +4696,8 @@ msgstr "QBZ работает внутри песочницы Snap. Некото
msgid "Exclusive DAC access (bit-perfect)"
msgstr "Эксклюзивный доступ к ЦАП (bit-perfect)"
msgid "Recommended for exclusive mode: lets QBZ ask PipeWire to hand over the DAC cleanly (D-Bus device reservation)."
msgstr "Рекомендуется для эксклюзивного режима: позволяет QBZ попросить PipeWire корректно освободить ЦАП (резервирование устройства через D-Bus)."
msgid "Recommended for exclusive mode: lets QBZ ask PipeWire to hand over the DAC cleanly (D-Bus device reservation). Without it, PipeWire keeps holding the DAC and other apps keep mixing through it even with ALSA + hw + Exclusive selected."
msgstr "Рекомендуется для эксклюзивного режима: позволяет QBZ попросить PipeWire корректно передать ЦАП (резервирование устройства через D-Bus). Без этого PipeWire удерживает ЦАП и другие приложения продолжают микшировать через него даже при выбранном ALSA + hw + Exclusive."
msgid "Music on NAS or external drives"
msgstr "Музыка на NAS или внешних дисках"
@@ -4792,3 +4792,38 @@ msgstr "Самые прослушиваемые альбомы"
# Most Played Albums View-all — per-card play count
msgid "{} plays"
msgstr "{} воспроизведений"
# Lyrics translation (Qobuz API v10) — floating-toggle tooltips, flyout row, error toast
msgid "Show lyrics translation"
msgstr "Показать перевод текста"
msgid "Hide lyrics translation"
msgstr "Скрыть перевод текста"
msgid "Translation language"
msgstr "Язык перевода"
msgid "Auto (account language)"
msgstr "Автоматически (язык аккаунта)"
msgid "Translation is not available right now. Please try again later."
msgstr "Перевод сейчас недоступен. Попробуйте ещё раз позже."
# Discover Recommendations — reco-scoped dismissals (Not interested management)
msgid "Dismissed artists only leave your Recommendations — they still appear in search and everywhere else."
msgstr "Отклонённые исполнители исчезают только из Рекомендаций — они по-прежнему видны в поиске и повсюду остальном."
msgid "No dismissed artists"
msgstr "Нет отклонённых исполнителей"
msgid "To stop seeing an artist in Recommendations, open its card menu and choose Not interested."
msgstr "Чтобы больше не видеть исполнителя в Рекомендациях, откройте меню его карточки и выберите Не интересно."
msgid "{} won't appear in Recommendations anymore"
msgstr "{} больше не появится в Рекомендациях"
msgid "Artist dismissed from Recommendations"
msgstr "Исполнитель отклонён из Рекомендаций"
msgid "{} restored to Recommendations"
msgstr "{} возвращён в Рекомендации"
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M8.93 2H5.02C3 2 2 3 2 5.02V8.94C2 11 3 12 5.02 11.95H8.94C11 12 12 11 11.95 8.93V5.02C12 3 11 2 8.93 2ZM9.01 9.76C8.33 9.76 7.67 9.5 7.12 9.04C6.5 9.49 5.75 9.76 4.94 9.76C4.53 9.76 4.19 9.42 4.19 9.01C4.19 8.6 4.53 8.26 4.94 8.26C5.96 8.26 6.81 7.56 7.12 6.6H4.94C4.53 6.6 4.19 6.26 4.19 5.85C4.19 5.44 4.53 5.1 4.94 5.1H6.23C6.27 4.72 6.58 4.42 6.97 4.42C7.36 4.42 7.67 4.72 7.71 5.1H7.97C7.98 5.1 7.99 5.1 7.99 5.1H8.01H9C9.41 5.1 9.75 5.44 9.75 5.85C9.75 6.26 9.42 6.6 9 6.6H8.67C8.58 7.08 8.39 7.53 8.14 7.94C8.41 8.14 8.7 8.26 9.01 8.26C9.42 8.26 9.76 8.6 9.76 9.01C9.76 9.42 9.42 9.76 9.01 9.76Z" fill="#292D32"/>
<path d="M9 22.75C4.73 22.75 1.25 19.27 1.25 15C1.25 14.59 1.59 14.25 2 14.25C2.41 14.25 2.75 14.59 2.75 15C2.75 17.96 4.81 20.44 7.58 21.09L7.31 20.64C7.1 20.28 7.21 19.82 7.57 19.61C7.92 19.4 8.39 19.51 8.6 19.87L9.65 21.62C9.79 21.85 9.79 22.14 9.66 22.37C9.52 22.6 9.27 22.75 9 22.75Z" fill="#292D32"/>
<path d="M21.9985 9.75C21.5885 9.75 21.2485 9.41 21.2485 9C21.2485 6.04 19.1885 3.56 16.4185 2.91L16.6885 3.36C16.8985 3.72 16.7885 4.18 16.4285 4.39C16.0785 4.6 15.6085 4.49 15.3985 4.13L14.3485 2.38C14.2085 2.15 14.2085 1.86 14.3385 1.63C14.4785 1.4 14.7285 1.25 14.9985 1.25C19.2685 1.25 22.7485 4.73 22.7485 9C22.7485 9.41 22.4085 9.75 21.9985 9.75Z" fill="#292D32"/>
<path d="M16.9198 11.8516C14.1198 11.8516 11.8398 14.1216 11.8398 16.9316C11.8398 19.7316 14.1098 22.0116 16.9198 22.0116C19.7198 22.0116 21.9998 19.7416 21.9998 16.9316C21.9998 14.1216 19.7298 11.8516 16.9198 11.8516ZM19.3998 19.3416C19.0298 19.5216 18.5798 19.3816 18.3898 19.0016L18.2198 18.6616H15.6298L15.4598 19.0016C15.3298 19.2616 15.0598 19.4116 14.7898 19.4116C14.6798 19.4116 14.5598 19.3816 14.4598 19.3316C14.0898 19.1416 13.9398 18.6916 14.1198 18.3216L16.2598 14.0516C16.3898 13.8016 16.6498 13.6416 16.9298 13.6416C17.2098 13.6416 17.4698 13.8016 17.5998 14.0616L19.7398 18.3316C19.9198 18.7016 19.7698 19.1516 19.3998 19.3416Z" fill="#292D32"/>
<path d="M16.3789 17.1603H17.4689L16.9189 16.0703L16.3789 17.1603Z" fill="#292D32"/>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

+10 -1
View File
@@ -203,7 +203,7 @@ export component ArtistGridCard inherits Rectangle {
x: 21px;
y: 143px;
width: 196px;
height: 3 * 33px + 10px;
height: 4 * 33px + 10px;
ContextMenu {
ContextMenuItem {
icon: @image-url("../assets/icons/user.svg");
@@ -228,6 +228,15 @@ export component ArtistGridCard inherits Rectangle {
root.media-action(root.follow-kind, root.artist.id, "follow");
}
}
// Reco-scoped dismissal (NOT the blacklist): the artist
// leaves the Recommendations rails only.
ContextMenuItem {
icon: @image-url("../assets/icons/thumbs-down.svg");
label: @tr("Not interested");
clicked => {
root.media-action("artist", root.artist.id, "not-interested");
}
}
}
}
}
@@ -245,6 +245,96 @@ component AlbumRow inherits Rectangle {
}
}
// One reco-dismissed artist row (the Recommendations tab). Lighter than
// ArtistRow: the dismissal store carries no timestamp/notes, and the avatar
// is the generic user glyph (NOT blind-eye — this is not the blacklist).
component DismissedRow inherits Rectangle {
in property <string> artist-name;
property <bool> hovered: ta.has-hover || rm-ta.has-hover;
callback select();
callback remove();
callback hover-changed(bool);
height: 64px;
border-radius: Radius.md;
background: root.hovered ? Theme.surface-elevated : Theme.surface-card;
changed hovered => {
root.hover-changed(self.hovered);
}
HorizontalLayout {
padding-left: 16px;
padding-right: 8px;
spacing: 12px;
// Clickable artist-info region — opens the artist page.
Rectangle {
horizontal-stretch: 1;
ta := TouchArea {
mouse-cursor: pointer;
clicked => {
root.select();
}
}
HorizontalLayout {
spacing: 12px;
VerticalLayout {
alignment: center;
Rectangle {
width: 44px;
height: 44px;
border-radius: 22px;
background: Theme.surface-elevated;
QbzIcon {
source: @image-url("../assets/icons/user.svg");
width: 20px;
height: 20px;
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
tint: Theme.text-muted;
}
}
}
VerticalLayout {
alignment: center;
Text {
text: root.artist-name;
color: Theme.text-primary;
font-size: Typography.body;
font-weight: Typography.medium;
overflow: elide;
}
}
}
}
// Per-row undo (optimistic, no confirm — mirrors the blacklist rows).
VerticalLayout {
alignment: center;
Rectangle {
width: 36px;
height: 36px;
border-radius: Radius.sm;
background: rm-ta.has-hover ? Theme.danger-bg : transparent;
QbzIcon {
source: @image-url("../assets/icons/x.svg");
width: 18px;
height: 18px;
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
tint: rm-ta.has-hover ? Theme.danger : Theme.text-muted;
}
rm-ta := TouchArea {
mouse-cursor: pointer;
clicked => {
root.remove();
}
}
}
}
}
}
export component BlacklistManagerView inherits Rectangle {
background: ShellState.app-background-active ? transparent : Theme.surface-main;
@@ -347,6 +437,28 @@ export component BlacklistManagerView inherits Rectangle {
}
}
}
// Recommendations tab (reco-scoped "Not interested" dismissals).
Rectangle {
width: reco-lbl.preferred-width + 28px;
border-radius: Radius.sm;
background: BlacklistState.active-tab == 2
? Theme.surface-card
: (reco-ta.has-hover ? Theme.surface-hover : transparent);
reco-lbl := Text {
text: @tr("Recommendations");
color: BlacklistState.active-tab == 2 ? Theme.text-primary : Theme.text-muted;
font-size: Typography.legal;
font-weight: Typography.medium;
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
}
reco-ta := TouchArea {
mouse-cursor: pointer;
clicked => {
BlacklistActions.set-tab(2);
}
}
}
}
}
}
@@ -356,7 +468,9 @@ export component BlacklistManagerView inherits Rectangle {
vertical-stretch: 0;
text: BlacklistState.active-tab == 0
? @tr("Blacklisted artists are hidden from search results, radio, suggestions, and similar artists.")
: @tr("Blocked albums are hidden from search, discovery, and listings — even when their artist is allowed.");
: BlacklistState.active-tab == 1
? @tr("Blocked albums are hidden from search, discovery, and listings — even when their artist is allowed.")
: @tr("Dismissed artists only leave your Recommendations — they still appear in search and everywhere else.");
color: Theme.text-muted;
font-size: Typography.body;
wrap: word-wrap;
@@ -473,7 +587,9 @@ export component BlacklistManagerView inherits Rectangle {
}
// Clear-All — only when the active tab has something to clear.
if (BlacklistState.active-tab == 0 ? BlacklistState.count : BlacklistState.album-count) > 0: Rectangle {
// The Recommendations tab has no bulk clear (undo is per-row).
if (BlacklistState.active-tab == 0 ? BlacklistState.count
: BlacklistState.active-tab == 1 ? BlacklistState.album-count : 0) > 0: Rectangle {
width: clear-all-row.preferred-width + 28px;
height: 34px;
border-radius: Radius.sm;
@@ -519,7 +635,9 @@ export component BlacklistManagerView inherits Rectangle {
Text {
text: BlacklistState.active-tab == 0
? @tr("{} artists", BlacklistState.count)
: @tr("{} albums", BlacklistState.album-count);
: BlacklistState.active-tab == 1
? @tr("{} albums", BlacklistState.album-count)
: @tr("{} artists", BlacklistState.dismissed-count);
color: Theme.text-muted;
font-size: Typography.legal;
horizontal-alignment: right;
@@ -774,6 +892,100 @@ export component BlacklistManagerView inherits Rectangle {
hover-active: root.list-hover-rows > 0;
}
}
// --- Recommendations tab branches (reco-scoped dismissals) -----
// 2c) Empty (nothing dismissed).
if BlacklistState.active-tab == 2 && !BlacklistState.loading && BlacklistState.dismissed-count == 0: VerticalLayout {
alignment: center;
spacing: 12px;
HorizontalLayout {
alignment: center;
QbzIcon {
source: @image-url("../assets/icons/thumbs-down.svg");
width: 48px;
height: 48px;
tint: Theme.text-muted;
opacity: 0.3;
}
}
HorizontalLayout {
alignment: center;
Text {
text: @tr("No dismissed artists");
color: Theme.text-muted;
font-size: Typography.heading;
}
}
HorizontalLayout {
alignment: center;
Text {
text: @tr("To stop seeing an artist in Recommendations, open its card menu and choose Not interested.");
color: Theme.text-muted;
font-size: Typography.legal;
horizontal-alignment: center;
}
}
}
// 3c) No search results (dismissed).
if BlacklistState.active-tab == 2 && !BlacklistState.loading && BlacklistState.dismissed-count > 0 && BlacklistState.dismissed-items.length == 0: VerticalLayout {
alignment: center;
spacing: 12px;
HorizontalLayout {
alignment: center;
QbzIcon {
source: @image-url("../assets/icons/search.svg");
width: 48px;
height: 48px;
tint: Theme.text-muted;
opacity: 0.3;
}
}
HorizontalLayout {
alignment: center;
Text {
text: @tr("No results for \"{}\"", BlacklistState.search-query);
color: Theme.text-muted;
font-size: Typography.heading;
}
}
}
// 4c) The dismissed-artists list (per-row undo).
if BlacklistState.active-tab == 2 && !BlacklistState.loading && BlacklistState.dismissed-items.length > 0: Rectangle {
dismissed-flick := Flickable {
width: 100%;
height: 100%;
viewport-width: self.width;
viewport-height: dismissed-content.preferred-height;
dismissed-content := VerticalLayout {
width: parent.width - 18px;
spacing: 4px;
for item in BlacklistState.dismissed-items: DismissedRow {
artist-name: item.artist-name;
select => {
BlacklistActions.artist-select(item.artist-id);
}
remove => {
BlacklistActions.remove-dismissed(item.artist-id);
}
hover-changed(h) => {
root.list-hover-rows = h ? root.list-hover-rows + 1 : Math.max(0, root.list-hover-rows - 1);
}
}
}
}
ListScrollbar {
x: parent.width - self.width - 4px;
width: 14px;
height: 100%;
viewport-height: dismissed-flick.viewport-height;
visible-height: dismissed-flick.height;
viewport-y <=> dismissed-flick.viewport-y;
auto-hide: true;
hover-active: root.list-hover-rows > 0;
}
}
}
}
@@ -4,9 +4,13 @@
// install-method); hidden on native/dev installs.
//
// Flatpak rows: exclusive-DAC D-Bus reservation (the user-side fix for
// discussion #641 — the Flathub manifest can't carry the wildcard own-name,
// so the user grants it locally via `flatpak override`) and filesystem
// access for NAS/external music libraries. Discord's IPC override stays in
// discussion #641 AND issue #652 — the Flathub manifest can't carry the
// wildcard own-name, so the user grants it locally via `flatpak override`;
// without it PipeWire keeps the DAC and an "exclusive" ALSA output falls
// back to PipeWire mixing) and filesystem access for NAS/external music
// libraries. NOTE: the published manifest already ships --device=all
// (flathub/com.blitzfc.qbz@11d38546, since 1.2.15) — /dev/snd IS exposed,
// do not "fix" #652 with a device override. Discord's IPC override stays in
// Integrations (already there). Snap rows: the audio interface connections
// from the Tauri section (snap name is `qbz-player`).
//
@@ -131,7 +135,7 @@ export component SandboxSettings inherits VerticalLayout {
RowTitle { text: @tr("Exclusive DAC access (bit-perfect)"); }
RowNote {
text: @tr("Recommended for exclusive mode: lets QBZ ask PipeWire to hand over the DAC cleanly (D-Bus device reservation).");
text: @tr("Recommended for exclusive mode: lets QBZ ask PipeWire to hand over the DAC cleanly (D-Bus device reservation). Without it, PipeWire keeps holding the DAC and other apps keep mixing through it even with ALSA + hw + Exclusive selected.");
}
CommandBlock {
command: "flatpak override --user --own-name=org.freedesktop.ReserveDevice1.* com.blitzfc.qbz";
+64 -2
View File
@@ -235,8 +235,16 @@ export component AppShell inherits Rectangle {
background: #000000.with-alpha(AppearanceState.app-background-dim);
}
// Bottom layer: catches the mouse back / forward buttons for history
// navigation. Declared first so the real UI sits on top of it.
// Bottom layer: catches the mouse back / forward buttons AND two-finger
// horizontal touchpad swipes for history navigation (#653). Declared
// first so the real UI sits on top of it: a scroll event only reaches
// this layer when nothing above consumed it — a horizontal carousel
// Flickable accepts horizontal deltas (carousel keeps scrolling, no
// navigation fires), while a vertical-only page scroller REJECTS
// horizontal-only deltas (orthogonal direction, see Flickable's
// is_allowed_scroll_direction) and they fall through to here. The
// handler always returns EventResult.reject, so no scroll routing
// changes anywhere in the shell.
TouchArea {
pointer-event(e) => {
if (e.kind == PointerEventKind.down) {
@@ -248,6 +256,60 @@ export component AppShell inherits Rectangle {
}
}
}
// Swipe gesture accumulation: one navigation per gesture. Deltas
// arrive as pointer scroll events (Wayland/X11 touchpad). Slint's
// PointerScrollEvent carries no phase, so the gesture boundary is
// approximated: idle timeout (swipe-idle) + direction flips reset
// the accumulator, and `swipe-fired` suppresses re-triggers until
// the gesture goes idle.
property <length> swipe-accum: 0px;
property <bool> swipe-fired: false;
swipe-idle := Timer {
interval: 300ms;
triggered => {
swipe-accum = 0px;
swipe-fired = false;
swipe-idle.stop();
}
}
scroll-event(e) => {
// Only clearly horizontal-dominant deltas count toward the
// gesture; vertical scroll jitter is ignored.
if (e.delta-x != 0 && Math.abs(e.delta-x) > Math.abs(e.delta-y)) {
// A direction flip starts a fresh gesture.
if (swipe-accum != 0 && (swipe-accum > 0) != (e.delta-x > 0)) {
swipe-accum = e.delta-x;
swipe-fired = false;
} else {
swipe-accum += e.delta-x;
}
swipe-idle.restart();
// 70 logical px total — high enough that resting fingers or
// small trackpad noise never trip it, low enough that a
// deliberate swipe crosses it in one motion.
if (!swipe-fired && Math.abs(swipe-accum) >= 70px) {
// DIRECTION (macOS/GNOME natural-scrolling convention):
// fingers RIGHT = back, fingers LEFT = forward. With
// libinput natural scrolling ON (GNOME default) fingers
// right yields NEGATIVE delta-x, hence the signs below.
// Under non-natural scrolling the mapping feels inverted
// — accepted trade-off (distro scroll-direction setting
// is not visible to the app).
if (swipe-accum < 0 && NavState.can-back) {
NavState.request-back();
}
if (swipe-accum > 0 && NavState.can-forward) {
NavState.request-forward();
}
swipe-fired = true;
swipe-accum = 0px;
}
}
// Never consume the event: views above/below keep their exact
// pre-gesture scroll behavior.
return EventResult.reject;
}
}
VerticalLayout {
@@ -8,7 +8,9 @@
// so Tauri's segmented S/M/L/XL and Off/Soft/Strong rows become selects).
//
// Row order is Tauri's exactly: Auto-follow / Font / Size / Active color /
// Uppercase / Dimming / footer (Copy lyrics + Reset).
// Uppercase / Dimming / footer (Copy lyrics + Reset) — plus two Slint-side
// additions in order: Translation language (v10, after Size) and Lite fill
// (perf, after Uppercase).
//
// Deviations (spec §6): D6 — active color is a fixed swatch palette (Slint
// has no native color-picker input); the "Theme" reset link shows only while
@@ -132,6 +134,25 @@ export component LyricsControlsPanel inherits Rectangle {
}
}
// Translation language (Qobuz v10) — Auto (account language) + the
// 9 approved ISO 639-1 targets; options reseeded from Rust on
// language change (the array carries one @tr'd label).
HorizontalLayout {
height: 30px;
spacing: 8px;
RowLabel { text: @tr("Translation language"); }
QbzSelect {
sm: true;
menu-width: 178px;
options: LyricsState.translation-language-options;
current-index: LyricsState.translation-language-index;
selected(i) => {
LyricsState.translation-language-index = i;
LyricsState.prefs-changed();
}
}
}
// Active color — label (+ "Theme" reset while custom), swatch palette
// underneath, right-aligned on the control grid (D6).
VerticalLayout {
@@ -70,6 +70,9 @@ import "../../../../static/fonts/SourceSans3-VariableFont_wght.ttf";
component LyricsLineRow inherits VerticalLayout {
in property <int> index;
in property <string> line-text;
// Translation of this line (Qobuz v10); empty when the doc has none.
// Rendered under the original line while LyricsState.show-translation.
in property <string> translation-text;
in property <length> size-inactive;
in property <length> size-active;
// 0 = off, 1 = soft, 2 = strong (Tauri default) — pref-driven (S5).
@@ -86,6 +89,10 @@ component LyricsLineRow inherits VerticalLayout {
// eager init already saw it active.
in property <int> recenter-epoch;
// Gap between the original line and its translation (no effect while
// the translation is hidden — a single child has no spacing).
spacing: 3px;
// Tauri renders uppercase via CSS text-transform; Slint transforms the
// string (display only — the engine still matches on the raw text).
property <string> display-text:
@@ -255,6 +262,26 @@ component LyricsLineRow inherits VerticalLayout {
}
}
}
// Translation (Qobuz v10): static text UNDER the original line — smaller
// (~72%, mobile reference) and dimmer. The karaoke fill above stays keyed
// on the ORIGINAL timings/text; this follows its line statically and
// joins the same dimming ladder (never uppercased — it's a translation,
// not the lyric). No-op while the toggle is off or the doc has none.
if LyricsState.show-translation && root.translation-text != "": Text {
text: root.translation-text;
wrap: word-wrap;
opacity: root.line-opacity();
color: root.is-past ? Theme.text-muted : Theme.text-secondary.with-alpha(0.7);
font-family: root.font-name;
font-size: (root.is-active ? root.size-active : root.size-inactive) * 0.72;
font-weight: Typography.regular;
letter-spacing: 0.2px;
animate opacity {
duration: 220ms;
easing: ease-out;
}
}
}
export component LyricsLinesView inherits Rectangle {
@@ -386,6 +413,7 @@ export component LyricsLinesView inherits Rectangle {
for line[idx] in LyricsState.lines: LyricsLineRow {
index: idx;
line-text: line.text;
translation-text: line.translation-text;
size-inactive: root.size-inactive;
size-active: root.size-active;
dimming-mode: root.dimming-mode;
+55 -4
View File
@@ -23,7 +23,49 @@ import { IconButton } from "../primitives/BarControls.slint";
import { LoadingSpinner } from "../primitives/LoadingSpinner.slint";
import { LyricsLinesView } from "LyricsLinesView.slint";
import { LyricsControlsPanel } from "LyricsControlsFlyout.slint";
import { ShellState, LyricsState, ArtworkActions, AppearanceState } from "../state.slint";
import { ShellState, LyricsState, ArtworkActions, AppearanceState, TooltipState } from "../state.slint";
// Floating translate toggle (Qobuz v10, owner decisions 2026-07-22/23):
// square ghost button anchored bottom-right of the lyrics body, overlaying
// it. Styled after the Discover configurator gear (GearButton in
// HomeView.slint): no border, bg lights up on hover; the accent tint is the
// ON state. Tooltip rides the shared TooltipState channel.
component TranslateButton inherits Rectangle {
width: 32px;
height: 32px;
border-radius: 4px;
background: ta.has-hover ? Theme.surface-hover : transparent;
QbzIcon {
source: @image-url("../assets/icons/translate.svg");
width: 20px;
height: 20px;
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
tint: LyricsState.show-translation
? Theme.accent
: (ta.has-hover ? Theme.text-primary : Theme.text-muted);
}
ta := TouchArea {
mouse-cursor: pointer;
clicked => {
LyricsState.toggle-translation();
}
changed has-hover => {
if (self.has-hover) {
TooltipState.text = LyricsState.show-translation
? @tr("Hide lyrics translation")
: @tr("Show lyrics translation");
TooltipState.anchor-x = root.absolute-position.x + root.width / 2;
TooltipState.anchor-y = root.absolute-position.y;
TooltipState.show = true;
} else {
TooltipState.show = false;
}
}
}
}
component CloseButton inherits Rectangle {
callback clicked();
@@ -128,9 +170,10 @@ export component LyricsSidebar inherits Rectangle {
x: 32px + 8px + 28px - 260px;
y: 32px + 8px;
width: 260px;
// padding 28 + rows (22+30+30+44+22+30+34 = 212) +
// spacing 12 x 6 = 72.
height: 312px;
// padding 28 + rows (22+30+30+30+44+22+22+30+34 =
// 264, incl. lite-fill + translation language) +
// spacing 12 x 8 = 96.
height: 388px;
close-policy: PopupClosePolicy.close-on-click-outside;
LyricsControlsPanel { }
}
@@ -278,6 +321,14 @@ export component LyricsSidebar inherits Rectangle {
? LyricsState.custom-color
: Theme.accent;
}
// Floating translate toggle — bottom-right overlay of the lyrics
// body (mobile parity; NOT in the header, NOT in the flyout).
// Mounted only while the current doc advertises translations;
// otherwise the sidebar renders exactly as before.
if LyricsState.translation-available: TranslateButton {
x: parent.width - self.width - 12px;
y: parent.height - self.height - 12px;
}
}
// Source attribution — a tiny line pinned at the very bottom, always
+54 -2
View File
@@ -2462,6 +2462,16 @@ export struct BlacklistedAlbumItem {
has-notes: bool,
}
// One reco-dismissed artist ("Not interested"). Reco-SCOPED — NOT the
// blacklist: the artist only leaves the Recommendations rails. The store
// carries no timestamp/notes, so the row is just the name (+ a generic
// avatar); removal is the undo.
export struct DismissedArtistItem {
// Numeric Qobuz artist id (same int pass-through as BlacklistedArtistItem).
artist-id: int,
artist-name: string,
}
export global BlacklistState {
// The CURRENTLY-VISIBLE rows (already search-filtered by the controller).
in property <[BlacklistedArtistItem]> items: [];
@@ -2481,7 +2491,11 @@ export global BlacklistState {
in property <[BlacklistedAlbumItem]> album-items: [];
// FULL blocked-album count (drives the Albums tab badge + empty state).
in property <int> album-count: 0;
// Active manager tab: 0 = Artists, 1 = Albums.
// --- Reco-dismissal axis ("Not interested" — the Recommendations tab) ---
in property <[DismissedArtistItem]> dismissed-items: [];
// FULL dismissed count (drives the tab badge + empty state).
in property <int> dismissed-count: 0;
// Active manager tab: 0 = Artists, 1 = Albums, 2 = Recommendations.
in property <int> active-tab: 0;
}
@@ -2498,12 +2512,14 @@ export global BlacklistActions {
callback search-changed(string /* query */);
// --- Album axis ---
callback set-tab(int /* 0=artists, 1=albums */);
callback set-tab(int /* 0=artists, 1=albums, 2=recommendations */);
callback album-select(string /* album id */);
callback remove-album(string /* album id */);
callback clear-all-albums();
// Block an album from a context menu (id + display fields for the manager).
callback block-album(string /* id */, string /* title */, string /* artist */, string /* cover-url */);
// --- Reco-dismissal axis ---
callback remove-dismissed(int /* artist id */);
}
// === My QBZ — Mixtapes & Collections (read-only index grids) ============
@@ -4454,6 +4470,11 @@ export struct LyricsLineItem {
time-ms: int,
end-ms: int,
has-words: bool,
// Translation of this line (Qobuz v10), aligned 1:1 with `text` by the
// Rust glue; empty when the doc has no translation (or it wasn't
// requested). Rendered under the original line only while
// `LyricsState.show-translation` is on.
translation-text: string,
}
// One VISUAL line of the ACTIVE logical line, for the per-visual-line karaoke
@@ -4488,6 +4509,18 @@ export global LyricsState {
// Playing-track meta for the header ("{title} - {artist}").
in property <string> track-title;
in property <string> track-artist;
// ---- Translation (Qobuz API v10) ---------------------------------------
// The current doc advertises at least one translation language
// (`translation_langs` non-empty) — gates the sidebar's floating toggle.
// False on every other state, so the sidebar renders exactly as before.
in property <bool> translation-available: false;
// User intent: render the translation under each original line. Driven by
// Rust (`toggle-translation`): ON refetches with the target language and
// flips this only when the translation actually arrived; OFF is pure UI.
in-out property <bool> show-translation: false;
// Sidebar floating-button action (wired in main.rs).
callback toggle-translation();
// Surfaced backend error text (status == 4) — dynamic content, not chrome.
in property <string> error;
// Active line index; -1 = none. The S4 sync engine drives it.
@@ -4538,6 +4571,25 @@ export global LyricsState {
// between line changes). Default false (smooth karaoke). Kiosk / weak-GPU
// tiers force it on via ShellState.reduce-motion regardless of this pref.
in-out property <bool> lite-fill: false;
// Translation language (Qobuz v10, persisted like the other prefs):
// 0 Auto (account language) · 1..9 = en es fr de it pt nl ja ru. Option
// labels: the Auto entry is @tr'd, the language names are native
// literals — the same convention as AppearanceState.languages. The @tr
// DEFAULT is not reactive, so `reseed_i18n_labels` re-pushes the array
// on language change.
in-out property <int> translation-language-index: 0;
in-out property <[string]> translation-language-options: [
@tr("Auto (account language)"),
"English",
"Español",
"Français",
"Deutsch",
"Italiano",
"Português",
"Nederlands",
"日本語",
"Русский",
];
// Active (karaoke fill) color. `use-custom-color: false` = follow the theme
// accent (Tauri activeColor: ''). The palette swatches set both (deviation
// D6: swatches instead of a native color input — Slint has none).
+1 -1
View File
@@ -9,4 +9,4 @@ Terminal=false
StartupWMClass=com.blitzfc.qbz
StartupNotify=true
Keywords=music;audio;qobuz;hifi;streaming;audiophile;flac;
MimeType=x-scheme-handler/qbz;x-scheme-handler/qobuzapp;
MimeType=x-scheme-handler/qobuzapp;
+5 -4
View File
@@ -53,8 +53,8 @@ const AUTHOR_HANDLE: &str = "vicrodh";
/// The contributor handles + their GitHub profile URLs. First the Tauri About
/// modal's order, then the Slint-era external-PR contributors: `hoyon`
/// (classical "work" grouping, PR #536) and `mxnix` (Russian translation,
/// PR #517).
/// (classical "work" grouping, PR #536), `mxnix` (Russian translation,
/// PR #517) and `TerminalTilt`.
const CONTRIBUTORS: &[&str] = &[
"vorce",
"boxdot",
@@ -66,12 +66,13 @@ const CONTRIBUTORS: &[&str] = &[
"DoubleGate",
"hoyon",
"mxnix",
"TerminalTilt",
];
/// How many contributor chips per wrap row. Slint has no flex-wrap, so the flat
/// list is pre-grouped into fixed rows (see `AboutContributorGroup`). 5 fills
/// the widened ~840px panel (10 contributors → 2 even rows) instead of the old
/// 4-per-row / 3-row layout that left the wider modal half-empty.
/// the widened ~840px panel instead of the old 4-per-row / 3-row layout that
/// left the wider modal half-empty.
const CONTRIBUTORS_PER_ROW: usize = 5;
/// Build the row-grouped contributor model. Avatars start blank (default image)
+6
View File
@@ -132,6 +132,8 @@ where
if let Some(dir) = crate::offline_mode::user_data_dir(user_id) {
crate::offline_mode::init_for_user(&dir);
crate::fav_cache::init_for_user(&dir);
// Reco-scoped "Not interested" dismissal store (reco rails only).
crate::reco_dismiss::init_for_user(&dir);
// Recommendation event store (shared events.db with Tauri). Train
// after init (off-thread) so the seeds reflect this session's events.
crate::reco::init_for_user(&dir);
@@ -268,6 +270,9 @@ where
if let Some(dir) = crate::offline_mode::user_data_dir(user_id) {
crate::offline_mode::init_for_user(&dir);
crate::fav_cache::init_for_user(&dir);
// Reco-scoped "Not interested" dismissal store (reco rails
// only).
crate::reco_dismiss::init_for_user(&dir);
// Recommendation event store (shared events.db with Tauri).
// Train after init (off-thread) so the seeds reflect this
// session's events.
@@ -337,6 +342,7 @@ where
crate::offline::deactivate().await;
crate::offline_mode::teardown();
crate::fav_cache::teardown();
crate::reco_dismiss::teardown();
crate::reco::teardown();
runtime.core().clear_artist_vectors().await;
crate::discover_prefs::teardown();
+52 -5
View File
@@ -3,7 +3,9 @@
//! `BlacklistState`, applies search-as-you-type filtering controller-side, and
//! runs the toggle / remove / clear mutations against the
//! `crate::artist_blacklist` wrapper (the same fail-open singleton the artist
//! toggle in T9 mutates).
//! toggle in T9 mutates). A third "Recommendations" tab (active-tab 2) lists
//! the reco-SCOPED "Not interested" dismissals from `crate::reco_dismiss` —
//! NOT the blacklist — with a per-row undo.
//!
//! Mirrors `crate::offline_manager`'s shape: a `load` entry point invoked on
//! navigation + an action set wired in `main.rs`. There is no change-notify on
@@ -29,7 +31,7 @@ use chrono::{DateTime, Utc};
use slint::{ComponentHandle, ModelRc, SharedString, VecModel};
use crate::artwork::{ArtworkJob, ArtworkTarget, ImageCache};
use crate::{AppWindow, BlacklistState, BlacklistedAlbumItem, BlacklistedArtistItem};
use crate::{AppWindow, BlacklistState, BlacklistedAlbumItem, BlacklistedArtistItem, DismissedArtistItem};
/// Shared image cache for resolving blocked-album cover thumbnails (the artist
/// tab has no covers; the album tab does). Set once during startup wiring.
@@ -137,16 +139,41 @@ fn build_album_items() -> (Vec<BlacklistedAlbumItem>, i32, Vec<ArtworkJob>) {
(items, count, jobs)
}
/// Push the filtered items + full count + enabled flag + query into Slint (both
/// axes). Album covers resolve asynchronously via the shared image cache.
/// Build the visible (filtered) dismissed-artist items — the "Not interested"
/// reco-scoped list — from the store snapshot, applying the current query
/// (name match, same rule as the artist axis). `count` carries the FULL list
/// length for the tab badge + empty/no-results split.
fn build_dismissed_items() -> (Vec<DismissedArtistItem>, i32) {
let all = crate::reco_dismiss::list();
let count = all.len() as i32;
let needle = current_query().trim().to_lowercase();
let items: Vec<DismissedArtistItem> = all
.into_iter()
.filter(|a| needle.is_empty() || a.name.to_lowercase().contains(&needle))
.map(|a| DismissedArtistItem {
// Same int pass-through as the blacklist artist id.
artist_id: a.artist_id as i32,
artist_name: a.name.into(),
})
.collect();
(items, count)
}
/// Push the filtered items + full count + enabled flag + query into Slint (all
/// three axes). Album covers resolve asynchronously via the shared image cache.
fn push(w: &AppWindow) {
let (items, count) = build_items();
let (album_items, album_count, jobs) = build_album_items();
let (dismissed_items, dismissed_count) = build_dismissed_items();
let st = w.global::<BlacklistState>();
st.set_items(ModelRc::new(VecModel::from(items)));
st.set_count(count);
st.set_album_items(ModelRc::new(VecModel::from(album_items)));
st.set_album_count(album_count);
st.set_dismissed_items(ModelRc::new(VecModel::from(dismissed_items)));
st.set_dismissed_count(dismissed_count);
st.set_enabled(crate::artist_blacklist::is_enabled());
st.set_search_query(SharedString::from(current_query()));
// Kick off cover loads (best-effort; needs the cache + a weak handle).
@@ -236,7 +263,7 @@ pub fn clear_all(w: &AppWindow) {
// --- Album axis actions -------------------------------------------------
/// Switch the manager's active tab (0 = Artists, 1 = Albums).
/// Switch the manager's active tab (0 = Artists, 1 = Albums, 2 = Recommendations).
pub fn set_tab(w: &AppWindow, tab: i32) {
w.global::<BlacklistState>().set_active_tab(tab);
}
@@ -303,3 +330,23 @@ pub fn clear_all_albums(w: &AppWindow) {
}
}
}
// --- Reco-dismissal axis actions -----------------------------------------
/// Undo one "Not interested" dismissal (optimistic — the re-push drops the row
/// immediately) + toast. The artist becomes eligible for the Recommendations
/// rails again on their next paint (the §B filter reads the store).
pub fn remove_dismissed(w: &AppWindow, artist_id: i32) {
// Capture the name before removing, for the toast (falls back to the
// generic "Artist" for rows persisted without a resolved name).
let name = crate::reco_dismiss::list()
.into_iter()
.find(|a| a.artist_id == artist_id as u64)
.map(|a| a.name)
.filter(|n| !n.is_empty())
.unwrap_or_else(|| qbz_i18n::t("Artist"));
crate::reco_dismiss::remove(artist_id as u64);
push(w);
crate::toast::success(w, qbz_i18n::t_args("{} restored to Recommendations", &[&name]));
}
+236
View File
@@ -0,0 +1,236 @@
//! XDG / launcher deep links — `xdg-open https://open.qobuz.com/album/<id>`
//! with the desktop files' `Exec=qbz %u` (Tauri parity: the old app scanned
//! argv in the single-instance plugin callback and on cold start; the Slint
//! rebuild kept the raise-half but dropped the URL-half, so a deep link
//! raised/focused the window without ever navigating).
//!
//! Two entry paths, one pending slot:
//!
//! - **Cold start:** `capture_argv()` at the top of `main()` stashes the
//! first Qobuz-link argv entry BEFORE the single-instance guard runs (a
//! second launch must read its own argv before deciding to raise+exit).
//! Drained at the END of `enter_shell` — after the startup-page/view
//! restore, so the restore can't re-root over the deep link. At that point
//! the session is active and the AppWindow exists, so NO sleep hack (the
//! Tauri 1500 ms delay is not ported). Sitting at the login screen (no
//! session) the URL simply stays pending until the next successful
//! `enter_shell`. Offline entry (`enter_shell_offline`) never binds the
//! shell context, so the URL rides until an online shell — navigation
//! needs the API (same limitation as the Tauri era).
//! - **Warm start:** the second launch forwards the URL over the
//! single-instance D-Bus interface (`OpenUrl`, see `single_instance.rs`),
//! which presents the running instance and drains through the same path.
//!
//! The dispatch itself is the EXISTING Ctrl+L machinery:
//! `link_resolver::resolve` → `apply_resolved_link` → `navigate_*`.
use std::sync::{Arc, Mutex};
use qbz_app::shell::AppRuntime;
use slint::ComponentHandle;
use crate::adapter::SlintAdapter;
use crate::artwork;
use crate::AppWindow;
/// The first Qobuz link seen, waiting for a shell to navigate it. A warm
/// `OpenUrl` overwrites: the newest user intent wins.
static PENDING: Mutex<Option<String>> = Mutex::new(None);
/// Everything `dispatch` needs, bound once per shell entry (`enter_shell`)
/// and cleared on logout so "context set" means "a session is active and
/// navigation can succeed". The warm D-Bus path has no other way to reach
/// these — they only exist as locals in `main()`.
#[derive(Clone)]
struct ShellCtx {
runtime: Arc<AppRuntime<SlintAdapter>>,
weak: slint::Weak<AppWindow>,
handle: tokio::runtime::Handle,
image_cache: artwork::ImageCache,
}
static SHELL_CTX: Mutex<Option<ShellCtx>> = Mutex::new(None);
/// Whether a string looks like a Qobuz link (custom scheme or web URL) —
/// 1:1 the legacy Tauri `is_qobuz_link` prefixes
/// (`qbz-worktrees/legacy-tauri` `src-tauri/src/lib.rs:594`).
pub fn is_qobuz_link(arg: &str) -> bool {
arg.starts_with("qobuzapp://")
|| arg.starts_with("https://play.qobuz.com/")
|| arg.starts_with("http://play.qobuz.com/")
|| arg.starts_with("https://open.qobuz.com/")
|| arg.starts_with("http://open.qobuz.com/")
}
/// The first Qobuz link in an argument list, if any (pure — unit-tested).
fn select_link(args: &[String]) -> Option<String> {
args.iter().find(|a| is_qobuz_link(a)).cloned()
}
/// Scan the process argv for a Qobuz link and stash it pending. Call at the
/// top of `main()`, BEFORE `single_instance::acquire_or_raise`: when another
/// instance owns the bus name the guard forwards the stashed URL to it, and
/// when we are the primary it rides until the `enter_shell` drain.
pub fn capture_argv() {
let args: Vec<String> = std::env::args().skip(1).collect();
if let Some(url) = select_link(&args) {
log::info!(
"[qbz-slint] deep link: captured from argv: {}",
url.split('?').next().unwrap_or(&url)
);
stash(url);
}
}
/// Stash a URL pending (cold argv capture and the warm D-Bus `OpenUrl`).
pub fn stash(url: String) {
if let Ok(mut guard) = PENDING.lock() {
*guard = Some(url);
}
}
/// Take the pending URL, leaving the slot empty.
pub fn take_pending() -> Option<String> {
PENDING.lock().ok().and_then(|mut guard| guard.take())
}
/// Bind the shell context at `enter_shell` — the gate that lets
/// `drain_pending` dispatch (session active, AppWindow alive).
pub fn bind_shell_ctx(
runtime: Arc<AppRuntime<SlintAdapter>>,
weak: slint::Weak<AppWindow>,
handle: tokio::runtime::Handle,
image_cache: artwork::ImageCache,
) {
if let Ok(mut guard) = SHELL_CTX.lock() {
*guard = Some(ShellCtx {
runtime,
weak,
handle,
image_cache,
});
}
}
/// Clear the shell context on logout: back at the login screen a pending
/// URL must wait for the next `enter_shell`, not fire into a dead session.
pub fn clear_shell_ctx() {
if let Ok(mut guard) = SHELL_CTX.lock() {
*guard = None;
}
}
/// Dispatch the pending URL through the existing Ctrl+L resolve flow, but
/// only when a shell is up. No-op otherwise — the URL stays pending for the
/// next successful `enter_shell`. Safe to call from any thread (the zbus
/// executor included): the resolve spawns on the stored tokio handle and
/// the navigation hops to the Slint event loop.
pub fn drain_pending() {
let ctx = SHELL_CTX.lock().ok().and_then(|guard| guard.clone());
let Some(ctx) = ctx else { return };
let Some(url) = take_pending() else { return };
dispatch(url, ctx);
}
/// Mirror of the Ctrl+L `LinkResolverActions::on_submit` flow in `main.rs`,
/// minus the modal state: resolve off the UI thread, then apply the
/// navigation on the event loop. Failures surface as a toast (there is no
/// modal to hold an error here).
fn dispatch(url: String, ctx: ShellCtx) {
let ShellCtx {
runtime,
weak,
handle,
image_cache,
} = ctx;
log::info!(
"[qbz-slint] deep link: resolving {}",
url.split('?').next().unwrap_or(&url)
);
handle.clone().spawn(async move {
let result = crate::link_resolver::resolve(runtime.clone(), url).await;
let _ = weak.upgrade_in_event_loop(move |w| match result {
Ok(qbz_music_link::MusicLinkResult::Resolved { link, .. }) => {
crate::apply_resolved_link(link, &runtime, &w.as_weak(), &handle, &image_cache);
}
Ok(qbz_music_link::MusicLinkResult::PlaylistDetected { provider }) => {
// Unreachable for the native Qobuz shapes the argv/D-Bus
// matcher accepts (cross-platform provider playlists only).
log::info!("[qbz-slint] deep link: {provider} playlist — nothing to navigate to");
}
Ok(qbz_music_link::MusicLinkResult::NotOnQobuz { .. }) => {
crate::toast::error(
&w,
qbz_i18n::t("This content is not available on Qobuz"),
);
}
Err(e) => {
log::warn!("[qbz-slint] deep link: resolve failed: {e}");
crate::toast::error(&w, qbz_i18n::t("Could not resolve that link"));
}
});
});
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn matches_open_qobuz_album_https_and_http() {
assert!(is_qobuz_link("https://open.qobuz.com/album/kq3s910v1qufc"));
assert!(is_qobuz_link("http://open.qobuz.com/album/kq3s910v1qufc"));
}
#[test]
fn matches_play_qobuz_https_and_http() {
assert!(is_qobuz_link("https://play.qobuz.com/album/kq3s910v1qufc"));
assert!(is_qobuz_link("http://play.qobuz.com/track/123456"));
}
#[test]
fn matches_qobuzapp_scheme() {
assert!(is_qobuz_link("qobuzapp://album/kq3s910v1qufc"));
assert!(is_qobuz_link("qobuzapp://artist/123"));
}
#[test]
fn ignores_non_link_args() {
assert!(!is_qobuz_link("--verbose"));
assert!(!is_qobuz_link("/home/user/music.flac"));
assert!(!is_qobuz_link("https://example.com/album/kq3s910v1qufc"));
assert!(!is_qobuz_link("https://open.qobuz.com.evil.test/album/x"));
// The dead `qbz://` scheme resolves nowhere and stays unmatched.
assert!(!is_qobuz_link("qbz://album/kq3s910v1qufc"));
assert!(!is_qobuz_link(""));
}
#[test]
fn select_link_takes_first_match() {
let args = vec![
"--flag".to_string(),
"https://open.qobuz.com/album/first".to_string(),
"qobuzapp://album/second".to_string(),
];
assert_eq!(
select_link(&args),
Some("https://open.qobuz.com/album/first".to_string())
);
}
#[test]
fn select_link_returns_none_without_match() {
let args = vec!["--flag".to_string(), "cover.jpg".to_string()];
assert_eq!(select_link(&args), None);
}
/// Single stateful test: PENDING is process-global and cargo runs tests
/// on threads, so the round-trip + overwrite checks stay sequential here.
#[test]
fn pending_drains_once_and_newest_wins() {
stash("qobuzapp://album/old".to_string());
stash("qobuzapp://album/new".to_string());
assert_eq!(take_pending(), Some("qobuzapp://album/new".to_string()));
assert_eq!(take_pending(), None);
}
}
+177 -18
View File
@@ -9,6 +9,7 @@
//! Weekly Exploration/Jams (ListenBrainz), Deep-cut albums, and a Qobuz editorial
//! cold-start fallback.
use std::collections::HashSet;
use std::path::{Path, PathBuf};
use std::sync::{Arc, Mutex};
use std::time::{SystemTime, UNIX_EPOCH};
@@ -18,9 +19,9 @@ use qbz_app::shell::AppRuntime;
use qbz_external_reco::{
build_deep_cut_albums, build_editorial, build_fresh_releases, build_rec_albums,
build_rec_artists_common, build_rec_artists_recent, build_similar_albums_seeded,
build_weekly_exploration, build_weekly_jams, gather_history, is_cold_start, AlbumReco,
ArtistReco, ExternalCarousels, LastFmHandle, ListenBrainzHandle, LocalHistory, RecoCache,
RecoCatalog, RecoInputs, TrackReco,
build_weekly_exploration, build_weekly_jams, compose_artist_rails, gather_history,
is_cold_start, AlbumReco, ArtistReco, ExternalCarousels, LastFmHandle, ListenBrainzHandle,
LocalHistory, RecoCache, RecoCatalog, RecoInputs, TrackReco, ARTIST_DISPLAY_CAP,
};
use qbz_integrations::{LastFmClient, ListenBrainzClient, MusicBrainzClient};
use qbz_models::{Album, Artist, Track};
@@ -32,6 +33,15 @@ use crate::{AlbumCardItem, AppWindow, DiscoverSection, ExternalRecoState, SlimIt
static CACHE_DIR: Mutex<Option<PathBuf>> = Mutex::new(None);
/// Retained per-rail overflow (validated candidates past the visible cap) for
/// the two Recommended-Artist rails — (common, recent). Kept for live
/// backfill after a "not interested" dismissal, so a replacement card needs
/// no extra network. Rewritten on every rail paint (fresh build AND cached
/// blob paint; old blobs carry no overflow, so they simply don't backfill
/// until they expire).
static ARTIST_OVERFLOW: Mutex<(Vec<ArtistReco>, Vec<ArtistReco>)> =
Mutex::new((Vec::new(), Vec::new()));
pub fn init_for_user(base_dir: &Path) {
if let Ok(mut g) = CACHE_DIR.lock() {
*g = Some(base_dir.to_path_buf());
@@ -390,19 +400,21 @@ fn spawn(
let history = gather_history(&inputs).await;
let col = &collector;
// Progressive: each branch paints its row AND collects it for the cache.
let b_common = async {
let r = build_rec_artists_common(&inputs, &history).await;
// The two artist rails build in parallel but paint TOGETHER through
// apply_artist_rails (the shared filter/dedup/backfill choke point —
// cross-rail dedup needs both pools). The collector stores the FULL
// validated pools (visible + overflow), so the results blob carries
// the backfill candidates too.
let b_artists = async {
let (common_pool, recent_pool) = tokio::join!(
build_rec_artists_common(&inputs, &history),
build_rec_artists_recent(&inputs, &history),
);
if let Ok(mut g) = col.lock() {
g.rec_artists_common = r.clone();
g.rec_artists_common = common_pool.clone();
g.rec_artists_recent = recent_pool.clone();
}
apply_artists(&weak, &image_cache, r, ArtistRow::RecArtistsCommon);
};
let b_recent = async {
let r = build_rec_artists_recent(&inputs, &history).await;
if let Ok(mut g) = col.lock() {
g.rec_artists_recent = r.clone();
}
apply_artists(&weak, &image_cache, r, ArtistRow::RecArtistsRecent);
apply_artist_rails(&weak, &image_cache, common_pool, recent_pool);
};
let b_albums = async {
let r = build_rec_albums(&inputs, &history).await;
@@ -439,7 +451,7 @@ fn spawn(
}
apply_albums(&weak, &image_cache, r, AlbumRow::DeepCuts);
};
tokio::join!(b_common, b_recent, b_albums, b_fresh, b_explore, b_jams, b_deep);
tokio::join!(b_artists, b_albums, b_fresh, b_explore, b_jams, b_deep);
}
// 3. Store the built result for instant future opens (48h TTL). GUARD
@@ -522,8 +534,7 @@ fn clear_all_pending(w: &AppWindow) {
/// their own per-week cache by `build_and_apply_weeklies`, so the blob can never
/// pin a stale/empty weekly for the 48h window.
fn apply_all(weak: &slint::Weak<AppWindow>, cache: &ImageCache, r: ExternalCarousels) {
apply_artists(weak, cache, r.rec_artists_common, ArtistRow::RecArtistsCommon);
apply_artists(weak, cache, r.rec_artists_recent, ArtistRow::RecArtistsRecent);
apply_artist_rails(weak, cache, r.rec_artists_common, r.rec_artists_recent);
apply_albums(weak, cache, r.rec_albums, AlbumRow::RecAlbums);
apply_albums(weak, cache, r.fresh_releases, AlbumRow::FreshReleases);
apply_albums(weak, cache, r.deep_cut_albums, AlbumRow::DeepCuts);
@@ -531,6 +542,150 @@ fn apply_all(weak: &slint::Weak<AppWindow>, cache: &ImageCache, r: ExternalCarou
apply_artists(weak, cache, r.top_artists, ArtistRow::TopArtists);
}
/// Fold the three per-user exclusion sources — followed artists, the app-wide
/// blacklist, and the reco-scoped "not interested" dismissals — into one id
/// set for the rail composition. Every source is independently fail-open (an
/// unbound/unreadable store simply contributes nothing).
fn artist_exclusions() -> HashSet<u64> {
let mut ids = crate::fav_cache::all_artists();
ids.extend(crate::artist_blacklist::ids_snapshot());
ids.extend(crate::reco_dismiss::ids_snapshot());
ids
}
/// THE paint choke point for the two Recommended-Artist rails — the fresh
/// build AND the cached-blob paint both funnel through here. Composes the
/// visible rows from the validated pools AFTER exclusion filtering +
/// cross-rail dedup (common wins), takes the first ARTIST_DISPLAY_CAP
/// survivors per rail, and retains the rest as backfill overflow for the
/// "not interested" live replacement (compose_artist_rails does the split;
/// the full pools ride the results blob, so a cached paint backfills too).
fn apply_artist_rails(
weak: &slint::Weak<AppWindow>,
cache: &ImageCache,
common_pool: Vec<ArtistReco>,
recent_pool: Vec<ArtistReco>,
) {
let excluded = artist_exclusions();
let (common, recent) =
compose_artist_rails(common_pool, recent_pool, &excluded, ARTIST_DISPLAY_CAP);
if let Ok(mut g) = ARTIST_OVERFLOW.lock() {
g.0 = common.overflow;
g.1 = recent.overflow;
}
apply_artists(weak, cache, common.visible, ArtistRow::RecArtistsCommon);
apply_artists(weak, cache, recent.visible, ArtistRow::RecArtistsRecent);
}
/// Pop the first retained-overflow candidate for `which` rail that still
/// passes the LIVE exclusions (a follow/blacklist may have landed since the
/// paint) and is not already visible in either rail. Non-passing entries stay
/// pooled (they may become eligible again, e.g. after an un-follow).
fn pop_backfill(
which: ArtistRow,
visible: &HashSet<String>,
excluded: &HashSet<u64>,
) -> Option<ArtistReco> {
let mut g = ARTIST_OVERFLOW.lock().ok()?;
let pool = match which {
ArtistRow::RecArtistsCommon => &mut g.0,
ArtistRow::RecArtistsRecent => &mut g.1,
ArtistRow::TopArtists => return None,
};
let idx = pool.iter().position(|r| {
!excluded.contains(&r.qobuz_artist_id)
&& !visible.contains(&r.qobuz_artist_id.to_string())
})?;
Some(pool.remove(idx))
}
/// Live "Not interested": drop the artist card from the Recommended-Artist
/// rail that carries it and backfill the freed slot from that rail's retained
/// overflow — already Qobuz-validated, so no network. Runs on the Slint event
/// loop. Returns the (name, image_url) snapshot of the dismissed card (for the
/// dismissal store + toast), or None when the artist is not currently in a
/// reco rail (e.g. dismissed from a search/home card).
pub fn apply_artist_dismissal(
w: &AppWindow,
cache: &ImageCache,
artist_id: &str,
) -> Option<(String, String)> {
let s = w.global::<ExternalRecoState>();
let common_model = s.get_rec_artists_common();
let recent_model = s.get_rec_artists_recent();
let common_rows: Vec<SlimItem> = (0..common_model.row_count())
.filter_map(|i| common_model.row_data(i))
.collect();
let recent_rows: Vec<SlimItem> = (0..recent_model.row_count())
.filter_map(|i| recent_model.row_data(i))
.collect();
let in_common = common_rows.iter().any(|it| it.id.as_str() == artist_id);
let in_recent = recent_rows.iter().any(|it| it.id.as_str() == artist_id);
if !in_common && !in_recent {
return None;
}
let snapshot = common_rows
.iter()
.chain(recent_rows.iter())
.find(|it| it.id.as_str() == artist_id)
.map(|it| (it.title.to_string(), it.artwork_url.to_string()));
let excluded = artist_exclusions();
// Rebuild the affected models from the kept rows — their already-decoded
// `artwork` images ride along, so only the backfilled row needs a job.
let mut common_new: Vec<SlimItem> = common_rows
.into_iter()
.filter(|it| it.id.as_str() != artist_id)
.collect();
let mut recent_new: Vec<SlimItem> = recent_rows
.into_iter()
.filter(|it| it.id.as_str() != artist_id)
.collect();
// Visible ids across BOTH rails (post-removal): the backfill candidate
// must not duplicate the other rail.
let mut visible: HashSet<String> = common_new
.iter()
.chain(recent_new.iter())
.map(|it| it.id.to_string())
.collect();
let mut jobs: Vec<ArtworkJob> = Vec::new();
if in_common {
if let Some(reco) = pop_backfill(ArtistRow::RecArtistsCommon, &visible, &excluded) {
visible.insert(reco.qobuz_artist_id.to_string());
if !reco.image_url.is_empty() {
jobs.push(ArtworkJob {
url: reco.image_url.clone(),
target: ArtworkTarget::ExtRecoRecArtistCommon {
index: common_new.len(),
},
});
}
common_new.push(slim_from_artist(&reco));
}
s.set_rec_artists_common(ModelRc::new(VecModel::from(common_new)));
}
if in_recent {
if let Some(reco) = pop_backfill(ArtistRow::RecArtistsRecent, &visible, &excluded) {
visible.insert(reco.qobuz_artist_id.to_string());
if !reco.image_url.is_empty() {
jobs.push(ArtworkJob {
url: reco.image_url.clone(),
target: ArtworkTarget::ExtRecoRecArtistRecent {
index: recent_new.len(),
},
});
}
recent_new.push(slim_from_artist(&reco));
}
s.set_rec_artists_recent(ModelRc::new(VecModel::from(recent_new)));
}
if !jobs.is_empty() {
crate::artwork::spawn_loads(jobs, w.as_weak(), cache.clone());
}
snapshot
}
/// Build + paint the two Weekly rows from their own per-week cache (cheap on a
/// hit; one ListenBrainz `createdfor` call + a SQLite read). Used on the
/// instant-paint path so the weeklies follow ListenBrainz's weekly cadence
@@ -601,7 +756,11 @@ fn slim_from_artist(a: &ArtistReco) -> SlimItem {
rank: "".into(),
artwork_url: a.image_url.clone().into(),
artwork: slint::Image::default(),
following: false,
// Live follow state from the login-seeded fav cache (the
// pinned_section precedent) — a hardcoded `false` mislabeled
// already-followed artists. Kept live afterwards by
// search::mark_artist_followed on every toggle.
following: crate::fav_cache::is_artist_favorite(a.qobuz_artist_id),
}
}
fn slim_from_track(t: &TrackReco) -> SlimItem {
+6
View File
@@ -272,6 +272,12 @@ pub fn is_artist_favorite(artist_id: u64) -> bool {
.unwrap_or(false)
}
/// Snapshot of the full followed-artist id set — the reco paint filter's
/// "already following" exclusion input (mirrors `all()` for tracks).
pub fn all_artists() -> HashSet<u64> {
FAV_ARTISTS.read().map(|g| g.clone()).unwrap_or_default()
}
/// Replace the followed-artist set with a freshly-fetched id list and mirror
/// it to the per-user store (full replace — same lifecycle as the album set).
/// Blocking disk write; call off the UI thread.
+257 -7
View File
@@ -31,6 +31,17 @@
//! Rust-side in [`CURRENT_DOC`]; the UI model only carries the line list +
//! a `has-words` flag. The S4 sync engine consumes the doc for the
//! word-anchored karaoke fill.
//!
//! Translation (Qobuz API v10): the default flow fetches original-only and
//! pushes `translation-available` (doc `translation_langs` non-empty), which
//! gates the sidebar's floating toggle. Toggling ON refetches the current
//! track WITH the resolved target (`LyricsRequest.language`) via
//! [`enable_translation`] and flips `show-translation` only when a
//! translation actually arrived — any gap toasts and reverts (fail soft,
//! never an error state). Toggling OFF ([`disable_translation`]) is pure
//! UI. The toggle is PER-TRACK (owner decision 2026-07-23): it applies
//! only to the song it was enabled on — every track change resets it and
//! fetches original-only.
use std::sync::{Arc, Mutex, OnceLock};
@@ -58,6 +69,11 @@ const STATUS_OFFLINE: i32 = 5;
/// the per-user cache handle re-binds via `init_at` on every activation.
static SERVICE: OnceLock<Arc<LyricsService>> = OnceLock::new();
/// The shared core client lock, kept for the translation "Auto" resolution
/// (the account `language_code` lives on the client's session). Installed
/// alongside [`SERVICE`] on the first session activation.
static CLIENT: OnceLock<Arc<tokio::sync::RwLock<Option<QobuzClient>>>> = OnceLock::new();
/// Identity of the latest requested track + whether a Found result has been
/// committed for it. `key` doubles as the stale guard (F2) and the
/// duplicate-fetch guard (`loaded` mirrors Tauri's `status === 'loaded'`).
@@ -71,6 +87,20 @@ static CURRENT: Mutex<CurrentLyrics> = Mutex::new(CurrentLyrics {
loaded: false,
});
/// Active translation session (Qobuz v10), the Rust-side source of truth
/// behind `LyricsState.show-translation`: `enabled` = the toggle is ON,
/// `language` = the target it was resolved with (kept so track changes
/// re-request the same target — spec §B: translation follows across tracks).
struct TranslationSession {
enabled: bool,
language: Option<String>,
}
static TRANSLATION: Mutex<TranslationSession> = Mutex::new(TranslationSession {
enabled: false,
language: None,
});
/// The parsed document for the current track, held Rust-side so the native
/// Qobuz word timestamps survive for the S4 sync engine (the UI model only
/// carries text + line bounds + a has-words flag).
@@ -96,12 +126,19 @@ struct SharedClientProviders {
#[async_trait::async_trait]
impl LyricsProviders for SharedClientProviders {
async fn qobuz(&self, track_id: u64) -> Result<Option<QobuzLyricsDocument>, String> {
async fn qobuz(
&self,
track_id: u64,
language: Option<&str>,
) -> Result<Option<QobuzLyricsDocument>, String> {
let guard = self.client.read().await;
let client = guard
.as_ref()
.ok_or_else(|| "Qobuz client not initialized".to_string())?;
client.get_lyrics(track_id).await.map_err(|e| e.to_string())
client
.get_lyrics(track_id, language)
.await
.map_err(|e| e.to_string())
}
async fn lrclib(
@@ -126,6 +163,10 @@ impl LyricsProviders for SharedClientProviders {
/// Best-effort: failures are logged, never block entry. Must run within the
/// tokio runtime context (the bind is spawned).
pub fn init_for_user(client: Arc<tokio::sync::RwLock<Option<QobuzClient>>>, user_id: u64) {
// Keep a handle for the translation "Auto" resolution (the account
// language lives on the client's session). Same lock per process, so a
// later activation's re-set is a no-op.
let _ = CLIENT.set(client.clone());
let service = SERVICE
.get_or_init(move || {
Arc::new(LyricsService::new(Arc::new(SharedClientProviders {
@@ -161,6 +202,7 @@ pub fn teardown() {
if let Ok(mut doc) = CURRENT_DOC.lock() {
*doc = None;
}
reset_translation_session();
if let Some(service) = SERVICE.get().cloned() {
tokio::spawn(async move {
service.teardown().await;
@@ -242,6 +284,178 @@ pub fn clear_cache(handle: &tokio::runtime::Handle, weak: slint::Weak<AppWindow>
});
}
// ---- Translation (Qobuz API v10) -------------------------------------------
/// Whether the translation toggle is currently ON (Rust-side source of truth
/// behind `LyricsState.show-translation`). main.rs reads it to route the
/// toggle callback. Per-track (owner 2026-07-23): reset on every track
/// change in [`on_track_changed`].
pub fn translation_enabled() -> bool {
TRANSLATION.lock().map(|t| t.enabled).unwrap_or(false)
}
fn reset_translation_session() {
if let Ok(mut t) = TRANSLATION.lock() {
t.enabled = false;
t.language = None;
}
}
/// Account language (ISO 639-1) from the shared client's session — the
/// "Auto" resolution's first hop. None pre-login / pre-v10 sessions.
async fn account_language() -> Option<String> {
let client = CLIENT.get()?.clone();
let guard = client.read().await;
guard.as_ref()?.session_language_code().await
}
/// Resolve the effective translation target (spec §B.3): the explicit
/// setting when set; "Auto" = account `language_code`, falling back to the
/// UI locale. `None` when nothing resolves — the caller fails soft (toast +
/// revert); the lyrics view never enters an error state over translation.
async fn resolve_target_language() -> Option<String> {
let pref = crate::lyrics_prefs::load().translation_language;
if pref != "auto" {
return Some(pref);
}
if let Some(lang) = account_language().await {
return Some(lang);
}
let ui_locale = qbz_i18n::current_language();
(!ui_locale.is_empty()).then(|| ui_locale.to_string())
}
/// Toggle OFF: drop the session and re-render original-only. Pure UI — the
/// committed line model keeps its (now hidden) translation texts; NO
/// network (spec §B.3).
pub fn disable_translation(weak: &slint::Weak<AppWindow>) {
reset_translation_session();
let _ = weak.upgrade_in_event_loop(|w| {
w.global::<LyricsState>().set_show_translation(false);
});
}
/// Toast + revert, for every translation failure path (toggle ON with no
/// current track, no resolvable target, fetch error, or a response without
/// a translation). Fail soft: the current lyrics view is left untouched.
pub fn translation_unavailable(weak: &slint::Weak<AppWindow>) {
reset_translation_session();
let _ = weak.upgrade_in_event_loop(|w| {
w.global::<LyricsState>().set_show_translation(false);
});
crate::toast::error_weak(
weak,
qbz_i18n::t("Translation is not available right now. Please try again later."),
);
}
/// Toggle ON: refetch the current track's lyrics WITH the resolved target
/// language (spec §B.3). The committed doc then carries the embedded
/// translation and `show-translation` flips on — but ONLY when the response
/// actually holds one; any gap toasts and reverts (Android
/// `player_lyrics_translation_error` parity). When the current doc already
/// holds the translation for the target (toggle off -> on on the same
/// track), the flip is local — no refetch.
pub fn enable_translation(weak: slint::Weak<AppWindow>, track: &QueueTrack) {
let Some(service) = SERVICE.get().cloned() else {
translation_unavailable(&weak);
return;
};
let source = source_kind(track);
let track_id = (source == LyricsSourceKind::Qobuz).then_some(track.id);
let duration_secs = (track.duration_secs > 0).then_some(track.duration_secs);
let key = request_identity(
track_id,
&build_cache_key(track.title.trim(), track.artist.trim(), duration_secs),
);
let request = LyricsRequest {
track_id,
source,
title: track.title.clone(),
artist: track.artist.clone(),
album: (!track.album.is_empty()).then(|| track.album.clone()),
duration_secs,
offline: crate::offline_mode::engine().is_offline(),
// Resolved inside the task (the session read is async).
language: None,
};
tokio::spawn(async move {
let Some(target) = resolve_target_language().await else {
translation_unavailable(&weak);
return;
};
// Fast path: the current doc already carries this translation.
let already = with_current_doc(|doc| {
doc.and_then(|d| d.translation.as_ref())
.and_then(|t| t.lang.as_deref())
== Some(target.as_str())
});
if already {
if let Ok(mut t) = TRANSLATION.lock() {
t.enabled = true;
t.language = Some(target);
}
let _ = weak.upgrade_in_event_loop(|w| {
w.global::<LyricsState>().set_show_translation(true);
});
return;
}
let mut request = request;
request.language = Some(target.clone());
let result = service.get(request).await;
// Same stale guard (F2) as the track-change path: a superseded
// response is dropped whole.
let response_key = match &result {
Ok(response) => {
request_identity(response.request_track_id, &response.request_key)
}
Err(_) => key.clone(),
};
{
let mut current = CURRENT.lock().expect("lyrics CURRENT lock poisoned");
if current.key != response_key {
return;
}
if matches!(
result.as_ref().map(|r| &r.outcome),
Ok(LyricsOutcome::Found(_))
) {
current.loaded = true;
}
}
match result {
Ok(response) if matches!(response.outcome, LyricsOutcome::Found(_)) => {
let has_translation = match &response.outcome {
LyricsOutcome::Found(found) => found.doc.translation.is_some(),
_ => false,
};
if has_translation {
if let Ok(mut t) = TRANSLATION.lock() {
t.enabled = true;
t.language = Some(target);
}
}
apply_result(weak.clone(), Ok(response));
let _ = weak.upgrade_in_event_loop(move |w| {
w.global::<LyricsState>().set_show_translation(has_translation);
});
if !has_translation {
// The track lacks the target language — the original
// committed above stays; toast + revert (spec §B.4).
translation_unavailable(&weak);
}
}
// NotFound / offline-miss: keep the current view untouched.
Ok(_) => translation_unavailable(&weak),
// Fetch error: NEVER an error state because of translation.
Err(e) => {
log::warn!("[qbz-slint] translation refetch failed: {e}");
translation_unavailable(&weak);
}
}
});
}
/// Qobuz vs non-Qobuz from the queue track's source tag. `qobuz_download`
/// rows carry the REAL Qobuz catalog id (`local_queue_track`), so the Qobuz
/// primary applies to them too; local user files / ephemeral folders / Plex
@@ -299,6 +513,9 @@ pub fn prefetch_lyrics(track: &QueueTrack) {
album: (!track.album.is_empty()).then(|| track.album.clone()),
duration_secs: (track.duration_secs > 0).then_some(track.duration_secs),
offline: false,
// Prefetch warms the original-only entry; the translation toggle
// (UI task) triggers the refetch-with-language when needed.
language: None,
};
tokio::spawn(async move {
// Resolution upserts into lyrics.db; the result is discarded (no UI).
@@ -313,6 +530,11 @@ pub fn on_track_changed(weak: slint::Weak<AppWindow>, track: &QueueTrack) {
return;
};
// Per-track translation toggle (owner 2026-07-23): a new track always
// starts original-only — any translation the user enabled was for the
// PREVIOUS song only.
reset_translation_session();
let source = source_kind(track);
// F4 contract, explicit: the RAW title goes to the engine (fallback
// providers match on the unversioned title; Qobuz looks up by id). The
@@ -332,6 +554,11 @@ pub fn on_track_changed(weak: slint::Weak<AppWindow>, track: &QueueTrack) {
// Offline as data, not lookup (spec §2.2.4): the engine verdict is
// read here and travels with the request.
offline: crate::offline_mode::engine().is_offline(),
// Default flow always fetches original-only (spec §B.1): the
// translation toggle is per-track (owner 2026-07-23) and was reset
// above; enabling it refetches WITH a language via
// [`enable_translation`].
language: None,
};
let key = request_identity(
request.track_id,
@@ -372,6 +599,11 @@ pub fn on_track_changed(weak: slint::Weak<AppWindow>, track: &QueueTrack) {
state.set_provider("".into());
state.set_provider_label("".into());
state.set_error("".into());
// Hide the toggle while loading — the availability of the NEXT
// track's doc is unknown until its commit. The toggle itself is
// per-track: it always starts OFF for a new track.
state.set_translation_available(false);
state.set_show_translation(false);
});
}
@@ -411,6 +643,7 @@ pub fn on_track_cleared(weak: slint::Weak<AppWindow>) {
if let Ok(mut doc) = CURRENT_DOC.lock() {
*doc = None;
}
reset_translation_session();
let _ = weak.upgrade_in_event_loop(|w| {
let state = w.global::<LyricsState>();
state.set_status(STATUS_IDLE);
@@ -424,27 +657,42 @@ pub fn on_track_cleared(weak: slint::Weak<AppWindow>) {
state.set_provider("".into());
state.set_provider_label("".into());
state.set_error("".into());
state.set_translation_available(false);
state.set_show_translation(false);
});
}
/// Map the engine response into `LyricsState` (UI thread push).
fn apply_result(weak: slint::Weak<AppWindow>, result: Result<LyricsResponse, String>) {
let (status, items, synced, provider, label, error) = match result {
let (status, items, synced, provider, label, error, translation_available) = match result {
Ok(response) => match response.outcome {
LyricsOutcome::Found(found) => {
let translation = found.doc.translation.as_deref();
let items: Vec<LyricsLineItem> = found
.doc
.lines
.iter()
.map(|line| LyricsLineItem {
.enumerate()
.map(|(i, line)| LyricsLineItem {
text: line.text.clone().into(),
time_ms: line.time_ms.map(|v| v as i32).unwrap_or(-1),
end_ms: line.end_ms.map(|v| v as i32).unwrap_or(-1),
has_words: line.words.is_some(),
// 1:1 with the rendered lines — the core filters the
// translation lines the same way as the originals;
// a missing entry degrades to "" (fail soft).
translation_text: translation
.and_then(|t| t.lines.get(i))
.map(|l| l.text.clone())
.unwrap_or_default()
.into(),
})
.collect();
let synced = found.doc.synced;
let provider = found.doc.provider;
// The toggle lights only when Qobuz advertises translations
// for this track (spec §B.2).
let translation_available = !found.doc.translation_langs.is_empty();
if let Ok(mut doc) = CURRENT_DOC.lock() {
*doc = Some(found.doc);
}
@@ -455,13 +703,14 @@ fn apply_result(weak: slint::Weak<AppWindow>, result: Result<LyricsResponse, Str
provider.as_str(),
provider_label(provider),
String::new(),
translation_available,
)
}
LyricsOutcome::NotFound => {
if let Ok(mut doc) = CURRENT_DOC.lock() {
*doc = None;
}
(STATUS_NOT_FOUND, Vec::new(), false, "", "", String::new())
(STATUS_NOT_FOUND, Vec::new(), false, "", "", String::new(), false)
}
// Typed offline miss (F3) — the view maps it to a translated
// string, never a hardcoded message.
@@ -469,7 +718,7 @@ fn apply_result(weak: slint::Weak<AppWindow>, result: Result<LyricsResponse, Str
if let Ok(mut doc) = CURRENT_DOC.lock() {
*doc = None;
}
(STATUS_OFFLINE, Vec::new(), false, "", "", String::new())
(STATUS_OFFLINE, Vec::new(), false, "", "", String::new(), false)
}
},
Err(e) => {
@@ -477,7 +726,7 @@ fn apply_result(weak: slint::Weak<AppWindow>, result: Result<LyricsResponse, Str
*doc = None;
}
log::warn!("[qbz-slint] lyrics fetch failed: {e}");
(STATUS_ERROR, Vec::new(), false, "", "", e)
(STATUS_ERROR, Vec::new(), false, "", "", e, false)
}
};
let _ = weak.upgrade_in_event_loop(move |w| {
@@ -487,6 +736,7 @@ fn apply_result(weak: slint::Weak<AppWindow>, result: Result<LyricsResponse, Str
state.set_provider(provider.into());
state.set_provider_label(label.into());
state.set_error(error.into());
state.set_translation_available(translation_available);
state.set_active_index(-1);
state.set_line_progress(0.0);
state.set_fill_anim_ms(0);
+39
View File
@@ -56,6 +56,10 @@ pub struct LyricsPrefs {
/// karaoke sweep, so the lyrics surface stops driving continuous repaints.
#[serde(default)]
pub lite_fill: bool,
/// Translation target (Qobuz v10): "auto" (account language, UI-locale
/// fallback) or an explicit ISO 639-1 code from [`TRANSLATION_LANGS`].
#[serde(default = "d_translation_lang")]
pub translation_language: String,
}
fn d_true() -> bool {
@@ -70,6 +74,9 @@ fn d_size() -> String {
fn d_dimming() -> String {
"strong".to_string()
}
fn d_translation_lang() -> String {
"auto".to_string()
}
impl Default for LyricsPrefs {
/// Tauri defaults (`lyricsDisplayStore.ts:37-44`).
@@ -82,6 +89,7 @@ impl Default for LyricsPrefs {
active_color: String::new(),
uppercase: false,
lite_fill: false,
translation_language: d_translation_lang(),
}
}
}
@@ -89,6 +97,11 @@ impl Default for LyricsPrefs {
const FONTS: [&str; 5] = ["system", "line-seed-jp", "montserrat", "noto-sans", "source-sans-3"];
const SIZES: [&str; 4] = ["small", "medium", "large", "xl"];
const DIMMINGS: [&str; 3] = ["off", "soft", "strong"];
/// Translation targets (owner-approved list, spec §Decisions.2): "auto" +
/// the observed `translation_langs` ∪ app UI locales. Order matches the
/// flyout's `translation-language-options` (Auto, en es fr de it pt nl ja ru).
const TRANSLATION_LANGS: [&str; 10] =
["auto", "en", "es", "fr", "de", "it", "pt", "nl", "ja", "ru"];
/// `#RRGGBB` (or empty = theme) — the Tauri validator
/// (`lyricsDisplayStore.ts:46-52`).
@@ -115,6 +128,9 @@ impl LyricsPrefs {
if !valid_color(&self.active_color) {
self.active_color.clear();
}
if !TRANSLATION_LANGS.contains(&self.translation_language.as_str()) {
self.translation_language = d_translation_lang();
}
self
}
}
@@ -188,6 +204,13 @@ fn dimming_index(dimming: &str) -> i32 {
DIMMINGS.iter().position(|d| *d == dimming).unwrap_or(2) as i32
}
fn translation_lang_index(lang: &str) -> i32 {
TRANSLATION_LANGS
.iter()
.position(|l| *l == lang)
.unwrap_or(0) as i32
}
fn parse_color(hex: &str) -> Option<slint::Color> {
if hex.len() != 7 || !hex.starts_with('#') {
return None;
@@ -218,6 +241,7 @@ pub fn apply_to_ui(window: &AppWindow, prefs: &LyricsPrefs) {
None => state.set_use_custom_color(false),
}
state.set_lite_fill(prefs.lite_fill);
state.set_translation_language_index(translation_lang_index(&prefs.translation_language));
}
/// Read the in-out props back into a pref set and persist — the
@@ -248,6 +272,11 @@ pub fn persist_from_ui(window: &AppWindow) {
},
uppercase: state.get_uppercase(),
lite_fill: state.get_lite_fill(),
translation_language: TRANSLATION_LANGS
.get(state.get_translation_language_index().max(0) as usize)
.copied()
.unwrap_or("auto")
.to_string(),
};
save(&prefs);
}
@@ -273,6 +302,7 @@ mod tests {
assert_eq!(p.dimming, "strong");
assert_eq!(p.active_color, "");
assert!(!p.uppercase);
assert_eq!(p.translation_language, "auto");
}
#[test]
@@ -291,6 +321,7 @@ mod tests {
active_color: "purple".into(),
uppercase: true,
lite_fill: false,
translation_language: "klingon".into(),
}
.sanitized();
assert!(!p.auto_follow); // bools pass through
@@ -299,6 +330,8 @@ mod tests {
assert_eq!(p.font_size, "medium");
assert_eq!(p.dimming, "strong");
assert_eq!(p.active_color, "");
// Unknown translation language falls back to Auto.
assert_eq!(p.translation_language, "auto");
}
#[test]
@@ -311,12 +344,14 @@ mod tests {
active_color: "#8b5cf6".into(),
uppercase: false,
lite_fill: true,
translation_language: "it".into(),
}
.sanitized();
assert_eq!(p.font, "line-seed-jp");
assert_eq!(p.font_size, "xl");
assert_eq!(p.dimming, "off");
assert_eq!(p.active_color, "#8b5cf6");
assert_eq!(p.translation_language, "it");
}
#[test]
@@ -340,10 +375,14 @@ mod tests {
for (i, d) in DIMMINGS.iter().enumerate() {
assert_eq!(dimming_index(d), i as i32);
}
for (i, l) in TRANSLATION_LANGS.iter().enumerate() {
assert_eq!(translation_lang_index(l), i as i32);
}
// Unknowns fall back to the defaults' indices.
assert_eq!(font_index("nope"), 0);
assert_eq!(size_index("nope"), 1);
assert_eq!(dimming_index("nope"), 2);
assert_eq!(translation_lang_index("nope"), 0);
}
#[test]
+175 -11
View File
@@ -40,6 +40,7 @@ mod glibc_compat;
mod log_viewer;
mod sleep_timer;
pub use qbz_text_utils::{dates, strip_html};
mod deep_link;
mod discover_browse;
mod discord_rpc;
mod discover_prefs;
@@ -122,6 +123,7 @@ mod plex_settings;
mod playlist_picker;
mod quality;
mod reco;
mod reco_dismiss;
mod recently;
mod scrobble;
mod scrobbler_settings;
@@ -351,6 +353,17 @@ async fn enter_shell(
) {
let tray = init_shell_for_user(&runtime, &weak, session.user_id);
// Deep links (argv capture / warm D-Bus OpenUrl) may now drain: the
// session is active and the AppWindow exists. Bound here at the top; the
// pending URL itself is dispatched at the very END of this function so
// the startup-page/view restore below can't re-root over the deep link.
deep_link::bind_shell_ctx(
runtime.clone(),
weak.clone(),
tokio::runtime::Handle::current(),
image_cache.clone(),
);
let _ = weak.upgrade_in_event_loop(move |w| {
let state = w.global::<SessionState>();
state.set_user_name(session.display_name.into());
@@ -494,6 +507,30 @@ async fn enter_shell(
}
}
}
// External-reco artist rows (Discover > Recommendations):
// same in-place re-seed — the rows may already be painted
// from the results blob before this warm lands (their
// build-time fav_cache seed was stale/empty then).
let reco = w.global::<ExternalRecoState>();
for model in [
reco.get_rec_artists_common(),
reco.get_rec_artists_recent(),
reco.get_top_artists(),
] {
for i in 0..model.row_count() {
if let Some(mut it) = model.row_data(i) {
let following = it
.id
.parse::<u64>()
.map(|id| fav_cache::is_artist_favorite(id))
.unwrap_or(false);
if it.following != following {
it.following = following;
model.set_row_data(i, it);
}
}
}
}
});
}
Err(e) => log::warn!("[qbz-slint] favorite artists warm failed: {e}"),
@@ -635,6 +672,14 @@ async fn enter_shell(
let _ = weak.upgrade_in_event_loop(move |w| {
favorites::apply_counts(&w, counts);
});
// XDG deep link: drain a pending Qobuz URL LAST — after the startup-page
// / view-restore block above, so the restore can't re-root over the deep
// link (the navigation lands on top of whatever was restored). Session
// active, AppWindow alive: no readiness sleep needed. Nothing pending =>
// no-op. (Offline entries never reach here — enter_shell_offline keeps
// the URL pending; navigation needs the API.)
deep_link::drain_pending();
}
/// Offline session entry — "Start offline" on the login screen (spec §4.1).
@@ -684,6 +729,9 @@ async fn enter_shell_offline(
if let Some(dir) = crate::offline_mode::user_data_dir(user_id) {
crate::offline_mode::init_for_user(&dir);
crate::fav_cache::init_for_user(&dir);
// Reco-scoped "Not interested" dismissal store (Discover >
// Recommendations rails only — NOT the blacklist).
crate::reco_dismiss::init_for_user(&dir);
// Recommendation event store (shared events.db with Tauri).
crate::reco::init_for_user(&dir);
// External-recommendations resolution cache (4th Discover tab).
@@ -4962,6 +5010,23 @@ fn reseed_i18n_labels(window: &AppWindow) {
t("Lite"),
t("Off"),
])));
// Lyrics translation-language options (v10): the Auto label is @tr'd,
// the language names are native literals — the same convention as
// `languages` above.
window.global::<LyricsState>().set_translation_language_options(ModelRc::new(
VecModel::from(vec![
t("Auto (account language)"),
"English".into(),
"Español".into(),
"Français".into(),
"Deutsch".into(),
"Italiano".into(),
"Português".into(),
"Nederlands".into(),
"日本語".into(),
"Русский".into(),
]),
));
// Cast picker: per-renderer cap options (#638 fix 4) — option 0 embeds
// the live global streaming-quality label, so this also re-reads
// ui_prefs (the Settings streaming-quality arm re-pushes on change).
@@ -8045,21 +8110,18 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
std::env::var("SLINT_SCALE_FACTOR").unwrap_or_default()
);
}
// XDG deep link (Exec=qbz %u): capture a Qobuz link from argv BEFORE the
// single-instance guard below — a second launch must read its own argv
// before deciding to raise the primary and exit (the guard forwards the
// stashed URL over D-Bus; as primary it drains at the end of enter_shell).
deep_link::capture_argv();
// Artwork decode targets grow with the preset so covers stay sharp at
// Large/XL (and shrink RAM at Small). Set before any artwork job runs.
crate::artwork::set_ui_scale_factor(ui_scale_factor);
// Install the rustls process-level CryptoProvider ONCE, before ANY TLS use.
// The full binary compiles BOTH rustls providers (aws-lc-rs via qbz-cast's
// rust_cast, ring via reqwest), so rustls cannot auto-select one and panics
// ("Could not automatically determine the process-level CryptoProvider") the
// first time a TLS connection opens. Previously this was only installed lazily
// on the cast paths, so QConnect's tokio-tungstenite WebSocket (it opens a
// rustls TLS channel on its own worker thread) panicked when the user joined a
// session WITHOUT ever casting. Installing here at startup covers every TLS
// consumer — QConnect, cast, reqwest — regardless of which connects first.
// Idempotent (the cast paths still call it; the second call is a no-op).
qbz_cast::ensure_crypto_provider();
// Install the rustls process-level `CryptoProvider`
qbz_app::ensure_crypto_provider();
let tokio_rt = tokio::runtime::Runtime::new()?;
let _enter = tokio_rt.enter();
@@ -10538,6 +10600,9 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
window.on_logout(move || {
// Drop any Discord "now listening" activity on logout.
discord_rpc::clear(&handle);
// Back at the login screen a pending deep link must wait for the
// next enter_shell, not fire into the torn-down session.
deep_link::clear_shell_ctx();
// Clear the per-user purchases cache + download-status store so the
// next account never sees the previous user's purchased items or
// in-flight download statuses (cross-account data leak).
@@ -12529,6 +12594,70 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
});
}
}
// "Not interested" (reco-scoped dismissal — NOT the app-wide
// blacklist): persist the dismissal, drop the card from the
// Recommendations rails live, and backfill the freed slot from
// the retained overflow. The artist stays visible everywhere
// else (search/home/label pages); future paints exclude it via
// the §B filter.
("artist", "not-interested") => {
if let Some(w) = weak.upgrade() {
let snapshot =
crate::external_reco::apply_artist_dismissal(&w, &image_cache, &id);
match snapshot {
Some((name, image)) => {
if let Ok(aid) = id.parse::<u64>() {
crate::reco_dismiss::dismiss(aid, &name, &image);
}
crate::toast::info_weak(
&weak,
qbz_i18n::t_args(
"{} won't appear in Recommendations anymore",
&[&name],
),
);
}
None => {
// Dismissed from a non-reco surface (search /
// home / pinned card): nothing to remove live
// — resolve the display name, then persist.
let runtime = runtime.clone();
let weak = weak.clone();
let artist_id = id.clone();
handle.spawn(async move {
let Ok(aid) = artist_id.parse::<u64>() else {
return;
};
let (name, image) = runtime
.core()
.get_artist(aid)
.await
.map(|a| {
(
a.name,
a.image
.and_then(|i| i.best().cloned())
.unwrap_or_default(),
)
})
.unwrap_or_default();
crate::reco_dismiss::dismiss(aid, &name, &image);
let msg = if name.is_empty() {
qbz_i18n::t("Artist dismissed from Recommendations")
} else {
qbz_i18n::t_args(
"{} won't appear in Recommendations anymore",
&[&name],
)
};
let _ = weak.upgrade_in_event_loop(move |w| {
crate::toast::info(&w, msg);
});
});
}
}
}
}
// === Label landing actions ===============================
("label", "follow") => {
// Toggle the label favorite, optimistically flipping the
@@ -14130,6 +14259,30 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
lyrics::copy_current_lyrics(&weak);
});
}
{
// Translation toggle (Qobuz v10, sidebar floating button). OFF is
// pure UI (no network); ON resolves the target language and refetches
// the current track's lyrics with it — any gap toasts and reverts
// inside lyrics::enable_translation / translation_unavailable.
let runtime = app_runtime.clone();
let weak = window.as_weak();
let handle = tokio_rt.handle().clone();
window.global::<LyricsState>().on_toggle_translation(move || {
if lyrics::translation_enabled() {
lyrics::disable_translation(&weak);
return;
}
let runtime = runtime.clone();
let weak = weak.clone();
handle.spawn(async move {
let state = runtime.core().get_queue_state().await;
match state.current_track {
Some(track) => lyrics::enable_translation(weak, &track),
None => lyrics::translation_unavailable(&weak),
}
});
});
}
{
// Settings > Offline lyrics-cache row: stats refresh on section
// mount + clear action (F1: stats from the real per-user DB).
@@ -16484,6 +16637,17 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
}
});
}
// --- Reco-dismissal callbacks (the Recommendations tab) ---
{
let weak = window.as_weak();
window
.global::<BlacklistActions>()
.on_remove_dismissed(move |id| {
if let Some(w) = weak.upgrade() {
blacklist_manager::remove_dismissed(&w, id);
}
});
}
{
let weak = window.as_weak();
let bl_runtime_b = app_runtime.clone();
+3
View File
@@ -607,6 +607,9 @@ fn mirror_lyrics_gated(main: &AppWindow, mini: &MiniPlayerWindow) {
d.set_active_index(s.get_active_index());
d.set_line_progress(s.get_line_progress());
d.set_fill_anim_ms(s.get_fill_anim_ms());
// Translation toggle (v10): the mini surface has no button of its own —
// it follows the sidebar's bilingual state through the shared model.
d.set_show_translation(s.get_show_translation());
refresh_mini_segments(&d);
// Gate the lines-model copy on (status, line-count) so we don't thrash the
+234
View File
@@ -0,0 +1,234 @@
//! Per-user "Not interested" dismissal store for Discover > Recommendations.
//!
//! Reco-SCOPED dismissal — deliberately NOT the app-wide blacklist: a
//! dismissed artist only leaves the two Recommended-Artist rails ("More like
//! the artists you love" / "Based on what you've been into lately"); it stays
//! visible in search, home, and label pages. The paint choke point in
//! `crate::external_reco` folds [`ids_snapshot`] into its exclusion set, and
//! the Blacklist Manager's "Recommendations" tab lists / undoes entries.
//!
//! Shape follows the light `discovery_dismiss` precedent (one small JSON file,
//! a full read on each op — no SQLite, no change-notify) but bound PER-USER
//! like `fav_cache` / `artist_blacklist`: a process-global path set via
//! [`init_for_user`] / dropped by [`teardown`]. Fail-open everywhere: with no
//! session bound (or a corrupt file) reads are empty and mutations no-op.
use std::collections::HashSet;
use std::path::{Path, PathBuf};
use std::sync::Mutex;
use serde::{Deserialize, Serialize};
/// JSON file name inside the per-user data dir.
const FILE_NAME: &str = "reco_dismiss.json";
/// One dismissed artist. `image_url` is optional (used only if a future
/// surface wants a thumbnail; the manager tab renders a generic avatar).
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DismissedArtist {
#[serde(default)]
pub artist_id: u64,
#[serde(default)]
pub name: String,
#[serde(default)]
pub image_url: String,
}
#[derive(Default, Serialize, Deserialize)]
struct DismissStore {
#[serde(default)]
artists: Vec<DismissedArtist>,
}
/// The bound per-user file. `None` outside an active session (pure fail-open
/// window), matching the `fav_cache` lifecycle.
static STORE_PATH: Mutex<Option<PathBuf>> = Mutex::new(None);
/// Bind the per-user store path from `<dir>/reco_dismiss.json`. Called on
/// every session activation — login, restore, AND offline entry — next to
/// `fav_cache::init_for_user`.
pub fn init_for_user(base_dir: &Path) {
if let Ok(mut guard) = STORE_PATH.lock() {
*guard = Some(base_dir.join(FILE_NAME));
}
}
/// Drop the binding on logout. Mirrors `fav_cache::teardown`.
pub fn teardown() {
if let Ok(mut guard) = STORE_PATH.lock() {
*guard = None;
}
}
fn store_path() -> Option<PathBuf> {
STORE_PATH.lock().ok().and_then(|g| g.clone())
}
/// Fail-open read: no binding, unreadable file, or unknown/corrupt format all
/// yield an empty store (a corrupted file never blocks recommendations — the
/// user simply re-dismisses).
fn load_store() -> DismissStore {
let Some(path) = store_path() else {
return DismissStore::default();
};
match std::fs::read(&path) {
Ok(bytes) => serde_json::from_slice(&bytes).unwrap_or_default(),
Err(_) => DismissStore::default(),
}
}
fn write_store(store: &DismissStore) {
let Some(path) = store_path() else {
return;
};
if let Some(parent) = path.parent() {
if let Err(e) = std::fs::create_dir_all(parent) {
log::warn!("[qbz-slint] reco-dismiss dir failed: {e}");
return;
}
}
match serde_json::to_vec_pretty(store) {
Ok(json) => {
if let Err(e) = std::fs::write(&path, json) {
log::warn!("[qbz-slint] reco-dismiss write failed: {e}");
}
}
Err(e) => log::warn!("[qbz-slint] reco-dismiss serialize failed: {e}"),
}
}
/// Snapshot of the dismissed id set — the §B paint-filter input. Empty when
/// no session is bound. Id 0 (a corrupt row) never matches.
pub fn ids_snapshot() -> HashSet<u64> {
load_store()
.artists
.into_iter()
.map(|a| a.artist_id)
.filter(|id| *id != 0)
.collect()
}
/// All dismissed artists in insertion order, for the manager tab. Empty on no
/// session or a corrupt file.
pub fn list() -> Vec<DismissedArtist> {
load_store()
.artists
.into_iter()
.filter(|a| a.artist_id != 0)
.collect()
}
/// Record a dismissal (idempotent). A re-dismiss with a richer snapshot
/// backfills a previously empty name/image (e.g. first dismissed offline,
/// where the name could not be resolved).
pub fn dismiss(artist_id: u64, name: &str, image_url: &str) {
if artist_id == 0 {
return;
}
let mut store = load_store();
match store.artists.iter().position(|a| a.artist_id == artist_id) {
Some(idx) => {
let existing = &mut store.artists[idx];
if existing.name.is_empty() && !name.is_empty() {
existing.name = name.to_string();
}
if existing.image_url.is_empty() && !image_url.is_empty() {
existing.image_url = image_url.to_string();
}
}
None => store.artists.push(DismissedArtist {
artist_id,
name: name.to_string(),
image_url: image_url.to_string(),
}),
}
write_store(&store);
}
/// Remove a dismissal (the manager tab's undo). No-op when absent / unbound.
pub fn remove(artist_id: u64) {
let mut store = load_store();
let before = store.artists.len();
store.artists.retain(|a| a.artist_id != artist_id);
if store.artists.len() != before {
write_store(&store);
}
}
#[cfg(test)]
mod tests {
use super::*;
/// Unique temp dir under the system temp root (no `tempfile` dev-dep on
/// qbz-slint). Created here, removed at the end of the test.
fn unique_temp_dir() -> std::path::PathBuf {
let nanos = std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.unwrap()
.as_nanos();
let dir = std::env::temp_dir().join(format!("qbz-slint-reco-dismiss-test-{nanos}"));
std::fs::create_dir_all(&dir).expect("create temp dir");
dir
}
/// One combined test: the path singleton is process-global, so splitting
/// into parallel tests would let them clobber each other. Covers the full
/// lifecycle: bind, dismiss (idempotent + snapshot backfill), persistence
/// across a re-bind, remove, unknown-format tolerance, and the fail-open
/// unbound state.
#[test]
fn lifecycle_roundtrip() {
let dir = unique_temp_dir();
init_for_user(&dir);
assert!(ids_snapshot().is_empty(), "fresh store has no ids");
assert!(list().is_empty(), "fresh store has no rows");
dismiss(42, "Artist X", "https://img/x.jpg");
dismiss(7, "Artist Y", "");
assert!(ids_snapshot().contains(&42));
assert!(ids_snapshot().contains(&7));
assert_eq!(list().len(), 2);
// Idempotent: a re-dismiss does not duplicate, but backfills an empty
// snapshot field.
dismiss(42, "Artist X", "https://img/x.jpg");
dismiss(7, "Artist Y", "https://img/y.jpg");
assert_eq!(list().len(), 2, "no duplicate rows");
assert_eq!(list()[1].image_url, "https://img/y.jpg", "image backfilled");
// Id 0 is rejected and never matches.
dismiss(0, "Nobody", "");
assert!(!ids_snapshot().contains(&0));
// Persistence: re-binding the same dir loads the file back.
teardown();
assert!(ids_snapshot().is_empty(), "fail-open after teardown");
dismiss(9, "Lost", ""); // no-op while unbound; must not panic
init_for_user(&dir);
assert!(ids_snapshot().contains(&42), "rows survive a re-bind");
assert!(!ids_snapshot().contains(&9), "unbound mutation did not persist");
// Undo.
remove(42);
assert!(!ids_snapshot().contains(&42));
assert_eq!(list().len(), 1);
remove(42); // absent: no-op, no write needed
// Unknown-format tolerance: junk in the file reads as an empty store.
std::fs::write(dir.join(FILE_NAME), b"{ not json !!").expect("write junk");
assert!(ids_snapshot().is_empty(), "corrupt file fails open");
assert!(list().is_empty());
// A partially-unknown row shape degrades to defaults, not a crash.
std::fs::write(
dir.join(FILE_NAME),
br#"{"artists":[{"artist_id":5},{"artist_id":0,"name":"zero"}]}"#,
)
.expect("write partial");
assert!(ids_snapshot().contains(&5), "partial row still loads");
assert!(!ids_snapshot().contains(&0), "id 0 row is dropped");
teardown();
let _ = std::fs::remove_dir_all(&dir);
}
}
+6 -6
View File
@@ -1,9 +1,9 @@
//! Share-link helpers — Qobuz track URL + Song.link (Odesli) resolution
//! + clipboard copy. Used by the track context menu's Share actions.
/// Canonical Qobuz track URL (the same form Tauri feeds to Song.link).
/// Canonical Qobuz track URL — the `open.qobuz.com` share form (#514).
pub fn qobuz_track_url(track_id: &str) -> String {
format!("https://www.qobuz.com/track/{track_id}")
format!("https://open.qobuz.com/track/{track_id}")
}
/// Qobuz web-player playlist URL (matches Tauri's share-playlist link).
@@ -11,11 +11,11 @@ pub fn qobuz_playlist_url(playlist_id: &str) -> String {
format!("https://play.qobuz.com/playlist/{playlist_id}")
}
/// Qobuz web-player album URL (matches Tauri's `shareAlbumQobuzLink`,
/// `https://play.qobuz.com/album/{id}`). Also the source URL fed to
/// Song.link for the album-level "Album.link".
/// Qobuz album URL — the `open.qobuz.com` form (#514; Tauri's
/// `shareAlbumQobuzLink` used `https://play.qobuz.com/album/{id}`). Also
/// the source URL fed to Song.link for the album-level "Album.link".
pub fn qobuz_album_url(album_id: &str) -> String {
format!("https://play.qobuz.com/album/{album_id}")
format!("https://open.qobuz.com/album/{album_id}")
}
/// Qobuz web-player artist URL (header Share action).
+51 -15
View File
@@ -6,14 +6,18 @@
//! The first instance takes ownership of the well-known session-bus name
//! `com.blitzfc.qbz` (Flatpak auto-grants owning the app-id name — no
//! finish-args change needed) and exports a `com.blitzfc.qbz.SingleInstance`
//! interface with a `Present()` method. A second launch sees the name taken,
//! calls `Present()` — which raises whichever window is current (the mini
//! when the miniplayer is open, else the main window) and works from process
//! start, login screen included — and exits. If the primary predates the
//! interface (≤2.0.x) the call errors and the second launch falls back to
//! the MPRIS `Raise` method, which only exists after session entry. Any
//! D-Bus problem — no session bus, weird sandbox — falls through as "we are
//! primary": the guard must never block startup.
//! interface with `Present()` and `OpenUrl(url)` methods. A second launch
//! sees the name taken and calls `OpenUrl(url)` when its own argv carried a
//! Qobuz deep link (the primary presents itself AND navigates — Tauri
//! parity, the piece #618 didn't port) or `Present()` otherwise — which
//! raises whichever window is current (the mini when the miniplayer is
//! open, else the main window) and works from process start, login screen
//! included — and exits. If the primary predates the interface (≤2.0.x) the
//! call errors and the second launch falls back to the MPRIS `Raise`
//! method, which only exists after session entry. `OpenUrl` failing on an
//! older primary (interface present, method missing) falls back to bare
//! `Present()`. Any D-Bus problem — no session bus, weird sandbox — falls
//! through as "we are primary": the guard must never block startup.
//!
//! Blocking zbus API on purpose: this runs once on the main thread before
//! the UI exists, and the async-io executor self-drives the connection
@@ -54,16 +58,35 @@ static PENDING_PRESENT: AtomicBool = AtomicBool::new(false);
/// primary sits at the login window must still raise it).
struct SingleInstanceIface;
/// Shared Present path for the iface methods: raise whichever window is
/// current, or remember the request until `bind_window` (simultaneous cold
/// starts: the DoNotQueue loser can call in while the winner is still
/// initializing).
fn present_or_defer() {
match MAIN_WEAK.get() {
Some(weak) => crate::tray::present(weak),
None => PENDING_PRESENT.store(true, Ordering::SeqCst),
}
}
#[zbus::interface(name = "com.blitzfc.qbz.SingleInstance")]
impl SingleInstanceIface {
/// Raise whichever window is current (mini when the miniplayer is open,
/// else the main window). Runs on a zbus executor thread — never touch
/// Slint state here; `tray::present` routes through the event loop.
fn present(&self) {
match MAIN_WEAK.get() {
Some(weak) => crate::tray::present(weak),
None => PENDING_PRESENT.store(true, Ordering::SeqCst),
}
present_or_defer();
}
/// A second launch carrying a Qobuz deep link forwards it here: stash
/// the URL, present ourselves, and dispatch it through the running
/// instance's Ctrl+L link-resolver flow (`deep_link::drain_pending`).
/// With no shell up (sitting at the login screen, or offline) the URL
/// stays pending for the next successful `enter_shell`.
fn open_url(&self, url: &str) {
crate::deep_link::stash(url.to_string());
present_or_defer();
crate::deep_link::drain_pending();
}
}
@@ -110,9 +133,22 @@ fn probe() -> zbus::Result<bool> {
// runs. Ask it to present itself; both calls are best-effort — the
// duplicate still must not start.
RequestNameReply::Exists | RequestNameReply::InQueue => {
let presented = conn
.call_method(Some(BUS_NAME), OBJECT_PATH, Some(IFACE_NAME), "Present", &())
.is_ok();
// Carrying a deep link from argv (captured at process start)?
// Forward it: OpenUrl makes the primary present itself AND
// navigate. An older primary without the method errors → the
// bare-Present ladder below (version-skew tolerance); the URL
// is then lost with this exiting process, same as a failed emit
// in the Tauri era.
let forwarded = match crate::deep_link::take_pending() {
Some(url) => conn
.call_method(Some(BUS_NAME), OBJECT_PATH, Some(IFACE_NAME), "OpenUrl", &url)
.is_ok(),
None => false,
};
let presented = forwarded
|| conn
.call_method(Some(BUS_NAME), OBJECT_PATH, Some(IFACE_NAME), "Present", &())
.is_ok();
if !presented {
// Older primary (≤2.0.x) without the SingleInstance interface:
// fall back to MPRIS Raise. Full MPRIS name =
+2
View File
@@ -988,6 +988,8 @@ mod tests {
display_name: "Tester".into(),
subscription_label: "studio".into(),
subscription_valid_until: None,
country_code: None,
language_code: None,
};
set_logged_in(&shared, &session);
let s = shared.lock().unwrap();
+3
View File
@@ -256,6 +256,9 @@ enum ConfigCmd { Path, Show { #[arg(long)] json: bool } }
#[tokio::main]
async fn main() {
// Install the rustls process-level `CryptoProvider`
qbz_app::ensure_crypto_provider();
let cli = Cli::parse();
let code = match cli.cmd {
Cmd::Version { json } => {
+10 -4
View File
@@ -1,8 +1,12 @@
# 2.0.2 — Rebuild 破 (You Can (Not) Advance)
Oops, this release grew bigger than expected! Version 2.0.2 started as a maintenance patch but ended up pulling in several pending features that made perfect sense after the switch to Slint.
Here are the main highlights:
The QBZ Daemon: A highly requested, headless binary. While still an early version, it has the essentials to hook up your DAC to a Raspberry Pi and run QBZ directly from the terminal, fully supporting Qobuz Connect. Kiosk Mode: A simplified, touch-friendly UI—admittedly a personal treat for my own Raspberry Pi and HiFi hat setup. Desktop Improvements: A new dynamic album art background, heavy audio chain hardening, and better overall performance.
Oops, this release grew bigger than expected! Version 2.0.2 started as a maintenance patch but ended up pulling in several pending features that made perfect sense after the switch to Slint. Here are the main highlights:
The QBZ Daemon: A highly requested, headless binary. While still an early version, it has the essentials to hook up your DAC to a Raspberry Pi and run QBZ directly from the terminal, fully supporting Qobuz Connect.
Kiosk Mode: A simplified, touch-friendly UI—admittedly a personal treat for my own Raspberry Pi and HiFi hat setup.
Desktop Improvements: A new dynamic album art background, heavy audio chain hardening, and better overall performance.
---
@@ -63,7 +67,7 @@ The rest is the kind of work you feel more than see — the full list is in the
- **New Catppuccin themes** — Latte, Frappé and Macchiato, thanks to [@TerminalTilt](https://github.com/TerminalTilt); plus a searchable theme dropdown and light-theme legibility fixes.
- **Interface** — a unified track context menu, cursor-anchored card menus, and assorted layout fixes.
- **Tighter security** — secret files stored `0600`, redacted logs, and Last.fm token prefixes no longer logged.
- **Casting with guardails** - If your streamer/receiver doesn't support HiFi or strugle with certain high sample rates, this one is the one feature that you are looking for.
- **Casting with guardails** — If your streamer/receiver doesn't support HiFi or strugle with certain high sample rates, this one is the one feature that you are looking for.
- **Under the hood** — a headless playback driver, a settings bundle engine, a Qobuz 403 circuit breaker, and routine dependency bumps.
---
@@ -77,6 +81,8 @@ Headless Improvements: Hardening the daemon and gathering community feedback for
Instance-to-Instance Remote Control: Running parallel to Qobuz Connect, this will let you control one QBZ instance from another (e.g., controlling your bathroom's Raspberry Pi from your office desktop).
---
## What Won't Be Developed
- A TUI Player or WebPlayer: The daemon covers most use cases and its documentation and design makes it easy to build custom controls with minimal effort—whether you want a Plasma widget or a simple web frontend, in example.
+2 -2
View File
@@ -16,9 +16,9 @@
# when tagging a new release. (npmHash is gone —
# v2.0+ is the Slint crates/ workspace, no node.)
# ──────────────────────────────────────────────
qbzVersion = "2.0.1";
qbzVersion = "2.0.2";
qbzRev = "v${qbzVersion}";
srcHash = "sha256-rUL0yYXn2pCniGIsIdMd0EgAQmHir6I/rr8A/rP7cz4=";
srcHash = "sha256-zseGL7IcH/fdc4TDVwU3Tml1X6wCvSaYCji5D5RxAuA=";
# Runtime libraries winit/wgpu/glutin dlopen at runtime — a Nix
# binary cannot find system copies, so the installed program is
+1 -1
View File
@@ -9,4 +9,4 @@ Terminal=false
StartupWMClass=com.blitzfc.qbz
StartupNotify=true
Keywords=music;audio;qobuz;hifi;streaming;audiophile;flac;
MimeType=x-scheme-handler/qbz;x-scheme-handler/qobuzapp;
MimeType=x-scheme-handler/qobuzapp;
+1 -1
View File
@@ -9,4 +9,4 @@ Terminal=false
StartupWMClass=com.blitzfc.qbz
StartupNotify=true
Keywords=music;audio;qobuz;hifi;streaming;audiophile;flac;
MimeType=x-scheme-handler/qbz;x-scheme-handler/qobuzapp;
MimeType=x-scheme-handler/qobuzapp;
+1 -1
View File
@@ -9,4 +9,4 @@ Terminal=false
StartupWMClass=com.blitzfc.qbz
StartupNotify=true
Keywords=music;audio;qobuz;hifi;streaming;audiophile;flac;
MimeType=x-scheme-handler/qbz;x-scheme-handler/qobuzapp;
MimeType=x-scheme-handler/qobuzapp;
+1 -1
View File
@@ -9,4 +9,4 @@ Terminal=false
StartupWMClass=com.blitzfc.qbz
StartupNotify=true
Keywords=music;audio;qobuz;hifi;streaming;audiophile;flac;
MimeType=x-scheme-handler/qbz;x-scheme-handler/qobuzapp;
MimeType=x-scheme-handler/qobuzapp;
+1 -1
View File
@@ -9,4 +9,4 @@ Categories=AudioVideo;Audio;Music;Player;
Keywords=music;audio;qobuz;hifi;streaming;audiophile;flac;
StartupWMClass=com.blitzfc.qbz
StartupNotify=true
MimeType=x-scheme-handler/qbz;x-scheme-handler/qobuzapp;
MimeType=x-scheme-handler/qobuzapp;
+1 -1
View File
@@ -9,4 +9,4 @@ Terminal=false
StartupWMClass=com.blitzfc.qbz
StartupNotify=true
Keywords=music;audio;qobuz;hifi;streaming;audiophile;flac;
MimeType=x-scheme-handler/qbz;x-scheme-handler/qobuzapp;
MimeType=x-scheme-handler/qobuzapp;
Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 KiB