Commit Graph
100 Commits
Author SHA1 Message Date
vicrodh cb696aca60 Add detailed logging for CPAL device enumeration
Logs now show:
- Device index
- Device name
- Is default
- Supported configs (channels/sample rates)

This helps identify devices when pretty names aren't clear.
2026-01-17 12:03:13 -06:00
vicrodh 1f13370073 Fix device selection: Use CPAL for enumeration AND playback
PREVIOUS WRONG APPROACH (commit 212aae5):
- Used pactl to enumerate devices (PipeWire sink names)
- Tried to open those sink names with CPAL
- CPAL couldn't find PipeWire sink names → fell back to default
- Attempted workaround: change system default with set_pipewire_default_sink
- UNACCEPTABLE: Changed system-wide default, affecting all apps

ROOT CAUSE (identified by ChatGPT research):
- CPAL can open specific devices by name (research was correct)
- BUT: Name mismatch between pactl sinks and CPAL device names
- pactl returns: "alsa_output.usb-Cambridge_Audio..." (PipeWire sink)
- CPAL sees: "DacMagic Plus Analog Stereo" (user-friendly name)

CORRECT SOLUTION:
- Use CPAL for BOTH enumeration AND opening devices
- CPAL device names are consistent: enumerate → save → find → open
- No need to change system default
- Device selection only affects QBZ

CHANGES:
1. Rewrote get_pipewire_sinks() on Linux to use CPAL instead of pactl
2. Removed all calls to set_pipewire_default_sink()
3. Pass CPAL device names directly to reinit_audio_device()
4. CPAL can now find and open devices because names match

BENEFITS:
- ✅ Device selection only affects QBZ (not system-wide)
- ✅ No regresions
- ✅ No features lost
- ✅ Works exactly like librespot (Spotify client in Rust)
- ✅ Consistent with rodio/CPAL architecture

TESTING REQUIRED:
1. Select Cambridge DAC in QBZ → audio plays through Cambridge
2. Open Firefox/other app → uses its own device (unaffected)
3. Toggle devices in QBZ → changes correctly
4. Restart QBZ → restores saved device
5. DAC passthrough bit-perfect → works
2026-01-17 11:51:25 -06:00
vicrodh 212aae5c9f Fix device selection: CPAL cannot open PipeWire sinks by name
ROOT CAUSE:
CPAL/Rodio (the audio library) cannot open PipeWire sinks by name directly.
CPAL only sees ALSA device names like "default", "hw:0,0", etc., not
PipeWire sink names like "alsa_output.usb-Cambridge_Audio...".

When we tried to pass the PipeWire sink name to reinit_audio_device(), CPAL
couldn't find it and fell back to system default, ignoring user selection.

SOLUTION:
1. When user selects a device, set it as PipeWire default using pactl
2. Pass device: null to reinit_audio_device() (uses PipeWire default)
3. On app startup, restore saved device as PipeWire default

This works because:
- PipeWire's "default" sink can be changed programmatically
- CPAL can successfully open "default" device
- The default sink points to the user's selected device

TRADE-OFFS:
- QBZ changes the system-wide PipeWire default sink
- Other apps will also use this sink (unless they specify their own)
- This is unavoidable with CPAL - it's the only way to select a specific
  PipeWire sink from Rust without using PipeWire/ALSA APIs directly

AFFECTED FUNCTIONS:
- handleOutputDeviceChange() - Sets sink as default when user selects device
- handleExclusiveModeChange() - Restores saved sink as default before reinit
- handleDacPassthroughChange() - Restores saved sink as default before reinit
- handleGaplessPlaybackChange() - Restores saved sink as default before reinit
- handleCrossfadeChange() - Restores saved sink as default before reinit
- loadAudioSettings() - Restores saved sink as default on app startup
2026-01-17 01:29:47 -06:00
vicrodh 586a0de358 Fix device selection changing system default instead of only QBZ
PROBLEM:
When selecting an audio device in QBZ settings, the app was changing
the system-wide PipeWire default sink, affecting all applications.

ROOT CAUSE:
handleOutputDeviceChange() was calling set_pipewire_default_sink(),
which changes the PipeWire default for the entire system.

FIX:
Removed set_pipewire_default_sink() call. The backend reinit_audio_device()
already handles opening a specific device for QBZ without changing the
system default.

Now QBZ uses the selected device independently from the system default.
2026-01-16 22:25:20 -06:00
vicrodh 13e2ea708a Fix critical device selection bug in audio settings
PROBLEM:
When user selected a specific audio device (e.g., Cambridge Audio DAC),
audio would always play through system default device (laptop speakers)
instead of the selected device.

ROOT CAUSE:
All calls to reinit_audio_device() were passing device: null instead of
the actual selected device name. When device: null is passed, the Player
falls back to system default regardless of user selection.

Affected functions:
- handleOutputDeviceChange() - Primary bug, selected device ignored
- handleExclusiveModeChange() - Reset to default when toggling
- handleDacPassthroughChange() - Reset to default when toggling
- handleGaplessPlaybackChange() - Reset to default when auto-disabling DAC
- handleCrossfadeChange() - Reset to default when auto-disabling DAC

FIX:
Created getCurrentDeviceSinkName() helper that:
- Returns the internal sink name for selected device
- Returns null only for "System Default" selection
- Used consistently across all audio setting changes

SECONDARY CHANGES:
Improved DAC Passthrough warning messages in AudioOutputBadges:
- "ERROR: PipeWire is resampling" instead of generic warning
- Clearer tooltip guidance for fixing resampling issues
- Better distinction between active/warning/disabled states

This ensures device selection persists across all audio setting changes
and provides clearer feedback when bit-perfect playback is compromised.
2026-01-16 21:57:41 -06:00
vicrodh 40cd6d7303 fix: improve tooltip UX and enforce mutual exclusion on load
Tooltip improvements:
- Consolidate duplicate tooltips into single unified tooltip
- Show device info + DAC status + sample rate in one place
- Remove native 'title' attributes that were causing conflicts
- Add visual indicators (colored dots) for setting states
- Display resampling warning with actual rates when detected
- Better structured tooltip with sections

