Commit Graph
512 Commits
Author SHA1 Message Date
vicrodh 9444269fd6 fix(qconnect): fix seekbar position sync with remote controllers
Root cause: server pause/resume commands send None for position and
tracks, which the renderer state blindly overwrote. Then renderer
reports sent null position to the server, making controllers show the
track as finished.

Three-part fix:
1. renderer.rs: only overwrite position/tracks when server provides
   a non-None value (retain last known values through pause/resume)
2. app.rs + qconnect_service.rs: update renderer state position from
   frontend periodic reports so the internal state always has the
   real playback position
3. +page.svelte: increase position report frequency from 5s to 2s
   for smoother seekbar updates on controllers
2026-02-22 12:57:50 -06:00
vicrodh e240c12897 fix(qconnect): fix Play Next blocked by missing source field and admission handoff
Root cause: inline BackendQueueTrack constructions in +page.svelte were
missing the 'source' field, causing resolveQconnectTrackOrigin to return
'external_unknown' which the admission system blocks.

Fix adds source:'qobuz' and streamable to all three inline track
constructions (album play next, playlist play next, album detail play
next).

Also restructures queueTrackNext and queueTrackLater to use a
useLocalFallback flag when admission rejects with
handoff_intent='continue_locally', so the track actually gets queued
locally instead of silently failing.
2026-02-22 12:11:15 -06:00
vicrodh c57272ec16 fix(qconnect): sync QBZ queue on remote events and add diagnostic logging
Frontend queue sync: listen to QConnect events (QueueUpdated,
RendererCommandApplied, PendingActionCompleted) and call
syncQueueState() so QBZ UI reflects the remote queue state when
controllers skip next/prev.

Diagnostic logging added to:
- v2_qconnect_evaluate_queue_admission (entry/exit)
- v2_qconnect_send_command_with_admission (entry/exit/error)
- align_corebridge_queue_cursor (track position)
- materialize_remote_queue_to_corebridge (version/items)
- Frontend queueTrackNext/queueTrackLater (decision points)
2026-02-22 12:03:52 -06:00
vicrodh 92b82a62dd fix(qconnect): revert seconds back to milliseconds for position reports
Logs confirm the QConnect protocol uses milliseconds for current_position
and duration fields. The 'seconds' fix was incorrect - the position
display issue was already resolved by the spam fix in 807b775a.
2026-02-22 02:39:39 -06:00
vicrodh bf66bd2eac fix(qconnect): send position/duration in seconds, not milliseconds
QConnect protocol uses seconds for current_position and duration fields.
Frontend was sending milliseconds (currentTime * 1000), causing controllers
to show track position at the end instead of actual progress.
2026-02-22 02:36:06 -06:00
vicrodh 807b775acf fix(qconnect): fix state report spam and null queue_item_id errors
Two bugs caused "Current track not found in queue nor autoplay" errors:

1. prevTrackId only updated when allowLocalSessionPersistence was true,
   but during QConnect mode this is always false. This made every 1s
   playback tick fire a state report (trackId != null always != prevTrackId
   which was stuck at null).

2. Frontend sent currentQueueItemId: null in all reports because it
   doesn't know about QConnect queue_item_ids. Server rejected every
   report.

Fixes:
- Update prevTrackId unconditionally (not gated by session persistence)
- Backend auto-fills queue_item_ids from renderer state when frontend
  passes null
- Track next_queue_item_id in sync state alongside current
- Add throttled 5s periodic position report for controller progress
2026-02-22 02:17:13 -06:00
vicrodh aa6ac1977b fix(qconnect): add remote control mode to playerStore to prevent gapless interception
The gapless transition detection was intercepting QConnect track changes
before the "Track changed externally" handler could process them. Since
the gapless callback returned early (QConnect guard), the event was
silently swallowed and the UI never updated.

Added remoteControlMode flag to playerStore that disables:
- Gapless transition interception (the root cause)
- Fallback end-of-track detection
- Auto-advance on track end