Mutual exclusion enforcement:
- Validate settings on load in loadAudioSettings()
- Auto-disable Gapless and Crossfade if DAC Passthrough is enabled
- Prevents invalid state from persisted settings

This fixes the issue where users could have incompatible settings
active simultaneously after app restart.
2026-01-16 21:39:48 -06:00
vicrodh a95575b7df fix: remove invalid currentTrack import from AudioOutputBadges
AudioOutputBadges was importing currentTrack from playerStore, which doesn't
export a reactive store. This caused the app to crash with a 500 error.

Solution: Pass samplingRate as a prop from NowPlayingBar instead of trying
to import track data directly. This matches the existing pattern used by
other components like QualityBadge.
2026-01-16 21:26:16 -06:00
vicrodh c810663c6f feat: implement 3-state DAC badge and hardware sample rate detection
Backend changes:
- Add audio_diagnostics module to read actual hardware sample rate from /proc/asound
- New command get_hardware_audio_status() parses hw_params for real-time monitoring
- Add glob dependency for file pattern matching

Frontend (AudioOutputBadges):
- Implement 3-state DAC badge system:
  - Green: DAC passthrough working correctly (rates match)
  - Yellow: DAC passthrough ON but resampling detected (warning)
  - Gray: DAC passthrough OFF (intentionally disabled)
- Dynamic tooltips showing actual hardware sample rate
- Compare file sample rate vs hardware sample rate
- Increase tooltip z-index to 9999 to prevent occlusion issues
- Add pointer-events: none to tooltip to prevent interaction issues

Frontend (SettingsView):
- Replace hardcoded "192 kHz" with dynamic hardware sample rate
- Load and display actual hardware audio status
- Show format details (e.g., S32_LE) when available
- Display "No active playback" when no audio is playing
- Add muted styling for inactive state

Frontend (QualityBadge):
- Add native tooltip showing tier and format
- Add cursor: help to indicate interactivity

i18n:
- Add "noActivePlayback" translations (EN/ES)

This allows users to verify bit-perfect playback is working and detect
resampling issues that would compromise audio quality.
2026-01-16 21:14:22 -06:00
vicrodh 09881856d0 fix: DAC badge now activates based on setting alone
Remove isExternal requirement for DAC Passthrough badge activation.
The badge now lights up when DAC Passthrough setting is enabled,
regardless of whether the device is detected as external or internal.

This fixes the issue where the badge would remain off even when
DAC passthrough was working (confirmed by 192kHz reaching hardware).
2026-01-16 20:56:02 -06:00
vicrodh 791ff7a73b feat: implement mutual exclusion for incompatible audio settings
Add auto-disable logic to prevent incompatible settings from being enabled simultaneously:

Frontend (SettingsView.svelte):
- DAC Passthrough ON → auto-disables Gapless Playback and Crossfade
- Gapless Playback ON → auto-disables DAC Passthrough
- Crossfade > 0 → auto-disables DAC Passthrough
- Added handleGaplessPlaybackChange() and handleCrossfadeChange() handlers
- Modified handleDacPassthroughChange() to disable incompatible settings

Backend (player/mod.rs):
- Only recreate OutputStream on format change when DAC passthrough is enabled
- When DAC passthrough is OFF: reuse existing stream for gapless transitions
- When DAC passthrough is ON: recreate stream for bit-perfect playback
- Added detailed logging for stream recreation decisions

This fixes the issue where Gapless Playback was enabled but gaps still occurred
due to DAC passthrough forcing stream recreation on sample rate changes.
2026-01-16 20:41:53 -06:00
vicrodh 20fc254769 Merge branch 'bugfix/pretty-device-names' 2026-01-16 19:53:11 -06:00
vicrodh 33c5e00da0 Fix audio device selection to show friendly PipeWire names
The previous implementation tried to map ALSA device names (from cpal)
to PipeWire descriptions, but the naming schemes are completely different:
- cpal returns names like "plughw:1,0"
- pactl returns sink names like "alsa_output.usb-Cambridge_Audio_..."

This fix changes the approach:
1. Use PipeWire sinks directly for the device dropdown (already filtered
   to real outputs and have friendly descriptions like "DacMagic Plus")
2. Store the PipeWire sink name when user selects a device
3. Set the PipeWire default sink using pactl when device is selected
4. Use rodio's default device (which follows PipeWire's default)

This ensures users see 4-5 meaningful devices with friendly names
instead of 30+ raw ALSA device names.

Backend changes:
- Add set_pipewire_default_sink command (pactl set-default-sink)
- Register new command in lib.rs

Frontend changes:
- Use pipewireSinks directly for device dropdown
- Display sink description (friendly name)
- Store sink name (for pactl)
- Call set_pipewire_default_sink when device changes
- Remove unused AudioDevice interface and getDevicePrettyName import
2026-01-16 19:52:51 -06:00
vicrodh 6e36b56486 fix: make offline detection less aggressive
- Increase network check timeout from 5s to 15s
- Add retry (2 attempts with 2s delay) before declaring offline
- Add logging for failed network check attempts

This prevents false offline mode triggers from temporary latency spikes.
2026-01-16 19:24:35 -06:00
vicrodh c5a1d14822 fix: use fast header-only metadata extraction instead of full decode
The play_data function was calling decode_with_symphonia which decoded
the entire audio file (271MB+) just to extract sample_rate and channels.
This caused 30-35 second delays between download complete and playback.

New extract_audio_metadata function:
- For FLAC: uses rodio decoder (reads headers only)
- For isomp4: uses symphonia probe to read codec_params without decoding