This allows the "Track changed externally" handler to run and sync
the song card, seek bar, and volume with the QConnect-controlled track.
2026-02-22 01:53:01 -06:00
vicrodh 925d04c062 fix(qconnect): disable frontend auto-advance, gapless, and resume-from-stop during QConnect renderer mode
When QConnect is connected as renderer, the server/controller manages
track advancement. The frontend must not auto-advance, pre-queue gapless
tracks, or resume from stop on its own, as this fights the remote controller
and causes rapid queue scrolling without actual playback.
2026-02-22 01:47:40 -06:00
vicrodh 6e8ef5d535 feat(qconnect): add controller UI with session info, transport controls, volume, and renderer selector
- Add session card showing active renderer and renderer list
- Add controller transport buttons (play/pause/stop) via v2_qconnect_set_player_state
- Add volume slider and mute toggle via v2_qconnect_set_volume/mute_volume
- Add renderer selector with set-active-renderer button
- Pass sessionSnapshot prop from +page.svelte to QconnectPanel
- Add i18n keys for all new controller UI elements (en + es)
2026-02-21 23:30:02 -06:00
vicrodh ce362f5635 feat(qconnect): relay local player state changes to QConnect server
When QBZ is acting as a QConnect renderer, local user interactions
(volume change, play/pause) are now reported back to the server via
v2_qconnect_report_volume and v2_qconnect_report_playback_state.
This keeps the controller in sync with QBZ's actual state.
2026-02-21 23:23:56 -06:00
vicrodh b89c9eb5f0 feat(qconnect-ui): isolate local session persistence and route batch queue ops via admission
cx
2026-02-21 13:49:58 -06:00
vicrodh ec4a9e41eb feat(ui): add Qobuz Connect panel with runtime diagnostics
cx
2026-02-21 13:38:23 -06:00
vicrodh 95f916c6d4 feat(ui): add Qobuz Connect toggle button beside cast
cx
2026-02-21 13:23:20 -06:00
vicrodh 06c6b3457b feat(radio): add track radio submenu to playlist and favorites views
Thread onCreateQbzRadio/onCreateQobuzRadio through TrackRow,
VirtualizedTrackList, PlaylistDetailView, and FavoritesView so
track context menus in playlists and favorites show the radio
submenu with QBZ Radio and Qobuz Radio options.
2026-02-21 07:34:58 -06:00
vicrodh 209cacb569 feat(mixes): add FavQ and TopQ to Your Mixes section
FavQ shuffles up to 50 tracks from the user's Qobuz favorites.
TopQ seeds the Qobuz suggest API from the user's most-played playlists.
Both have same-day cache, refresh button, red/blue gradient artwork,
and a "qbz" badge (vs "qobuz" on DailyQ/WeeklyQ).
2026-02-20 22:45:55 -06:00
vicrodh 557414ce4e feat(radio): add album radio button to UI
Add Radio button to album detail header (next to favorite button)
that calls v2_create_album_radio, populates the queue with Qobuz
API recommended tracks, and starts playback of the first track.

Add i18n keys for album radio in all 4 locale files (en/es/de/fr).
2026-02-20 21:35:15 -06:00
vicrodh 06c0e9735c fix(session): use struct return type and proactive saves
Two fixes for session not persisting:

1. Changed v2_get_all_queue_tracks to return a struct instead of a
   tuple — Tauri IPC serialization of tuples is unreliable.

2. Added proactive session saves instead of relying on async
   beforeunload (which races with window close):
   - Debounced full save on track change (2s after new track starts)
   - Debounced full save on pause
   - Reduced periodic save from 60s to 15s during playback
   - Close handler remains as best-effort backup
2026-02-20 20:43:35 -06:00
vicrodh aa1aa32f7a fix(session): save full queue with all tracks and metadata
The save was broken in two ways:
1. Only current_track + upcoming (capped at 20) were saved, dropping
   all history tracks. Queue was reconstructed incomplete on restore.
2. Track metadata (hires, bit_depth, sample_rate, source, etc.) was
   not being persisted, only the basic 6 fields.

Add v2_get_all_queue_tracks command that returns the full uncapped
track list with correct current_index. Use it in saveSessionBeforeClose
instead of the capped v2_get_queue_state. Map all metadata fields.
2026-02-20 20:33:39 -06:00
vicrodh 5a0d4c50a1 feat(session): re-enable session restore and add startup page setting
Re-enable queue/track restore on startup (visual only, paused at 0:00).
Update saveSessionBeforeClose to persist current view with context IDs.
Add "Startup page" dropdown in Settings > Appearance (Home / Where you
left off) that controls whether the last view is restored on launch.
i18n keys added to all 4 locale files.
2026-02-20 20:02:26 -06:00
vicrodh b78b67fa8c feat(link-resolver): cross-platform music link resolution via Odesli
Ctrl+L now accepts URLs from Spotify, Apple Music, Tidal, Deezer, and
song.link/album.link in addition to Qobuz. Non-Qobuz track/album URLs
are resolved to their Qobuz equivalent via the existing Odesli API
integration. Playlist URLs redirect to the Playlist Importer.

- Add MusicResource/MusicProvider enums and detect_music_resource()
- Add detect_resource() to each provider (spotify, apple, tidal, deezer)
- Add v2_resolve_music_link command with Odesli-based cross-resolution
- Upgrade LinkResolverModal with platform icon detection and playlist redirect
- Update i18n keys in all 4 locales (en, es, de, fr)
2026-02-20 15:27:49 -06:00
vicrodh 04eeaefdce fix(context-nav): add click navigation for DailyQ and WeeklyQ contexts
The context icon showed correct tooltip on hover but clicking did
nothing for daily_q and weekly_q types. Add missing switch cases
to navigate to the respective views.
2026-02-20 10:39:17 -06:00
vicrodh 6849a9b3d6 fix(label): add playlist action buttons, increase section spacing
Wire onPlaylistPlay, onPlaylistPlayNext, onPlaylistPlayLater,
onPlaylistCopyToLibrary, onPlaylistShareQobuz through LabelView Props
to QobuzPlaylistCard. Increase section spacing from 48px to 64px.
2026-02-20 04:13:22 -06:00
vicrodh 4c2a63239e fix(label): rewrite track row, add jump-nav, fix description border
- Replace track row with ArtistDetailView pattern (favorites, TrackMenu, radio)
- Add sticky jump-nav bar with IntersectionObserver for all sections
- Fix description border leak with CSS reset
- Make "More labels" containers round
- Wire onTrackAddFavorite prop in +page.svelte
- Add i18n keys: label.about, label.otherLabels (all 4 locales)
2026-02-20 03:29:13 -06:00
vicrodh 585053bd42 feat(label): redesign label detail view with Android-style sections
Replace the flat album grid LabelView with a rich detail page featuring:
- Header with label image, name, description, and play button
- Popular Tracks section (5/10/all expand, same UX as ArtistDetailView)
- Releases horizontal scroll row with "See all" → LabelReleasesView
- Critics' Picks section from second releases container
- Playlists, Artists, and More Labels sections

Backend: add /label/page and /label/explore API endpoints with V2
commands (v2_get_label_page, v2_get_label_explore). Models use
serde_json::Value for flexible section parsing.

Old LabelView renamed to LabelReleasesView for the "See all" flow.
i18n keys added to all 4 locales (en, es, de, fr).
2026-02-20 02:51:47 -06:00
vicrodh ca3f43614b feat: add back button, info tooltip, duration, fix context for mixes
- Add back navigation button to both DailyQ and WeeklyQ views
- Replace subtitle with home card descriptions
- Remove cache/live source text, add total playback duration
- Remove refresh button from WeeklyQ (regenerates weekly on Fridays)
- Fix weekly cache to use Friday-based key instead of daily
- Add algorithm info icon with tooltip on both views
- Fix playback context: align queue index with blacklist-filtered tracks
- Change header label from "Playlists" to "Your mixes"
- Add algorithmInfo i18n key to all 4 locales
2026-02-20 01:26:21 -06:00
vicrodh 5ef0d56cb4 feat: wire full playback system for DailyQ and WeeklyQ views
Add parent-driven track playback with queue setup, playback context,
context menus, offline cache status, and artist blacklist filtering.
Both views now behave like normal playlist views.
2026-02-20 01:20:47 -06:00
vicrodh fc5da6cfc4 feat(home): add Your Mixes section with DailyQ and WeeklyQ cards
Static section (no API call) with video-background cards that navigate
to DynamicSuggestView and WeeklySuggestView. Positioned after Qobuz
Playlists in default Home order, toggleable via Home Settings.
2026-02-20 00:54:08 -06:00
vicrodh 6f612e699f feat(purchases): add playback support to purchases views
Purchased tracks are streamable via normal Qobuz API. Reuse existing
handleDisplayTrackPlay/playAlbumById infrastructure to enable click-to-play
on track rows and a Play button on album detail header. Active track
highlights with accent color and animated playing bars.
2026-02-19 16:57:16 -06:00
vicrodh 13d9ec3724 refactor(ui): convert queue panel from overlay to inline sidebar
Queue now pushes main content instead of overlaying it, fixing the
search header z-index conflict. Lyrics sidebar height fixed to 100%
to fill parent container correctly. Queue and lyrics are now mutually
exclusive - opening one closes the other.
2026-02-19 08:55:09 -06:00
vicrodh 11b3486c63 fix(v2): close frontend/backend command audit gaps
- add/register missing v2 commands surfaced by audit
- migrate frontend invokes to v2 equivalents
- eliminate legacy invoke callsites in audit report
- harden invoke audit parser for generic/multiline invoke usage