This restores the fast playback we had before.
2026-01-16 18:32:16 -06:00
vicrodh eebf440f84 Merge remote-tracking branch 'origin/main' into feature/favorite-playlists 2026-01-16 17:12:34 -06:00
vicrodh 573d818cf5 Merge branch 'research/dac-passthrough' 2026-01-16 17:12:19 -06:00
vicrodh 287ac59e7f feat: register qbz:// URI scheme for OAuth callbacks
Add URI scheme handler registration for OAuth flow implementation:
- Register x-scheme-handler/qbz in .desktop files
- Add %u parameter to Exec for URL handling
- Add OpenURI portal permission in Flatpak manifest

This enables OAuth PKCE flows for Spotify and other providers
to redirect back to the application after browser authentication.

Files modified:
- packaging/arch/qbz.desktop
- packaging/aur/qbz.desktop
- packaging/flatpak/com.blitzkriegfc.qbz.desktop
- packaging/flatpak/com.blitzkriegfc.qbz.yml
2026-01-16 17:10:42 -06:00
vicrodh 8f32eec782 refactor(wayland): harden NVIDIA fix with detection and user overrides
Improvements to the Wayland compatibility fix:

Detection:
- Add NVIDIA GPU detection via /proc and kernel modules
- Apply DMA-BUF workaround only on NVIDIA systems
- Preserve full acceleration on Intel/AMD GPUs

User Overrides:
- QBZ_FORCE_DMABUF=1: Force-enable DMA-BUF (bypass workaround)
- QBZ_DISABLE_DMABUF=1: Force-disable DMA-BUF
- QBZ_FORCE_X11=1: Force X11 backend on Wayland

Diagnostics:
- Clear logging of display server type
- NVIDIA detection status
- Applied workarounds and reasons
- User override notifications

This makes the fix selective and transparent while protecting
NVIDIA + Wayland users from fatal protocol errors.

Related: #6

cc
2026-01-16 14:57:19 -06:00
vicrodh 837fe0bb7a fix(wayland): add environment variables for Wayland and WebKit compatibility
Resolves protocol errors and GBM buffer issues on Wayland by:
- Detecting Wayland display and forcing GDK backend
- Disabling WebKit compositing mode for transparent windows
- Disabling DMA-BUF renderer to fix GPU driver compatibility
- Setting client-side decorations preference

This addresses issue #6 where users on Wayland experienced crashes
with "Error 71 (Protocol error)" and GBM buffer creation failures.

cc
2026-01-16 14:57:14 -06:00
vicrodh 27431d2ea9 Add backend support for playlist favorites
- Add is_favorite column migration to playlist_settings table
- Update PlaylistSettings struct with is_favorite field
- Add set_playlist_favorite() and get_favorite_playlist_ids() methods
- Add playlist_set_favorite and playlist_get_favorites Tauri commands
2026-01-16 14:40:47 -06:00
vicrodh 26116d0670 Wire up onPlaylistSelect prop in FavoritesView 2026-01-16 14:40:07 -06:00
vicrodh e92ca494d4 Add Playlists tab to FavoritesView for favorite playlists 2026-01-16 14:39:41 -06:00
vicrodh 432b4e5f97 Add favorite heart indicator to PlaylistManagerView items 2026-01-16 14:35:26 -06:00
vicrodh 1537b2de7f Add favorite heart button to PlaylistDetailView header 2026-01-16 14:33:25 -06:00
vicrodh 88b1f959ae Implement DAC passthrough and sample rate switching
This commit implements proper sample rate passthrough for high-quality
audio playback, addressing issue #10 where DAC sample rates were locked
at 44.1kHz regardless of file quality.

Core Changes:
- Modified Player to accept and store AudioSettings (exclusive mode, DAC passthrough)
- Updated AudioCommand::Play to include sample_rate and channels metadata
- Created create_output_stream_with_config() to build custom StreamConfig
- Added sample rate tracking to detect changes between tracks
- Modified Play handler to recreate OutputStream when sample rate changes
- Updated play_data() to extract audio metadata before playback
- Modified lib.rs to read AudioSettings on startup and pass to Player