cx
2026-02-18 12:59:28 -06:00
vicrodh d57a27ad45 feat: wire purchases views into navigation, sidebar, and settings
- Add 'purchases' and 'purchase-album' to ViewType
- Add conditional ShoppingBag nav item in Sidebar (between Favorites and Playlists)
- Wire PurchasesView and PurchaseAlbumDetailView in +page.svelte
- Add Show Purchases toggle in Settings > Appearance
- Toggle persisted via purchasesStore, hidden by default
2026-02-17 17:52:05 -06:00
vicrodh 644571f82a perf: add batch offline cache command to replace sequential IPC loops
Add v2_cache_tracks_batch_for_offline command that inserts all tracks
in a single SQLite transaction and spawns download tasks in one IPC
call. Extract spawn_track_cache_download helper shared by both single
and batch commands.

Replace sequential for-of loops with batch calls in PlaylistDetailView
and +page.svelte (downloadAlbumById, handleDownloadAlbum,
handleReDownloadAlbum, reDownloadAlbumById). Single-track handlers
remain unchanged.

Reduces 75 IPC round-trips to 1 for bulk downloads.
2026-02-17 10:59:02 -06:00
vicrodh 107c222c7e feat(ui): add Ctrl+L keybinding for link resolver
New ui.openLink action in keybindingsStore (Ctrl+L default).
Registered in +page.svelte to open the link resolver modal.
2026-02-17 00:29:42 -06:00
vicrodh 55c5ea4013 feat(ui): wire link resolver into main page
Import LinkResolverModal, add handleResolvedLink() that dispatches to
handleAlbumClick/handleArtistClick/selectPlaylist. Listen for
link:resolved event from OS scheme handler. Render modal in template.
2026-02-17 00:29:15 -06:00
vicrodh c3696f02d4 fix(playback): harden auto-advance for long-track edge cases
cx
2026-02-16 20:08:34 -06:00
vicrodh 99877fa740 fix(v2): align immersive track info/radio and i18n history keys
cx
2026-02-16 19:27:47 -06:00
vicrodh 37db48ea3d fix(v2): complete command migration sweep and musician/blacklist flows
- migrate remaining frontend invokes to V2 names
- add missing V2 command registrations and implementations
- enforce commands_v2 backend purity (no legacy delegation)
- restore blacklist/relationships/musician flows in V2
- align playlist/local-library/settings invoke paths with V2

cx
2026-02-16 18:40:07 -06:00
vicrodh 131c6703ab fix(v2): stabilize queue panel sync and shuffle counters
cx
2026-02-16 17:16:41 -06:00
vicrodh 6f7b8e0aff Revert "fix(v2): harden session restore and favorites query params"
This reverts commit c20bb034ae.
2026-02-16 17:16:29 -06:00
vicrodh c20bb034ae fix(v2): harden session restore and favorites query params
cx
2026-02-16 17:15:58 -06:00
vicrodh 8ac5ba92fd refactor(v2): enforce backend purity and stabilize playback runtime
cx
2026-02-16 07:45:43 -06:00
vicrodh d02b8a9628 refactor(v2): eliminate legacy frontend invokes and close remaining v2 command gaps
cx
2026-02-16 03:51:01 -06:00
vicrodh e4fe4598d0 refactor(frontend): migrate playlist and settings commands to V2
Batch migrate frontend invocations to V2:
- Playlist commands (22 commands)
- Settings/preferences commands
- Cache and audio commands
- API commands (radio, genres, tags, etc.)

Progress: reduced legacy commands from ~228 to ~152
2026-02-16 02:40:50 -06:00
vicrodh 8d26f547d1 fix(frontend): resolve all remaining TypeScript errors
- HomeView: fix OfflineCacheStatus type for getTrackOfflineCacheStatus prop
- PlaylistDetailView: fix trackToReplace null access in console.log
- SearchView: add id and isViewMore to Album/Artist interfaces
- Toast: add 'warning' type support
- playbackContextStore: add 'search' to ContextType union
- queueStore: add trackId to QueueTrack interface
- trackActions: add queueDisplayTrackNext/Later and buildQueueTrackFromDisplayTrack
- +page.svelte: fix numerous type issues including:
  - selectedAlbum closure captures for TypeScript narrowing
  - handleDisplayTrackDownload signature for DisplayTrack
  - handleSearchTrackDownload for SearchView's Track type
  - ImportSummary callback signature
  - QobuzTrack hires_streamable property usage
  - album.tracks.items instead of .data