Device Detection Improvements (Issue #4):
- Added display_name and device_type fields to AudioDevice struct
- Implemented get_pipewire_device_descriptions() to extract friendly names
- Updated get_audio_devices() to map technical names to user-friendly names
- Added device type detection (USB, HDMI, PCI, Bluetooth)

Technical Details:
- Audio files are decoded twice: once for metadata, once for playback
- Stream is recreated only when sample rate or channel count changes
- Falls back to default device config if custom config fails
- Supports both PipeWire and PulseAudio device naming via pactl
- Logs sample rate transitions and OutputStream configuration

Files Modified:
- src-tauri/src/player/mod.rs: Core playback engine changes
- src-tauri/src/lib.rs: Initialize Player with AudioSettings
- src-tauri/src/commands/playback.rs: Device enumeration improvements

Tested: Compiles successfully on Linux with Rust 1.92
2026-01-16 14:16:18 -06:00
vicrodh 8565696d41 security: override cookie to 0.7.x
Fixes CVE for out of bounds characters (LOW)
All 7 dependabot alerts now resolved
2026-01-16 13:43:09 -06:00
vicrodh 3025c918f1 security: override esbuild to 0.25.x
Fixes CVE for dev server request vulnerability (MEDIUM)
svelte-i18n requires ^0.19.2, override forces ^0.25.0
2026-01-16 13:09:20 -06:00
vicrodh deeb26dc3f security: update svelte to 5.46.4
Fixes CVE for Cross-site Scripting vulnerability (MEDIUM)
2026-01-16 12:37:33 -06:00
vicrodh c81d03b5b0 security: update @sveltejs/kit to 2.49.5
Fixes:
- CVE for DoS/SSRF in prerendering (HIGH)
- CVE for memory amplification DoS (HIGH)
- Also updates devalue to 5.6.2 (2 HIGH CVEs)
2026-01-16 10:27:01 -06:00
vicrodh a68230fadc Make scrobbling options mutually exclusive in offline settings
Immediate and Accumulated scrobbling cannot be enabled at the same
time, but both can be disabled. When one is turned on, the other
is automatically turned off.
2026-01-16 10:07:05 -06:00
vicrodh 8a5d3e8971 Fix column alignment for unavailable tracks in playlist view
Show favorite and download indicators for unavailable Qobuz tracks
to maintain column alignment. The elements are already non-interactive
due to pointer-events: none on the wrapper.
2026-01-16 10:02:49 -06:00
vicrodh 3984f5b9a0 Fix track row alignment for unavailable tracks in playlist view 2026-01-16 09:56:25 -06:00
vicrodh 9499203c69 Refine offline mode UX for unavailable tracks and playlist filters
- Remove wifi-off icon from unavailable tracks in playlist detail view,
  keeping only the disabled styling for a cleaner look
- Rename "Available Offline" filter to "Fully Available Offline" to
  clarify it shows only playlists where all tracks are available
- Update filter logic to only show all_local playlists in the fully
  available filter, not partially available ones
- Fix visible filter in offline mode to respect showPartialPlaylists
  setting by using isPlaylistAvailableOffline function
2026-01-16 09:35:40 -06:00
vicrodh 93d886e1dd Fix partial playlist detection for offline mode
The hasLocalContent field was never being calculated - it was just
read from settings (always undefined). Now calculate it dynamically
from actual data:

- localTrackCounts.get(playlistId) - number of local tracks
- playlist.tracks_count - number of Qobuz tracks

Status calculation:
- 'no': localCount === 0 (not available offline)
- 'all_local': localCount > 0 && qobuzCount === 0 (fully available)
- 'some_local': localCount > 0 && qobuzCount > 0 (partially available)

This fixes Show partial playlists toggle and Partially available
filter in playlist manager.
2026-01-16 09:13:55 -06:00
vicrodh 73d022ae20 Add two-level audio cache system (L1: memory, L2: disk)
L1 (Memory): 300MB for ~3-4 Hi-Res tracks, instant access
L2 (Disk): 500MB playback cache at ~/.cache/qbz/playback/

Flow:
- When track evicted from memory, saved to disk cache
- When loading: check memory → disk → download cache → network
- Tracks promoted back to memory when accessed from disk

This reduces re-downloads when navigating back to recently played
tracks in mixed playlists.
2026-01-16 08:49:56 -06:00
vicrodh 2bdde3d592 Improve prefetch for mixed playlists
- Look ahead 15 tracks instead of 3 to find Qobuz tracks past local ones
- Prefetch up to 3 Qobuz tracks regardless of local track positions
- Count cached/fetching tracks toward limit to avoid over-prefetching

Example: [Local, Local, Qobuz, Qobuz, Local x4, Qobuz]
Before: Only prefetched tracks 3,4 (next 3 total)
After:  Prefetches tracks 3,4,9 (next 3 Qobuz)
2026-01-16 08:42:17 -06:00
vicrodh 94d7d78a22 Fix buffering UX when transitioning from local to Qobuz tracks
- Stop playback immediately when starting a Qobuz track to prevent
  previous track from continuing during download
- Show buffering toast while downloading Qobuz audio
- Skip buffering UI for local tracks since they load instantly
- Add is_local field to QueueTrack for prefetch optimization
- Update prefetch to skip local tracks (no network needed)
- Update all queue track builders to include is_local flag
2026-01-16 07:58:13 -06:00
vicrodh 3e3f89b6a8 Fix effect_update_depth_exceeded infinite loop in playlist loading
Remove reactive effect that was causing infinite re-renders due to
inline callback function recreation. Replace with imperative calls
to notifyParentOfCounts() after data loading completes.

The effect was reading onPlaylistCountUpdate which got recreated
on every parent re-render, triggering the effect again in a loop.
2026-01-16 07:48:34 -06:00
vicrodh aeb13b9ffc Connect playlist count callback for single source of truth
Wire onPlaylistCountUpdate from PlaylistDetailView to Sidebar's
updatePlaylistCounts method in +page.svelte. This ensures the
sidebar displays accurate track counts from the database instead
of calculated values that could drift out of sync.
2026-01-16 07:19:34 -06:00
vicrodh 7292635210 Fix displayTracks to handle local track positions beyond simple sum
Calculate totalCount as max of (qobuz+local count) or (highest local
position + 1) to ensure all local tracks are included regardless of
their position value
2026-01-16 07:13:09 -06:00
vicrodh 16486e4591 Fix playlist track ordering to respect insertion order
- Add PlaylistLocalTrack struct with playlist_position field
- Add playlist_get_local_tracks_with_position command
- Update PlaylistDetailView to merge tracks by position instead of
  appending local tracks at the end
- Update PlaylistModal to calculate correct position when adding local
  tracks (total count = qobuz + existing local)
- Local tracks now appear in the order they were added, interleaved
  with Qobuz tracks
2026-01-16 07:04:21 -06:00
vicrodh 24c9df3bce Fix TrackMenu z-index and edge clipping issues
- Use portal pattern to render menu in body (escapes stacking context)
- Increase z-index to 99999/100000 for menu/submenu
- Update click outside handler to work with portal
- Menu now properly appears above all track rows
2026-01-16 06:56:36 -06:00
vicrodh 9366388041 Fix local tracks not being added to queue from playlists
- Update handlePlayAll to include both Qobuz and local tracks
- Update handlePlayAllNext and handlePlayAllLater similarly
- Add onSetLocalQueue prop to mark local tracks in queue store
- Connect prop to handleSetLocalQueue in +page.svelte
2026-01-16 06:51:59 -06:00
vicrodh 825534621a Add login timeout mechanism and fix premature API calls
- Add 60-second timeout to login initialization in LoginView
- Show retry/offline options when login times out
- Move loadFavorites() to handleLoginSuccess to prevent API calls
  before authentication is complete
- Prevents errors when auto-login is slow or stuck
2026-01-16 06:49:03 -06:00
vicrodh 688d798b9d Fix local track quality badge showing Hz instead of kHz
Convert sample_rate to kHz in localTrackToDisplay function so local
tracks display correctly as 16bit/44.1kHz instead of 16bit/44100kHz
2026-01-16 06:40:23 -06:00
vicrodh 3297257a24 Fix tooltip updates and change Song to Track terminology
- Update onPlaylistUpdated callback to also refresh local track counts
- Change all Song/Songs references to Track/Tracks in Sidebar tooltips
- Ensure tooltip cache is properly invalidated when tracks are modified
2026-01-16 06:39:08 -06:00
vicrodh 5f4cfa5888 feat(playlists): include local tracks in counts everywhere
- Add playlist_get_all_local_track_counts command to get local track
  counts for all playlists efficiently
- PlaylistDetailView: show combined track count and duration in header,
  style local count with muted color, remove redundant count below
- Sidebar: load and display local track counts in tooltips
- PlaylistModal: show combined counts when selecting playlist to add to
- PlaylistManagerView: show combined counts in both grid and list views
- TrackRow: move local indicator to download column position, add
  placeholder for favorite column to maintain alignment, update tooltip
- Remove local tracks notice banner (info now in tooltip)

cc
2026-01-16 06:32:13 -06:00
vicrodh d731805eca refactor(playlists): unify track row appearance and add remove option
- Move local track indicator from quality column to favorite button position
  for consistent row alignment with Qobuz tracks
- Remove explicit delete button from playlist track rows (was easy to
  accidentally click)
- Add "Remove from playlist" option to TrackMenu for all tracks (local and
  Qobuz)
- Qobuz track removal uses playlist_track_id from API response
- Clean up unused CSS and imports from PlaylistDetailView

cc
2026-01-16 06:18:32 -06:00
vicrodh 3915abd3bb fix(playlists): add local tracks to playlists correctly
- PlaylistModal now uses playlist_add_local_track command for local tracks
  instead of the Qobuz-only add_tracks_to_playlist command
- Added isLocalTracks prop to PlaylistModal and wired it through uiStore
- Updated LocalLibraryView to pass isLocal=true when adding tracks to playlists
- Added HardDrive icon indicator next to quality badge for local tracks in TrackRow

cc
2026-01-16 06:03:09 -06:00
vicrodh 81d2bdcf33 CRITICAL: Fix library clear to preserve Qobuz downloads
- clear_all_tracks now only deletes local library tracks
- Qobuz downloads (source = 'qobuz_download') are preserved
- Local library management is now completely separate from Qobuz downloads
2026-01-16 05:15:18 -06:00
vicrodh cd1319cea9 Fix critical bug in Clear Library Database function
- Prevent double execution with clearingLibrary flag
- Stop event propagation to prevent multiple triggers
- Convert to non-async function with explicit promise chain
- Disable button during operation
- Show "Clearing..." state while in progress
2026-01-16 05:11:16 -06:00
vicrodh 6b224ce0da Polish folder settings modal
- Increase width to 720px
- Reduce folder name font size to 13px
- Fix button labels (use actions.cancel/save instead of common)
- Add 'saving' i18n key (en/es)
- Wrap long hint texts in <small> tags
2026-01-16 05:09:18 -06:00
vicrodh ae7b32d70a Increase folder settings modal width to 660px 2026-01-16 05:05:22 -06:00
vicrodh 10cd38effb Improve folder settings modal UX
- Make modal larger (560px width, more padding)
- Add specific warnings when user override differs from detection:
  - Warning when marked as network but not detected
  - Danger when marked as local but detected as network
- Detect network status when modal opens for comparison
- Add i18n strings for override warnings (en/es)
2026-01-16 05:03:45 -06:00
vicrodh 6cabded79a Add network folder detection backfill and folder path editing
- Fix offline settings database migrations to run individually
- Add network detection refresh when loading folder list
- Add network detection during folder scan
- Show folder alias with path tooltip in folder list
- Add folder path change capability in FolderSettingsModal
- Add network content visibility toggle in offline settings
- Add i18n strings for new features (en/es)
2026-01-16 05:00:24 -06:00
vicrodh c0ea039476 Add network folder detection and folder settings
- Add network folder detection module using /proc/self/mountinfo
  - Detect CIFS/SMB, NFS, SSHFS, rclone, WebDAV, GlusterFS, CephFS
  - Classify mount types (local, network, virtual, FUSE unknown)
  - Check mount accessibility

- Add library folder metadata
  - Alias for friendly naming (e.g., "NAS Music", "External Drive")
  - Network folder flag with auto-detection
  - User override for manual network folder marking
  - Network filesystem type (detected or user-defined)
  - Enabled toggle to disable folders without removing

- Add FolderSettingsModal component
  - Edit folder alias, enabled state, network settings
  - Show accessibility status for network folders
  - Scan single folder button

- Update LocalLibraryView folder list
  - Show network icon with connected/disconnected states
  - Display alias with path below if set
  - Edit button (enabled for single selection)
  - Visual badges for disabled/unavailable folders

- Add Tauri commands
  - library_get_folders_with_metadata
  - library_update_folder_settings
  - library_scan_folder (scan single folder)
  - check_network_path, check_mount_accessible
2026-01-16 04:40:06 -06:00
vicrodh f9ca1bd25e Add manual offline mode settings and disable import in offline mode
- Disable import playlists button when offline (shows disabled state)
- Add Cast, immediate scrobbling, and accumulated scrobbling toggles
- These settings only appear when manual offline mode is enabled
- Add time limit note for accumulated scrobbling (Last.fm 2 week limit)
- Persist new settings in SQLite with proper migrations
- Add i18n strings for all new settings (en/es)
2026-01-16 03:15:02 -06:00
vicrodh 6f3bcfe1cb Add offline mode track handling for playlists and queue
- Add batch check command for track local status in Rust
- Show unavailable tracks with grayed-out visual state in PlaylistDetailView
- Disable interactions for unavailable tracks (click, menu, play)
- Add WifiOff indicator for unavailable tracks
- Update QueuePanel to show unavailable track styling
- Implement auto-skip for unavailable tracks during playback
- Add offline mode sync to queue store
- Add offline-specific filter states to PlaylistManager:
  - Available Offline
  - Partially Available
  - Not Available Offline (view-only)
- Disable edit/drag for unavailable playlists in PlaylistManager
- Add i18n strings for offline states (en/es)
2026-01-16 03:01:15 -06:00
vicrodh 6180fea08e Filter sidebar playlists in offline mode
Add offline mode filtering to sidebar playlist list to match behavior
in PlaylistManagerView. Playlists without local content are hidden
when in offline mode, respecting the showPartialPlaylists setting.
2026-01-16 02:47:05 -06:00
vicrodh ff0440f787 Fix settings navigation click and scroll tracking
The section refs were not reactive, so the derived array captured undefined
values at definition time. Changed to resolve refs at call time using a
getSectionEl() function instead of capturing them in a derived array.
2026-01-16 02:42:43 -06:00
vicrodh 3d1af852a9 Fix settings nav sticky position gap
Remove top padding from settings-view and add it to header instead,
so the sticky nav is flush with the top when scrolling.
2026-01-16 00:32:50 -06:00
vicrodh d5f91db751 Remove NotLoggedIn check from offline detection
The login state check was causing race conditions on app startup because
offline status was being checked before auto_login completed. Since the
frontend already handles showing LoginView when not logged in, the
NotLoggedIn check in offline detection was redundant and problematic.

Now offline detection only checks:
1. Manual offline mode (from settings)
2. Network connectivity (via HTTP HEAD to qobuz.com)
2026-01-16 00:12:32 -06:00
vicrodh 51ca294d8e Fix offline detection on app startup
Refresh offline status after successful login to prevent false offline
detection. Previously, the offline status was checked during bootstrap
before auto_login completed, causing 'NotLoggedIn' reason even though
the user would be logged in moments later.
2026-01-16 00:11:15 -06:00
vicrodh 36067d96d5 Fix missing closing bracket in Audio section tag 2026-01-16 00:08:27 -06:00
vicrodh 779e0ff7f3 Add sticky navigation bar to Settings page
- Add navigation bar below Account section with links to all sections
- Navigation becomes fixed at top when scrolling (sticky position)
- Active section highlighted with accent underline
- Hover state shows lighter underline for contrast
- Scroll tracking updates active section automatically
- Small text labels to fit all sections horizontally
2026-01-15 23:59:21 -06:00
vicrodh 373e61f0bd Fix offline mode toggle and add network verification
- Change OfflinePlaceholder icon to use offline.svg instead of Power icon
- Add flex-shrink protection to Toggle component to prevent collapsing
- Add network verification when disabling offline mode:
  - Check network connectivity before switching to online
  - Show semi-transparent overlay during check
  - Revert to offline and show toast if no internet available
- Add check_network Tauri command to verify connectivity
- Add i18n strings for noNetworkToast and checkingNetwork (en/es)
2026-01-15 23:55:45 -06:00
vicrodh 5c1fb23899 feat(offline): UI/UX polish and accessibility improvements
Toast notifications:
- "Offline mode activated" when going offline
- "Back online" when connectivity restored

Accessibility (ARIA):
- role="status" and aria-label on offline indicator in NowPlayingBar
- role="alert" and aria-live="polite" on OfflinePlaceholder
- role="alert" on PlaylistImportModal offline warning
- aria-label on DownloadButton
- aria-hidden="true" on decorative icons
2026-01-15 23:38:20 -06:00
vicrodh a219a1dcb6 fix(offline): edge cases and code cleanup
- Fix online transition callback not triggering on manual mode disable
- Fix $derived pattern in DownloadButton (use $derived.by)
- Remove unused OptionalExtension import in offline/mod.rs
2026-01-15 23:33:24 -06:00
vicrodh e7f06fcd2f feat(offline): implement Last.fm scrobble queue for offline mode
Research findings:
- Last.fm API supports batch scrobbling (up to 50 tracks)
- Timestamps can be backdated up to 14 days

Implementation:
- Add scrobble_queue table to offline database
- Add queue_scrobble, get_queued_scrobbles, mark_scrobbles_sent commands
- Queue scrobbles when offline instead of skipping
- Flush queue automatically when transitioning to online
- Skip scrobbles older than 14 days (Last.fm limit)
- Cleanup sent scrobbles after 7 days
2026-01-15 23:24:24 -06:00
vicrodh b4af6f6e9f feat(offline): add NowPlayingBar offline indicators
- Add offline indicator icon in right section when offline
- Disable lyrics button with tooltip when offline
- Skip Last.fm scrobbling when in offline mode
- Use offline-small.svg for compact indicator
2026-01-15 23:11:33 -06:00
vicrodh 4891b9bcbc feat(offline): disable external services when offline
- DownloadButton: show CloudOff icon and disable when offline
- LyricsStore: skip fetching and show "unavailable offline" message
- LocalLibraryView: skip artist image fetching from Qobuz/Discogs
- PlaylistImportModal: disable import with warning when offline
2026-01-15 23:07:16 -06:00
vicrodh 6e0d7486b0 feat(offline): add offline mode link to login screen
- Add "Start in offline mode" link below login form
- Enable offline mode without authentication
- Navigate directly to local library when starting offline
- Add i18n strings for offline start link (en/es)
2026-01-15 22:59:30 -06:00
vicrodh 6bcb1fc7a6 feat(offline): add playlist filtering and local content badges
Frontend:
- Filter playlists by local content when offline
- Respect showPartialPlaylists setting for filtering
- Add local content badges (green=all, yellow=partial) in grid/list views
- Subscribe to offline state in PlaylistManagerView
- Add pending playlist functions to offlineStore

Assets:
- Add offline-small.svg icon for compact indicators

cc
2026-01-15 22:56:32 -06:00
vicrodh dd5641e36b feat(offline): add pending playlist sync queue
Backend:
- Add PendingPlaylist struct for offline-created playlists
- Create pending_playlist_sync table in SQLite
- Add methods: create_pending_playlist, get_pending_playlists,
  mark_playlist_synced, delete_pending_playlist, get_pending_playlist_count
- Register Tauri commands for pending playlist management

Assets:
- Add offline.svg icon for offline mode indicator

cc
2026-01-15 22:52:02 -06:00
vicrodh 78d35785ed feat(offline): add offline mode settings section
- Add Offline Mode section to SettingsView
- Display current offline status with reason
- Toggle for manual offline mode (Enable Offline Mode)
- Toggle for showing partial playlists in offline mode
- Subscribe to offlineStore for real-time status updates
- Add status indicator styling (green=online, yellow=offline)

cc
2026-01-15 22:43:18 -06:00
vicrodh b7c1af6123 feat(offline): add view access restrictions for offline mode
- Create OfflinePlaceholder component with reason-specific messaging
- Add i18n strings for offline mode (en/es)
- Subscribe to offlineStore in +page.svelte
- Show OfflinePlaceholder for home, search, favorites views when offline
- Provide quick navigation to local library from placeholder

cc
2026-01-15 22:19:17 -06:00
vicrodh 1b9fff3746 feat(offline): add frontend offline state store
- Create offlineStore.ts with status and settings management
- Add 30-second polling for offline status checks
- Listen for backend offline-status-changed events
- Integrate with app bootstrap for initialization and cleanup
- Export getters: isOffline, getOfflineReason, getStatus, getSettings
- Export actions: setManualOffline, setShowPartialPlaylists, refreshStatus

cc
2026-01-15 22:12:59 -06:00
vicrodh 02240f41ac feat(offline): add playlist local content detection
- Add LocalContentStatus enum (unknown, no, some_local, all_local)
- Add has_local_content column to playlist_settings with migration
- Implement local track matching by Qobuz ID and by metadata (title+artist+album)
- Add commands: playlist_analyze_local_content, playlist_get_local_content_status,
  playlist_track_is_local, playlist_get_local_track_id, playlist_get_offline_available
- Add database functions for local content filtering and status updates

cc
2026-01-15 22:11:08 -06:00
vicrodh 21354f9b64 feat(offline): add offline mode detection backend
- Create offline module with OfflineReason enum and OfflineStatus struct
- Add OfflineSettings for manual mode and partial playlist preferences
- Implement network connectivity check via HEAD request to qobuz.com
- Add SQLite persistence for offline settings
- Register Tauri commands: get_offline_status, get_offline_settings,
  set_manual_offline, set_show_partial_playlists
- Add event emission for offline status changes

cc
2026-01-15 22:06:41 -06:00
vicrodh 99aba9a76a feat(artist): add search navigation with prev/next buttons
- Add navigation to search results with smooth scrolling
- Show result counter (X/Y) with prev/next chevron buttons
- Support keyboard navigation (Enter, Shift+Enter, Escape)
- Add searchId prop to AlbumCard for DOM targeting
- Style search toggle button without background
- Remove focus outline from search input
2026-01-15 18:20:32 -06:00
vicrodh 98f1209e37 feat(artist): add page search and improve bio truncation
Page search:
- Add search button in sticky jump-nav bar
- Slide-in animation from right when opened
- Filter albums, EPs, live, compilations, tributes, others, playlists
- Show result count or "No results" message
- Press Escape to close

Bio improvements:
- Reduce truncation to 530 chars (was 800, now 2/3)
- Only show "Read more" if text actually needs truncation

Live detection - additional languages:
- German: Konzert, liveopname
- Japanese: ライブ (raibu)
- Korean: 라이브 (laibeu), 콘서트 (konseuteu)
- Dutch: liveopname
2026-01-15 18:06:01 -06:00
vicrodh 80579e29fa fix(artist): improve live and interview detection patterns
Live albums:
- Add "On Stage" pattern (Market Square Heroes On Stage Vol.1/2)
- Add multilingual support: en vivo, en directo (ES), ao vivo (PT),
  dal vivo (IT), en direct (FR)

Unofficial releases:
- Fix interview detection to include plural "interviews"
- Add "Remaining Memories: The Interviews" pattern
2026-01-15 17:54:58 -06:00
vicrodh 74483f2b10 feat(artist): add Tributes section and improve album categorization
Major improvements to album categorization logic:

Detection improvements:
- Broadcasts: detect plural forms, "Radio Broadcasts", "The Beast Radio"
- Live albums: detect "Alive", city+year patterns (Seattle 1989, Tokyo 1986)
- Podcasts: detect "Report Episode X", single-track 20+ min releases
- Singles: 1-4 tracks (classic 45rpm), explicit markers in title

New Tributes section:
- Albums by different artists now go to "Tributes & Covers"
- Separates tribute/cover albums from legitimate artist content
- Keeps Others clean for compilations, B-sides, unofficial releases

Categorization priority:
1. Different artist -> Tributes
2. Broadcasts/bootlegs/podcasts -> Others
3. Compilations (greatest hits, B-sides) -> Others
4. Live albums -> Live
5. Studio albums (7+ tracks, 25+ min, deluxe) -> Discography
6. EPs/Singles (1-4 tracks, <15 min) -> EPs & Singles
2026-01-15 17:25:16 -06:00
vicrodh ecf85bbd0b fix(artist): rewrite album categorization logic for accuracy
- Add artist ID comparison to filter albums from different artists
- Create separate detection for unofficial releases (broadcasts, bootlegs)
- Create separate detection for compilations (greatest hits, tributes)
- Make EP/Single detection more conservative (1-3 tracks or <15min)
- Add studio album detection to keep deluxe/remaster editions in Discography
- Prioritize categorization: different artist > unofficial > compilation > live > studio > EP
- Fix broadcasts incorrectly going to Live Albums (now go to Others)
- Fix deluxe box sets incorrectly going to Others
- Fix full-length albums with 8 tracks being classified as EPs
2026-01-15 16:59:17 -06:00
vicrodh f2c236b861 fix(artist): improve album categorization logic
- Live albums: detect broadcasts, tour dates, concert recordings
- Others: include FM broadcasts, bootlegs, compilations, tributes
- Others: detect soundtracks, various artists releases
- Filters: cover albums, demos, rehearsals, radio sessions
- Pattern matching: more comprehensive regex for edge cases

Fixes issue with Metallica FM Broadcasts and live albums not
being properly categorized.

cp
2026-01-15 16:45:51 -06:00
vicrodh 8a010800dc Merge feature/search-enhancement into main
Enhanced search view with unified results display, intelligent carousels,
and improved navigation. See branch commits for full details.

cp
2026-01-15 16:38:59 -06:00
vicrodh 0343ca2b1e fix(search): refine layout and tab navigation styling
- Most Popular: reduced to 176px width (4px less)
- Artists section: receives extra space
- Carousel buttons: cursor default when disabled (no not-allowed)
- Tab navigation: bottom border indicator (like artist view)
- Tab active state: accent color border, no background change
- Tab count badges: bg-tertiary background

cp
2026-01-15 15:54:49 -06:00
vicrodh b9310d8994 fix(search): fine-tune spacing in top section
- Reduced gap between Most Popular and Artists (18px, was 24px)
- Reduced gap between artist cards (15px, was 16px)

cp
2026-01-15 15:50:58 -06:00
vicrodh 3c44ecf742 fix(search): align most popular card to left
- Most popular wrapper: justify-content flex-start (was center)
- Card now aligns with artists carousel cards

cp
2026-01-15 15:33:58 -06:00
vicrodh 6a00cbea87 fix(search): adjust most popular container width
- Most Popular: fixed width 180px (was minmax 90px, 1fr)
- Artists: takes remaining space with 1fr
- Improves visual alignment between sections

cp
2026-01-15 15:27:28 -06:00
vicrodh f642f0532a fix(search): most popular section header alignment
- Most popular section-header: explicit flex properties
- Most popular h3: margin 0 instead of margin-bottom 0
- Ensures vertical alignment matches artists section

cp
2026-01-15 15:23:57 -06:00
vicrodh 83a55df7ef fix(search): align most popular header and improve view more styling
- Reduced most popular container width (90px min, was 140px)
- Artists section gets more space (4fr vs 3fr)
- Most popular h3: margin-bottom 0, section-header has 16px
- View more border: solid instead of dashed
- View more text: centered, bold, 14px (matches album title size)

cp
2026-01-15 15:22:21 -06:00
vicrodh 03d330e1d0 fix(search): align headers and redesign view more cards
- Most Popular: added section-header wrapper for alignment
- Most Popular card: centered with wrapper div
- View more cards: redesigned as cover art (160x160) with description
- View more text: shows remaining count (e.g. '20 more albums to discover')
- Removed background/border from card container, moved to cover button

cp
2026-01-15 15:16:24 -06:00
vicrodh 41939e295d fix(search): carousel buttons, alignment and view more injection
- Carousel buttons: transparent background, only hover has bg
- Most Popular card: centered in container
- View more cards: injected into carousel as items (not appended)
- Albums/Artists with view more merged into carousel data
- Pagination includes view more card in calculations

cp
2026-01-15 15:08:48 -06:00
vicrodh db49168623 feat(search): add carousel for artists and view more cards
- Albums: 30 results with view more card if total > 30
- Artists: 12 results with carousel navigation
- Artists carousel: same pagination logic as albums
- View more cards: 160x220px dashed border, navigate to tab
- Artists gap: reduced to 16px (same as albums)
- Separate page tracking for albums and artists

cp
2026-01-15 15:04:15 -06:00
vicrodh c466a0817c fix(search): carousel pagination and artist card layout
- Carousel: bind container, use visibleAlbums slice for pagination
- Artist cards: fixed 160x220px with circular 120x120 images
- Artist names: 2-line clamp with ellipsis for long names
- Grid spacing: 24px gap between artist cards
- Prevent image deformation with min-height and flex-shrink

cp
2026-01-15 14:57:01 -06:00
vicrodh 8a3e8546bd fix(search): single row carousel and homogenize artist cards
- Albums carousel: display flex (one row only)
- Backend: 20 albums (was 16)
- Artist cards: all 160x220px (most popular and grid)
- Carousel buttons work with multiple pages

cp
2026-01-15 14:51:44 -06:00
vicrodh b04cc8fb16 fix(search): improve carousel pagination and crown styling
- Crown: simple gold color (no complex animation)
- Albums carousel: dynamic page-based navigation
- Calculate albums per page based on container width
- Navigation buttons now paginate instead of scroll
- Reset to page 0 on new search results
- Remove carousel overflow/scrollbar

cp
2026-01-15 14:46:43 -06:00
vicrodh 919e72c0d2 fix(search): final adjustments for unified search view
- Artist cards: fixed spacing with 16px gap, 120x120 circular images
- Layout: Albums and Tracks now in separate full-width rows
- Carousel: Changed to single row (was 2 rows)
- Crown icon: Shimmer gradient effect (no glow/drop-shadow)
- Backend already at 16 albums

cp
2026-01-15 14:27:01 -06:00
vicrodh 922be5f2b5 fix(search): implement dynamic carousel with proper layout
- Add dynamic carousel column calculation based on container width
- Carousel calculates visible columns on mount and resize
- Scroll amount adjusts to show full pages (no partial cards)
- Fix padding-right to restore margin from sidebar (24px)
- Remove glow from Most Popular card
- Add shimmering animation to Crown icon (gold drop-shadow)
- Homologate all artist cards to same size (160x220px)
- Add play button overlay on track artwork (hover)
- Reduce album gap from 20px to 16px
- Fix overflow-x only on carousel wrapper (not entire page)
- Maintain 50/50 layout for albums/tracks sections

cp
2026-01-15 13:21:45 -06:00