npm run check now passes with 0 errors (138 warnings remain, mostly a11y)
2026-02-15 17:20:05 -06:00
vicrodh deece54bcb fix: eliminate double-brain session lifecycle (legacy vs V2)
Backend:
- v2_auto_login/v2_manual_login now FAIL if activate_session fails
  (was: log and continue with success:true, causing "logged in but not ready")
- Session activation is now REQUIRED, not optional

Frontend:
- Remove duplicate activate_user_session call from handleLoginSuccess
  (V2 login already activates session internally)
- Remove duplicate deactivate_user_session call from handleLogout
  (v2_logout already deactivates session internally)
- LoginView now uses runtime_bootstrap as SINGLE SOURCE OF TRUTH
  (was: v2_init_client + legacy is_logged_in/get_user_info checks)
- PlaylistDetailView uses runtime_get_status for user_id
  (was: legacy get_current_user_id)

This eliminates the "double-brain" where frontend used both legacy
and V2 paths, causing state divergence and intermittent failures.
2026-02-15 14:39:44 -06:00
vicrodh e70c577181 refactor: centralize session lifecycle, make runtime_bootstrap autocontenido
Addresses multiple review findings for V2 architecture:

1. Create session_lifecycle.rs module:
   - activate_session(): Full session activation callable from anywhere
   - deactivate_session(): Full teardown with proper runtime state cleanup
   - activate_offline_session(): Minimal session for offline/local-only use

2. Make runtime_bootstrap autocontenido:
   - Now activates session after successful auth (Step 4)
   - No longer delegates to frontend for session activation

3. Fix v2_login to be canonical:
   - Performs full flow: legacy auth -> corebridge auth -> session activation
   - Updates all runtime state flags

4. Fix v2_logout to be canonical:
   - Calls deactivate_session (teardown stores + clear runtime state)
   - Proper cleanup of legacy and corebridge auth

5. Fix deactivate_session:
   - Now clears session_activated flag (was missing)
   - Now clears corebridge_auth flag (was missing)
   - Emits UserSessionDeactivated event

6. Add v2_set_repeat_mode runtime check:
   - Now requires RequiresUserSession like other queue mutations

7. Fix LoginView early session activation:
   - Removed premature activate_user_session call before auto-login confirmed
   - ToS check uses localStorage fallback if no session

8. Fix offline mode:
   - Add v2_activate_offline_session command
   - Offline mode now activates minimal session so queue commands work
2026-02-15 10:53:49 -06:00
vicrodh cfe931e8ee fix: address critical login state and queue command issues
Issue 1 (HIGH): Fix UI/backend login state divergence
- Move setLoggedIn() AFTER successful activate_user_session
- Prevents UI entering logged-in state when backend fails

Issue 2 (HIGH): Fix userId fallback to 0
- Add validation in LoginView for both auto_login and manual_login
- Reject success responses with invalid user_id (0 or missing)

Issue 3 (HIGH): Add runtime requirement checks to queue commands
- All queue mutation commands now require authenticated user session
- CoreBridge-based commands require RequiresCoreBridgeAuth
- AppState-based commands require RequiresUserSession

Issue 6 (MEDIUM): Remove V1 auth surface
- Remove login, logout, auto_login from invoke_handler
- Frontend must use v2_login, v2_logout, v2_auto_login
2026-02-15 10:30:47 -06:00
vicrodh 87d03d427a refactor(frontend): migrate get_audio_settings to v2_get_audio_settings
Migrate all frontend get_audio_settings invoke calls to use V2:
- +page.svelte (normalization state loading)
- SettingsView.svelte (audio settings page)
- ExpandedPlayer.svelte (DAC passthrough status)
- AudioOutputBadges.svelte (output device status)
2026-02-15 04:12:37 -06:00
vicrodh 8a844612ff feat(v2): migrate audio settings commands to V2
- Add V2 audio settings commands (output device, exclusive mode, DAC
  passthrough, sample rate, backend type, ALSA plugin, gapless,
  normalization, streaming only, quality limiting, etc.)
- Update frontend SettingsView to use V2 audio commands
- Update +page.svelte to use V2 normalization command
2026-02-15 03:52:48 -06:00
vicrodh daf5372c34 feat(v2): migrate logout to v2_logout 2026-02-15 00:46:35 -06:00