Commit Graph
5150 Commits
Author SHA1 Message Date
vicrodh f4122625fa fix(sidebar): keep playlists visible in offline mode
Two bugs were making the playlists section disappear when the user was
offline, even though the SWR cache already had every regular playlist
from the previous online session:

  1. The whole section was wrapped in {#if !isOffline} — an all-or-
     nothing kill switch that ignored the fact that individual
     features (create, import, drag) already had their own per-
     control isOffline gates inside.
  2. loadUserPlaylists in offline mode overwrote userPlaylists with
     only the pending-playlists list, wiping whatever the SWR cache
     restored on mount. So even if the gate were lifted, the list
     would be empty the moment the offline effect fired.

Changes:
  * Render the playlists section unconditionally. Per-control
    network-gated behavior (import button, drag-to-reorder, folder
    creation) still honors isOffline individually.
  * Offline loadUserPlaylists now keeps the cached regular playlists
    (id >= 0) in place and layers pending playlists on top, merging
    their local-track counts into the existing map instead of
    replacing it.

Opening a cached playlist in offline mode surfaces the tracks the
user had; playback falls back per track to offline cache / local
library / Plex exactly as it already does when partial content is
unavailable.

cc
2026-04-21 12:46:51 -06:00
vicrodh 27712ddaf7 fix(playlist-detail): render Plex artwork via Plex base URL + token
Plex track artwork in plex_cache_tracks.artwork_path is stored as a
library-relative URI (e.g. /library/metadata/123/thumb/…) which the
Plex server resolves when combined with the configured base URL and
an X-Plex-Token query param. The previous commit was treating it like
a local file path and wrapping it in asset://localhost/, so browsers
couldn't fetch it and the cover rendered broken.

Adds a buildPlexArtworkUrl helper mirroring LocalLibraryView's
implementation — reads qbz-plex-poc-base-url / qbz-plex-poc-token from
userStorage, appends X-Plex-Token, leaves already-absolute URLs
untouched. Used by plexTrackToDisplay when populating albumArt.

cc
2026-04-21 12:28:34 -06:00
vicrodh 5d2e6c2e23 feat(playlist-detail): render Plex tracks added to a Qobuz playlist
Final piece of the Plex-in-playlist plumbing. PlaylistDetailView now
loads the (ratingKey, position) pairs from playlist_plex_tracks and
hydrates metadata from plex_cache_tracks, then interleaves the results
with Qobuz and local tracks by playlist_position so the ordering the
user sees matches what got stored when they added each track.

Backend:
  * plex_cache_get_tracks_by_keys(rating_keys) in plex/mod.rs returns
    PlexTrack metadata for a set of ratingKey strings, skipping keys
    the cache doesn't know about.
  * v2_plex_cache_get_tracks_by_keys Tauri command exposing it,
    registered in lib.rs.

Frontend:
  * New PlaylistPlexTrack interface + plexTracks state alongside the
    existing localTracks pipeline.
  * loadPlexTracks() does the two-step hydrate (positions, then meta).
    Called in parallel with loadLocalTracks and loadPlaylist.
  * plexTrackToDisplay() converts to DisplayTrack. The frontend id is
    derived from the ratingKey via a djb2 hash offset into a
    PLEX_DISPLAY_ID_OFFSET-anchored negative range — stable and never
    collides with local (small negative) or Qobuz (positive) ids.
  * displayTracks interleaves local + plex + Qobuz tracks by position.
    Fast path unchanged when neither source has content.
  * hasLocalTracks, totalTrackCount, totalDuration, and the sidebar's
    hasLocalContent indicator all pick up Plex rows automatically
    because the backend's get_all_playlist_local_track_counts already
    merged the plex count in an earlier commit.

Missing plex cache entries (purged, never hydrated) are silently
dropped instead of rendering placeholder rows — the playlist just
shows fewer Plex tracks until the next Plex cache refresh.

Fixes the bug: Plex tracks can now be added from LocalLibrary and
they show up in the playlist detail view, completely decoupled from
the Qobuz playlist API.

cc
2026-04-21 12:06:48 -06:00
vicrodh d5ff51aba0 feat(playlist-modal): route Plex tracks through the dedicated add path
Frontend half of the fix. LocalLibraryView no longer gates Plex
tracks out of "Add to playlist" — the whole add pipeline now routes
by source:

  * source === 'plex' → v2_playlist_add_plex_track(playlistId,
    ratingKey, position). ratingKey comes from track.file_path, which
    is where mapPlexTrack stashes it at load time.
  * source in {user, qobuz_purchase, qobuz_download} →
    v2_playlist_add_local_track(playlistId, localTrackId, position)
    (unchanged).
  * source === qobuz (Qobuz catalog track) →
    v2_add_tracks_to_playlist (unchanged).

Changes:
  * uiStore: new playlistModalPlexRatingKeys slot + getter + passed
    through openPlaylistModal (4th arg) and closePlaylistModal.
  * PlaylistModal: new plexRatingKeys prop, isPlexTracks derived flag,
    and branches in handleAddToPlaylist / handleDirectAddToPlaylist /
    handleCreateAndAdd that emit v2_playlist_add_plex_track. Duplicate
    detection (which only covers Qobuz) is skipped for Plex adds.
    tracks_count update for newly-created playlists now treats Plex
    like local — 0, since the Qobuz side doesn't own those tracks.
  * LocalLibraryView: adds onTrackAddPlexToPlaylist /
    onBulkAddPlexToPlaylist callbacks. handleBulkAddToPlaylist and
    handleAlbumBulkAddToPlaylist split the selection by source and
    emit the right callback per subset. The per-row plex gate at
    line 3509 is replaced with source-aware routing.
  * +page.svelte: new openAddPlexToPlaylist helper + wired the two
    new callbacks into the LocalLibraryView render.

No confusion with Qobuz tracks: Plex rating keys never touch the
Qobuz playlist API, and local-track ids never reach the Plex
command. The two namespaces stay physically separate at every layer.

cc
2026-04-21 11:38:25 -06:00
vicrodh 753487582a feat(commands): expose Plex-in-playlist Tauri commands
Wires the qbz-library methods added in the previous commit to Tauri
invoke handlers:

  * v2_playlist_add_plex_track(playlistId, ratingKey, position)
  * v2_playlist_remove_plex_track(playlistId, ratingKey)
  * v2_playlist_get_plex_tracks_with_position(playlistId)

All three lock LibraryState::db, mirror the existing local-track
commands, and go nowhere near the Qobuz API surface — no chance of a
Plex ratingKey being forwarded to /playlist/addTracks by mistake.

Registered in lib.rs invoke_handler next to v2_playlist_add_local_track.

cc
2026-04-21 11:32:22 -06:00
vicrodh 13ecec3b17 feat(library): add playlist_plex_tracks table and CRUD for Plex-in-playlist
First half of the Plex-tracks-in-playlists fix. Adds a dedicated
playlist_plex_tracks table alongside the existing playlist_local_tracks
so Plex content (TEXT rating key, owned by a remote server) doesn't
collide with the i64 filesystem id used by local_tracks. No foreign
key to plex_cache_tracks — the cache can be purged independently and
the user's intent should survive.

Database methods added:
  * add_plex_track_to_playlist(playlist_id, rating_key, position)
  * remove_plex_track_from_playlist(playlist_id, rating_key)
  * get_playlist_plex_tracks_with_position(playlist_id) ->
    Vec<(rating_key, position)>
  * get_playlist_plex_track_count(playlist_id) -> u32

get_all_playlist_local_track_counts now merges plex counts into the
same HashMap so the sidebar's hasLocalContent signal stays a single
number and covers Plex-populated playlists without a second round
trip from the frontend.

cc
2026-04-21 11:27:51 -06:00
vicrodh 4a16567fac feat(sidebar): honor the user's custom playlist cover, with an optimized thumb
Custom playlist covers (set from PlaylistDetailView) were visible in
the detail header but not in the sidebar, where the 2×2 collage always
won. The sidebar now shows the custom cover as a single 20×20 tile and
only falls back to the collage / ListMusic icon when no custom cover is
set.

To avoid decoding a multi-MB JPEG for a 20×20 slot, local-file covers
pipe through the existing v2_library_get_thumbnail command — generates
a 500×500 JPEG with the standard on-disk cache so the webview only ever
hands a small resized file to the <img>. Remote URL covers skip the
thumb pipeline and render directly.

Changes:
  * PlaylistSettings TS interface gains custom_artwork_path.
  * resolveCustomCover(playlistId) returns the thumb URL when available,
    the asset://localhost-mapped original as fallback while the thumb
    is generating.
  * ensureCustomCoverThumbs(settings) fans out to generate + cache the
    thumb URL per playlist. Called from both the SWR cache-hydrate path
    and the fresh backend fetch.
  * Both playlist render sites (folder-playlist + root-playlist) check
    the custom cover first before the collage / ListMusic fallback.

cc
2026-04-21 11:13:20 -06:00
vicrodh 24e224e802 i18n: align Customize Home labels with the new section titles + raise default
Two things:

1. home.recentAlbums and home.continueTracks (the labels shown in the
   "Customize Home" modal) used to read "Recently Played" / "Continue
   Listening". They now read "Recently Played Albums" / "Recently
   Played Tracks" so the modal labels match the section titles that
   were renamed earlier.

2. Default limit for continueTracks (now Recently Played Tracks)
   changes from 10 → 24. The new grid carousel renders 4×3 = 12
   visible cards and can scroll to one more page; 24 fills the two
   pages exactly.

i18n updated across all 5 locales.

cc
2026-04-21 10:59:53 -06:00
vicrodh dda5506c06 feat(home): render Recently Played Tracks as a 4×3 grid carousel
Replaces the vertical TrackRow list in the Home / For You tabs with a
horizontally-paged grid: 3 rows visible, 4 columns wide on desktop
(responsive down to 3 / 2 / 1 at 1100 / 820 / 540 px breakpoints), up
to 24 tracks total. Scroll arrows advance by a single column at a
time, scroll snap keeps columns aligned, drag-to-scroll is
implicit via the native overflow.

New components:

  * TrackGridCard.svelte — per-track card: 48×48 cover with a
    play/pause overlay on hover, stacked title / clickable album
    name, and a TrackMenu (…) button that appears on hover /
    active-track states. Right-click opens the same context menu.
    Reuses TrackMenu / favoritesStore so wiring matches the existing
    TrackRow behavior.
  * TrackGridCarousel.svelte — section container: title, two nav
    buttons, and a grid-auto-flow:column viewport that exposes
    --col-width / --col-gap / --rows CSS vars tuned by a
    ResizeObserver on the viewport. 3 rows is the default; callers
    could override.

Integrated into both ForYouTab.svelte and HomeView.svelte — same
key (home.continueListening) drives both surfaces, so the new
presentation is consistent across the Discover tabs.

cc
2026-04-21 10:51:02 -06:00
vicrodh 6d8f0f4011 i18n: clarify Home / For You section titles
Renames two home-tab / for-you-tab section titles so their contents
aren't ambiguous once they sit next to each other on the same screen:

  * home.continueListening:  "Continue Listening" → "Recently Played Tracks"
  * home.recentlyPlayed:     "Recently Played"    → "Recently Played Albums"

Both tabs (Home and For You) read the same keys, so a single change
covers both surfaces. Translated across all 5 locales (en/es/de/fr/pt).

cc
2026-04-21 10:40:59 -06:00
vicrodh 8b90ac7245 fix(sidebar): hide My QBZ section when it lives in the titlebar
The sidebar already respected the titlebar-owned flag for Discover,
Favorites, Library, and Purchases but not for My QBZ — toggling
"Show My QBZ in titlebar" in Settings duplicated the entry in both
places. Add a myQbzInTitlebar prop plumbed from +page.svelte
(tbNavMyQbz && showTitleBar, same pattern as the others) and gate the
sidebar block on it.

cc
2026-04-21 10:31:48 -06:00
vicrodh 0896d8cb93 style(sidebar): drop the Playlists header icon
The "PLAYLISTS" section label no longer carries an icon — it returns
to a plain .section-header div. With padding: 0 8px, the text now
starts at x=8px, which matches where the icon containers of every row
below it begin, so the header visually sits on the same vertical line
as the sidebar's icon column.

Cleanup:
  * Removed the PlaylistsGlyph import.
  * Removed the .section-header-with-icon CSS rule, now orphan
    (Library stopped using it when that section got flattened).

The PlaylistsGlyph component and the source SVG under static/ stay
for future use.

cc
2026-04-21 10:24:07 -06:00
vicrodh feb750e231 style(sidebar): shrink icon slot from 22×22 to 20×20
Small tightening pass — 22×22 felt bulky in practice. 20×20 keeps the
Cider-style alignment guarantee (all labels share the same x) while
giving the sidebar a slightly denser look.

Touches NavigationItem's iconSize default, the 5 custom-sized
icon-containers in Sidebar (my-qbz, favorites, folder header, popover
header, context menu), and the two PlaylistCoverCollage size={20}
call sites.

cc
2026-04-21 10:17:10 -06:00
vicrodh e9a6b223a0 style(sidebar): unify icon container to 22×22 so every label shares one x
Cider-style alignment: the glyph inside the container can be any size
(most lucide nav icons still render at 14×14), but the container slot
is always 22×22 so labels across every sidebar entry land at the same
horizontal position regardless of whether the row shows a lucide icon,
a folder glyph, a collage, or the favorites/my-qbz mask.

Changes:
  * NavigationItem iconSize default 14 → 22 (only affects the
    container; the caller-supplied icon snippet is unchanged).
  * Playlist rows drop the explicit iconSize prop (default now matches
    the collage already at 22×22).
  * .my-qbz-parent .icon-container, .favorites-nav-item .icon-container
    bumped from 14×14 to 22×22.
  * Folder header, folder popover header, and "move to folder" context
    menu items: wrap the FolderGlyph in an .icon-container div and
    size it 22×22. .folder-header also gains height:32px, gap:8px and
    padding:0 8px to match NavigationItem.

cc
2026-04-21 10:07:17 -06:00
vicrodh 54988d8dff style(sidebar): drop label tier from text-primary to text-secondary
First pass pushed sidebar labels all the way to --text-primary (same
brightness as track titles in detail views), which read too loud in
actual use. Matches the Settings view's .setting-label tone
(--text-secondary) — brighter than the original --text-muted baseline
but calmer than --text-primary.

Also fixes the Favorites / Library row that was still running on its
old hand-rolled .favorites-nav-item styles (text-muted, no icon
accent): now matches the rest of the sidebar with text-secondary on
the row and accent-primary on the icon container. The
.favorites-nav-item.active override that bumped back up to
text-primary was removed too, since the background tint alone is
enough to mark the active state.

Surfaces touched:
  * NavigationItem: .nav-item + .label → --text-secondary
  * .favorites-nav-item: same + icon-container gets accent
  * .my-qbz-parent: --text-secondary
  * .folder-name: --text-secondary
  * .folder-popover-header > span: --text-secondary
  * .section-header-with-icon > span: --text-secondary

cc
2026-04-21 10:01:23 -06:00
vicrodh e47480b30f refactor(sidebar): flatten Local Library collapsible into a single nav item
Removes the collapsible Local Library section — header button with
chevron + Browse child row — in favor of a single NavigationItem that
goes straight to the library view. Label is "Local Library"
(library.title), icon is LibraryBig at 14×14 (inherits accent via
NavigationItem's icon-container like every other nav entry).

Also removes the now-unused localLibraryCollapsed state, its entry in
the SidebarCollapseState interface, and the HardDrive icon import
(was only used by the removed Browse row). Persisted collapse state
from previous sessions is read with ?? false so old keys are ignored
gracefully without touching the stored blob.

Side effect: the earlier Library section-header-with-icon tint issue
is moot — the section header that needed custom styling no longer
exists.

cc
2026-04-21 09:58:02 -06:00
vicrodh 4ef7242e4c style(sidebar): accent-tint parent icons and add glyphs to section headers
Addresses three visual gaps in the sidebar after the earlier brightening
pass:

1. My QBZ parent — icon was inheriting the row's text-muted color
   because the custom .icon-container had no color rule of its own. Now
   the icon container sets accent-primary and the parent row's label
   uses text-primary, matching NavigationItem.

2. Folder rows — the folder glyphs were still muted because .folder-
   header / .collapsed-folder-btn / .folder-popover-header all carried
   text-muted as their base color, and FolderGlyph paints via
   currentColor. Switched each surface's base color to accent-primary
   and added explicit text-primary overrides on the actual label spans
   (.folder-name, the popover header span) so the labels stay bright.

3. Section headers — PLAYLISTS had no icon at all and Library only had
   a chevron. Added glyphs via a new .section-header-with-icon class
   that runs accent-primary at the container level (so the SVG picks
   up the tint) with a nested span override for the uppercase label.
   PLAYLISTS uses a new PlaylistsGlyph.svelte (user-supplied
   list-music-player SVG, checked into static/). Library uses
   lucide-svelte LibraryBig for now — swap to a custom SVG later if
   desired.

cc
2026-04-21 09:48:01 -06:00
vicrodh d71bf2334d style(sidebar): replace outline folder icons with solid two-state glyphs
Swaps the outline lucide Folder / FolderPlus icons throughout the
sidebar for the user-supplied solid SVGs, with a state-aware variant
on the folder header so expanded folders actually *look* open.

New component: icons/FolderGlyph.svelte — a single file with three
variants (closed / open / new), fill="currentColor" so it picks up the
surrounding --accent-primary color from the nav item.

Placements:
  * Folder header (collapsible tree node): open variant when expanded,
    closed when not. Reinforces the chevron rotation with a second
    visual cue.
  * Collapsed-sidebar folder button: closed (there's no expand state
    when the whole sidebar is narrow).
  * "Move to folder" context-menu entries: closed (list items).
  * Folder popover header (opened from the collapsed-sidebar button):
    open (the popover IS showing the folder's contents).
  * "New Folder" menu item: the new variant (with the + indicator
    baked into the glyph).

Source SVGs are checked into static/ for traceability.

cc
2026-04-21 09:38:51 -06:00
vicrodh e98bfd62d8 feat(settings): opt-out toggle for sidebar playlist cover collage
Adds Settings > Appearance > "Show playlist cover collages in sidebar"
(on by default, persisted to localStorage as
qbz-sidebar-playlist-collage).

When off, playlist rows in the sidebar fall back to the original
ListMusic icon at its natural 14×14 size — same row alignment as
every other nav item. When on, the 2×2 collage renders as before.
Toggle is reactive via a new subscribePlaylistCollage listener in
sidebarStore, so flipping it applies immediately without a refresh.

Intended for low-end machines where the four extra <img> tags per
visible playlist row (even at _50.jpg, even gated by virtual scroll
and loading="lazy") are still measurable overhead.

i18n: added keys to all 5 locales (en/es/de/fr/pt).

cc
2026-04-21 09:35:31 -06:00
vicrodh ff5d143011 perf(sidebar): request 50x50 variant for playlist cover collage tiles
The collage renders at 22x22 total (each tile ~11x11), so Qobuz's
_150.jpg variant (that comes back in images150/300) is roughly 13×
oversampled and ~4× heavier on the wire than needed. Rewrites matching
Qobuz cover URLs to the _50.jpg variant — ~2 KB per tile instead of
~8 KB. A playlist row with 4 tiles drops from ~32 KB to ~8 KB.

Regex only touches URLs ending in `_150.jpg` / `_300.jpg` / `_600.jpg`
(optionally followed by a query string), so non-Qobuz URLs (local
library covers, data URIs) pass through untouched.

cc
2026-04-21 09:25:25 -06:00
vicrodh 17cee63142 feat(sidebar): show 2x2 cover collage for playlist entries
Replaces the ListMusic icon on user-playlist rows with a 22x22
2x2 collage of the first four track covers when available, matching
the visual pattern used by Cider and other modern music clients.

Data source: images150 / images300 already come back from
v2_get_user_playlists (qbz-models::Playlist.images150/300). Zero
extra backend calls; the sidebar Playlist interface just gains the
two fields that were being stripped by the narrower TS type.

Resource cost: <img loading="lazy"> + the existing virtual scroll in
the sidebar ensures covers only fetch for playlist rows currently
visible. Playlists nested in collapsed folders are excluded from
visiblePlaylistItems, so their covers never load until the folder
is expanded.

Fallback: if a playlist has no cover images (edge case — playlist
with no tracks, or API omits them), the original ListMusic icon
renders inside the same 22x22 slot to keep row alignment stable.

Components:
- PlaylistCoverCollage.svelte (new): 22x22 grid / single-image /
  empty-passthrough based on image count.
- NavigationItem.svelte: adds iconSize prop (default 14) so
  playlist rows can expand to 22x22 without affecting the other
  nav entries.
- Sidebar.svelte: integrates the collage into both folder-playlist
  and root-playlist render paths.

cc
2026-04-21 09:24:25 -06:00
vicrodh fa21db5216 style(sidebar): brighten nav labels and accent-tint nav icons
Makes sidebar entries more legible at a glance — item labels now use
--text-primary (was --text-muted, inherited from the button) and the
icon container uses --accent-primary. Matches the visual hierarchy
common in modern music clients (label = content, icon = branded
affordance).

Active state keeps its background highlight but no longer overrides
the label color, since both active and inactive labels are now at the
brightest tier.

cc
2026-04-21 09:22:09 -06:00
vicrodh f5cb7bb7b4 fix(ui): apply pending-seek pattern to immersive PlayerControlsCompact
Last of the four seekbar surfaces. Previously only NowPlayingBar had
the fix; the immersive-mode compact controls kept showing the old snap
back to pre-seek position during the decoder reinit window.

Adds pendingSeekTime, the 2s lands-near-target detection effect, the
8s safety timeout, and a spinner thumb that renders only while pending
(the immersive design has no thumb by default, so we inject one via
{#if isSeekingPending}).

Part of #335.

cc
2026-04-20 21:38:07 -06:00
vicrodh 1e9861c351 fix(ui): apply pending-seek pattern to MiniPlayerFooter seekbar
Same treatment as NowPlayingBar and ExpandedPlayer — the miniplayer
already deferred onSeek until mouseup, but had no pendingSeekTime, so
the thumb still snapped back to pre-seek position during the 1–2s
decoder reinit window.

Adds pendingSeekTime, a 2s-window effect to clear it once currentTime
lands, an 8s safety timeout, and a spinning-ring variant of the thumb
while the seek is pending. The thumb was display:none in the
miniplayer's minimalist style; it now renders when .seeking is set so
the user gets feedback.

Part of #335.

cc
2026-04-20 21:36:30 -06:00
vicrodh 448df9c59f fix(ui): apply pending-seek pattern to ExpandedPlayer seekbar
Brings the large-player seekbar up to parity with NowPlayingBar so long
seeks no longer show the thumb snapping back to the pre-seek position
during the 1–2s decoder reinit window.

Changes:
  * Defer onSeek until mouseup (was firing on every mousemove, which
    flooded the backend with seek commands and made the visual feedback
    noisy).
  * Add dragPreviewTime for in-drag thumb position.
  * Add pendingSeekTime — thumb stays pinned to target after mouseup
    until currentTime lands within 2s of it.
  * Spinner on the thumb while pendingSeekTime is active, with an 8s
    safety timeout to clear if the seek never lands.
  * Time display reads from effectiveTime so the user's intended
    position shows through the wait.

Part of #335.

cc
2026-04-20 21:34:41 -06:00
vicrodh 8833174f21 fix(ui): keep seekbar thumb on target position with spinner during seek
After the user releases the seekbar the backend still needs 1–2s to
reinit the decoder, run the format seek and restart the audio engine
(especially for long jumps on FLAC Hi-Res). The thumb used to snap back
to the pre-seek position during that window, giving the impression the
seek was rejected, then jump to the clicked position when audio
resumed.

Now the thumb stays at the clicked time (pendingSeekTime) and renders
as a spinning ring until currentTime lands within 2s of the target.
Includes an 8s safety timeout so the UI can't be stuck spinning if the
seek never lands (track ended, device lost, etc.).

Part of #335.

cc
2026-04-20 21:29:07 -06:00
vicrodh dd443ba822 perf(player): use Symphonia native seek for cached-track seeks
Adds InMemorySource — a Symphonia FormatReader+Decoder backed by an
in-memory Cursor — and wires it into the cached branch of the Seek
handler so FLAC Hi-Res and MP3 seeks on LRU-cached / local-library /
offline-cached tracks jump via seek table instead of decoding every
sample from byte 0. Matches the streaming path's behavior, eliminates
the CPU spike during long seeks that was producing audible stuttering
after the streaming seek fix landed.

Falls back to the previous decode_with_fallback + skip_duration path
when Symphonia can't probe the format (rodio-only MP4/AAC container)
or when the native seek itself fails, so nothing regresses for those
formats.

Part of #335.

cc
2026-04-20 21:25:17 -06:00
vicrodh 11d01a2075 perf(player): use Symphonia native seek for CMAF streaming seeks
Replaces skip_duration's decode-every-sample-from-zero loop with
FormatReader::seek(SeekMode::Accurate, SeekTo::Time) on a fresh
IncrementalStreamingSource. For FLAC this jumps via the seek table to
the nearest seek point, then decodes forward to the exact sample —
instead of grinding through millions of samples under the buffered
source's mutex (the cause of post-seek stuttering).

Added IncrementalStreamingSource::seek_to(Duration) which also resets
the decoder, clears the sample queue, and rearms the finished flag so
the source is cleanly re-primed for the iterator.

Non-streaming seeks (cache, offline-cache, local library) still use
skip_duration — they hit in-memory bytes with no lock contention, so
the linear decode is effectively free and there's no reason to change
the path.

Part of #335.

cc
2026-04-20 21:15:14 -06:00
vicrodh bdc901a88a fix(ui): show not-allowed cursor past streaming watermark
Communicates the seek ceiling that the drag clamp already enforces.
When the mouse hovers the portion of the seekbar past
bufferProgress × 0.9, the cursor switches to not-allowed so the user
gets immediate feedback that aiming there won't land.

Only active while a CMAF stream is still downloading
(bufferProgress < 1). Fully cached, offline, and local-library playback
keep the normal pointer cursor across the full bar.

Part of #335.

cc
2026-04-20 21:08:32 -06:00
vicrodh 3b8b457836 fix(ui): clamp seekbar drag to buffered zone during streaming
While a CMAF stream is still downloading, the backend rejects seeks
past the buffered watermark. This clamps the drag visually to the same
ceiling (bufferProgress × 0.90) so the user can't aim at a position the
backend would bounce. The 0.90 factor matches the safety margin on the
Rust side so frontend and backend agree on the cutoff.

Fully cached, offline, and local-library tracks (bufferProgress === null)
are unaffected and keep full-range seek.

Part of #335.

cc
2026-04-20 21:06:54 -06:00
vicrodh f58ee31ed7 fix(player): allow seek within buffered zone during CMAF streaming
Relaxes the seek gate added in 2dc1ee9e so seeks that fall inside the
already-downloaded portion of a streaming track succeed instead of being
rejected wholesale. The cutoff is approximated from download fraction ×
track duration with a 10% safety margin (0.90) to cover FLAC/VBR byte
density variance; exact for CBR.

Seeks past the watermark still reject cleanly with a warning log — they
would block the audio thread since skip_duration reads samples
sequentially. Cache, offline-cache, and local-library seeks are
untouched (they don't hit the streaming branch).

Part of #335.

cc
2026-04-20 21:06:00 -06:00
vicrodh 2dc1ee9e9f fix(player): reject seek during active CMAF streaming
Tightens the streaming-seek handler to the simpler contract signed off
by the user: seek works after a streaming track finishes downloading
(buffered_source.is_complete()), but is rejected cleanly with a warning
log while the download is still in progress. Avoids skip_duration
blocking the audio thread on past-watermark seeks without adding
watermark-tracking complexity.

Cache, offline-cache, and local-library seeks are unaffected — they
reach this handler with current_audio_data Some and skip the streaming
branch entirely.

Fixes part of #335.

cc
2026-04-20 20:52:03 -06:00
vicrodh 7d9a847a87 fix(player): honour seek during active CMAF streaming
The audio thread's Seek handler bailed on `current_audio_data.is_none()`
with a warning and returned. That field is intentionally None during
streaming playback — the bytes live inside current_streaming_source's
Arc<BufferedMediaSource>. Effect: every seek on a streaming track with
the CMAF download still in progress was silently dropped; the UI sent
the command, the player ignored it, and the seekbar snapped back to
whatever position the playback timer had reached (issue #335).

Branch the handler on the live source kind. Streaming: build a fresh
IncrementalStreamingSource from the shared buffered_source (new reader
at byte 0, same downloaded bytes — no re-download), then skip_duration
to the target. Non-streaming path unchanged.

Within-watermark seeks now work. Past-watermark seeks currently block
the audio thread while the decoder waits for more bytes; the clamp to
prevent that lands in the next commit.

cc
2026-04-20 20:28:48 -06:00
vicrodh 927fabbd78 fix(alsa): fall back to hw:CARD=<name>,DEV=<n> when aliased id can't open
Minimal distros (the reporter's Raspberry Pi OS case in issue #331) ship
a trimmed /etc/asound.conf that defines only `!default` and doesn't pull
in the broader alias set most desktop distros provide. A card like the
HifiBerry Digi2 Pro — S/PDIF-only, so its selectable PCM is
`iec958:CARD=sndrpihifiberry,DEV=0` — then fails to open even though
the card is present and usable via the raw `hw:` device.

When CPAL's primary lookup by id returns None AND /proc/asound confirms
the card exists, rebuild the id as `hw:CARD=<name>,DEV=<n>` and retry
the lookup. The raw `hw:` PCM is exposed by the kernel driver for every
registered card, so it's a safe last resort — same card, same channel
routing, just skipping whichever userspace alias layer was missing.

Log both the alias failure and the fallback at warn/info so users can
see what happened without needing to diagnose ALSA config by hand.
Original error path is preserved when no fallback is possible (unknown
id shape, card not in /proc/asound, or hw: equally unavailable).

cc
2026-04-20 20:12:39 -06:00
vicrodh 05f0d69fcb fix(alsa): recognise iec958:/hdmi: prefixes in extract_card_name_from_device
Device enumeration produces four "CARD=" alias shapes (front:, sysdefault:,
iec958:, hdmi:) but the extractor only handled the first two. When a user
selected an S/PDIF or HDMI device id, the downstream proc_found check
always returned false, so the device-not-found error message dropped to
the generic "disconnected, renamed, or handled by another app" wording
even when /proc/asound showed the card present.

Part of issue #331 — reporter's HifiBerry Digi2 Pro is S/PDIF-only, so
its id is iec958:CARD=sndrpihifiberry,DEV=0, and the missing prefix match
obscured the real cause of the open failure.

This commit is a pure parsing extension; behavior changes only in the
error message accuracy. The hw:/plughw: fallback attempt lands in the
next commit.

cc
2026-04-20 20:09:27 -06:00
vicrodh 38edf2d012 fix(playlist): shuffle button starts on a random track, not canonical track 0
Issue #333. handleShuffle was calling handlePlayAll() which hardcoded
playableTracks[0] as the track to start playing. After v2_set_shuffle(true)
the queue was correctly shuffled, but the UI always landed on track 0 —
defeating the point of playlist-level shuffle.

Match the pattern ArtistDetailView / LabelView / LocalLibraryView and
+page.svelte::handleShuffleAlbum already use: pick a random index from
the blacklist-filtered playable set, pass it to handlePlayAll, and let the
existing qbz-player/queue.rs `set_queue` semantics move that index to
shuffle_order[0] so the remaining tracks still cover the full playlist
in random order.

Not touching the Rust-side "CRITICAL FIX" block in queue.set_queue even
though the user suggested removing it — that block is load-bearing for
the other callers that already pass a random index and expect it to
become the shuffle head. Removing it would regress those views.

handlePlayAll now takes an optional `startIndex = 0` so the Play-All
button (unchanged behavior — plays from start) and the Shuffle button
(random start) share the same implementation. Context position is
clamped against the Qobuz-only subset so a random pick landing on a
local track doesn't point past its end.

cc
2026-04-20 19:35:28 -06:00
vicrodh d1895f83d0 fix(cast): route local + plex tracks through cast when a device is connected
Drop the `!isLocal` gate on the cast branch so castTrack is invoked for
every source when a cast device is connected. castTrack now knows how to
dispatch to the three source-specific backend commands; the guard was
the only thing keeping non-Qobuz tracks from ever reaching the cast pipeline.

Fixes issue #332: user connects to a DLNA renderer, plays a local file,
expects audio on the renderer, gets silence (audio routes to app's local
ALSA output instead). Same shape as Foobar2000's local-over-DLNA workflow
the reporter compared against.

cc
2026-04-20 18:36:51 -06:00
vicrodh c978e38aef feat(cast): dispatch castTrack on source (qobuz/local/plex) × protocol
Previously castTrack hardcoded two calls (v2_cast_play_track for
Chromecast, v2_dlna_play_track for DLNA) which both assume a Qobuz track
id. Extend the signature with an optional source parameter (default
'qobuz' so existing callers keep working) and route to the matching
backend command per protocol × source.

Plex branch pulls baseUrl + token from userStorage the same way
playbackService does for local Plex playback and passes ratingKey as a
string to the backend. Local branch uses trackId as-is (library row id).

Follow-up commit removes the `!isLocal` guard in playbackService so
non-Qobuz tracks actually take this branch.

cc
2026-04-20 18:35:36 -06:00
vicrodh 42d432469a feat(cast): v2_{dlna,cast}_play_plex_track for Plex tracks over DLNA/Chromecast
Plex has the same cast routing problem as local library: the Qobuz-only
play_track commands can't resolve Plex ratingKeys. Add dedicated commands
that fetch bytes through plex_resolve_track_media (existing), proxy them
through the cast media server, and load the URL on the renderer.

Proxying through the media server (rather than giving the renderer a
direct Plex URL) keeps the user's Plex token in-process. Renderers would
need the token to fetch from Plex directly and that's not a surface we
want to expose.

Content-type fallback to audio/mpeg when Plex omits it (transcode path),
with a plex_key_to_u64 namespaced hash (high bit set) so Plex ratingKeys
can't collide with Qobuz/library ids in the MediaServer keyspace.

cc
2026-04-20 18:33:46 -06:00
vicrodh 76158c81d3 feat(cast): v2_cast_play_local_track for local-library tracks over Chromecast
Companion to v2_dlna_play_local_track. Same bug, same fix applied to the
Chromecast protocol branch: reads library row + file, infers content_type,
registers bytes with the shared media server, loads the URL on the
Chromecast receiver. Reuses the local_track_content_type helper.

User flagged this on the #332 thread — same Qobuz-only assumption in the
Chromecast play command as in the DLNA one.

cc
2026-04-20 18:26:58 -06:00
vicrodh 75146d66a9 feat(cast): v2_dlna_play_local_track for local-library tracks over DLNA
Mirrors v2_dlna_play_track but for library row ids. Reads the file from
disk, infers content_type from AudioFormat (with extension fallback for
Unknown), registers bytes with the DLNA media server, sends AVTransport
URI + Play to the renderer.

Without this command the cast path had no way to send local audio to a
DLNA device — v2_dlna_play_track resolves the id as a Qobuz track and
fails (404 in offline sessions, wrong-song match in online sessions where
the library row id happens to collide with a real Qobuz track id). Issue
#332 reported the symptom as "DLNA not operational"; logs showed the
renderer connected successfully but never received a SOAP SetAVTransportURI.

Frontend wiring in the cast dispatch + playbackService guard removal lands
in follow-up commits.

cc
2026-04-20 18:23:18 -06:00
vicrodh 7c7e819165 Merge branch 'feature/mixtapes-collections' into pre-release
Mixtapes & Collections — a second container family alongside Qobuz
playlists. Private to the install, cross-source (Qobuz + LocalLibrary +
Plex), with its own detail view, Add-to picker, bulk ops, per-collection
view prefs, and a Discography Builder for one-click Artist Collections.

Backend:
- New tables mixtape_collections + mixtape_collection_items with
  CASCADE + additive migrations.
- New v2_* command surface: CRUD, enqueue_collection,
  enqueue_collection_item, skip_to_next_item / previous_item for
  album-boundary navigation, mixtape_item_exists for duplicate checks,
  custom cover upload / remove.
- Plex branch in resolve_local_album so plex: album keys route to the
  plex cache instead of local_tracks.

Frontend:
- Sidebar My QBZ collapsible nav, title bar entry, index + detail views
  with virtualization / sticky unified toolbars / size-aware Qobuz
  artwork / image cache. Per-collection view prefs (viewMode / sort /
  filter) persisted in per-user localStorage.
- Index views get search + sort + kind filter + list-or-grid toggle.
- Add-to-Mixtape wired across ArtistDetail / Search / Label /
  PlaylistDetail / LocalLibrary; multi-select + bulk ops for albums.
- Queue / playback fixes bundled: per-album Play for all three sources,
  session source round-trip for local/Plex auto-advance, NowPlayingBar
  artwork resolver for Plex / local paths, clear-queue includeCurrent
  flag, natural-end queue cleanup.

Release notes in docs/release-1.2.8/TAG_DETAILS.md.

cc
2026-04-20 17:50:04 -06:00
vicrodh c09213a0ee docs(release-1.2.8): Mixtapes & Collections tag notes
Release notes for 1.2.8 explaining Mixtape vs Collection vs Playlist in
user-facing terms: playlists are Qobuz-hosted track lists, Mixtapes are
private ordered cross-source listening sessions, Collections are
private themed album shelves. Covers the Discography Builder, the
Add to Mixtape picker kind rules, custom covers, duplicate-handling
dialog, and the under-the-hood notes for upgraders (new tables, new
v2_* command surface, Plex queue resolver branch).

cc
2026-04-20 17:49:27 -06:00
vicrodh 68e76a203e fix(ui): wire per-album play + session source restore + NowPlayingBar artwork + My QBZ titlebar
Consolidates the +page.svelte side of several independent fixes/features
whose non-+page pieces landed in the preceding commits.

- handleMixtapeItemAction: was calling v2_set_queue with { trackIds }
  but the command expects { tracks, startIndex } — Tauri rejected the
  call so per-album Play from a Collection did nothing. Now routes
  Qobuz items through the existing fast path (with blacklist filter +
  artwork fallbacks) and local/Plex items through the new
  v2_enqueue_collection_item backend command, then resolves the queue
  via playQueueIndex(0) + playQueueTrack(trk) so audio actually starts
  (v2_play_queue_index only moves the cursor; it doesn't tell the
  player to load bytes).
- Session save (saveSessionBeforeClose): includes source on each
  PersistedQueueTrack. Without it, a LocalLibrary queue came back as
  is_local=true / source=undefined and the auto-advance path routed
  local row-ids to v2_play_track (Qobuz).
- Session restore: map session.queue_tracks with a source fallback
  (trk.source ?? (trk.is_local ? 'local' : undefined)) so older saved
  sessions (pre-source-field) still route correctly. setCurrentTrack
  default for source is now 'local' when is_local is true, not
  hardcoded 'qobuz'.
- playQueueTrack: artwork goes through resolveQueueTrackArtwork so a
  raw Plex /library/... thumb path or a bare local filesystem path
  becomes a valid src for NowPlayingBar instead of a 404.
- Title bar: isMyQbzInTitlebar state + showMyQbz prop passed to
  TitleBarNav so the new My QBZ entry can be toggled from Settings.

cc
2026-04-20 17:49:17 -06:00
vicrodh 260f147621 feat(titlebar): add My QBZ to title bar nav
Mirrors the Discover / Library / Local Library / Purchases title-bar
entries. Button opens a hover dropdown with Mixtapes and Collections;
label comes from myQbzNavStore so a sidebar rename propagates.

- titlebarNavStore: new myQbz flag with getter/setter/migration.
  isTitlebarNavEnabled() includes it in the enabled-any check.
- TitleBarNav: new showMyQbz prop + CassetteTape button with a
  dropdown menu (Mixtapes / Collections); shared open/close mechanics
  with the other nav dropdowns so only one is open at a time.
- SettingsView: new Toggle between Library and Purchases, disabled
  when the title bar is hidden or the system title bar is active
  (matches the other toggles in the section).

Wiring in +page.svelte ships with the next commit.

cc
2026-04-20 17:48:59 -06:00
vicrodh 739d5b0f7e feat(collections): index toolbar (search/sort/filter/view) + i18n
Root Collections and Mixtapes pages had only a title + New button + a
grid of cards. Added the same .list-controls vocabulary the detail view
uses so users see a consistent control surface across the feature.

- Search: matches name + description.
- Sort dropdown with asc/desc toggle on re-click: Position (manual),
  Name, Items, Recently updated.
- Kind filter on CollectionsView only (All / Collections / Artist
  Collections). MixtapesView omits it — one kind means the dropdown
  would be noise.
- View-mode segmented toggle (list / grid). Grid keeps the existing
  208px cards; list is a dense row with 48px mosaic cover + name +
  kind label + count.
- Empty-results state when search/filter returns zero.
- Preferences persisted globally (per user) under
  collections-index-prefs / mixtapes-index-prefs — viewMode, sortBy,
  sortDir, kindFilter round-trip across sessions. searchQuery stays
  transient per-session.

i18n (en / es-MX / de / fr / pt):
- collections.searchPlaceholder / sortByItems / sortByUpdated /
  kindFilterAll / kindFilterCollection / kindFilterArtistCollection
- mixtapes.searchPlaceholder
- nav.myQbz (used by the upcoming title bar entry)

cc
2026-04-20 17:48:49 -06:00
vicrodh 62355f8b64 perf(mixtape+playlist): virtualize + unified sticky headers + small artwork
Collection / Mixtape detail, Playlist detail, and Playlist manager all
got sluggish with 50+ items — too many <img> tags, full 600px Qobuz
covers decoded for tiny tiles, and two-tier sticky headers with visible
gaps between them. Straightened all of it with patterns we already had
in the codebase; no new deps.

MixtapeCollectionDetailView:
- Fixed-height windowed virtualization for list/grid modes (LIST_ROW_HEIGHT 56,
  GRID_ROW_HEIGHT 240). Top/bottom spacer divs reserve scroll height.
- Row height forced to 56px (was variable 52-60), so the scrollbar's
  scrollHeight matches the actual end of the content and the user can
  reach the last row without stutter.
- The scroll-reset effect now reads listAnchorOffsetTop via untrack so
  mid-scroll ResizeObserver ticks don't re-fire the reset and snap
  scroll back; RO no longer observes the list anchor itself (its size
  changes every scroll tick and is irrelevant to its offsetTop).
- Expanded-mode auto-fetch is gated to visible items — no more 60
  concurrent backend calls on mode switch.
- Sticky toolbar wraps search + sort + filter + select + view-mode as
  ONE block; box-shadow -8px/+8px extends the opaque background over
  the scroller's 8px padding-top gap and any next-element margin seam.
- Qobuz artwork URLs downsized (_50 / _150) for list/grid thumbnails
  instead of the stored _600.

PlaylistDetailView:
- Track controls + batch-controls + column header wrapped in one
  .tracks-sticky-header inside .track-list. Single sticky instead of
  two at top:0 and top:56 with a visible row peeking through the gap;
  containing block is .track-list (tall as virtual content) so the
  toolbar no longer disappears when scrolled past the .view-transition
  wrapper's height: 100%.
- Cover <img> routed through use:cachedSrc + loading=lazy / decoding=async.

PlaylistManagerView:
- .controls sticky with box-shadow -8px/+12px to cover the padding-top
  gap and bottom margin; folder-icon <img> tags (grid / list / tree)
  now use:cachedSrc with convertFileSrc + lazy/async.

Shared components:
- QualityBadgeStatic: new component, visually 1:1 with QualityBadge's
  full mode but no hardware-status polling, no downgrade arrow, no
  plughw tooltip — used in list rows where every item advertises its
  own stored quality and shouldn't react to now-playing state.
- CollectionMosaic + PlaylistCollage: size-aware Qobuz URL picker
  (50/150/300/600 based on rendered tile size) and use:cachedSrc +
  lazy/async on every cell. 20 mosaics × 4 cells at 140px used to
  pull 80 × 600px JPEGs; now they pull 80 × 150px JPEGs through the
  shared image cache.

cc
2026-04-20 17:48:31 -06:00
vicrodh ec52997c02 feat(library): album multi-select + bulk ops + root-view padding
- AddToMixtapeModal: accepts an array of items (was single), gains a
  duplicate pre-check panel with Add anyway / Skip duplicates / Cancel,
  hides the + Collection button for non-album items (Collection shelves
  can't hold a bare track or nested playlist).
- AlbumCard: selectable / selected / onToggleSelect props — corner
  checkbox overlay that replaces the click-to-open behavior when
  selection mode is on. Same pattern ArtistDetailView already used for
  popular tracks.
- VirtualizedAlbumList: pass-through for the select-mode props +
  forwards albumId / year / trackCount so cards render consistently in
  the grid.
- LocalLibraryView: new SquareCheckBig toggle in the Albums tab; bulk
  handlers (PlayNext / PlayLater / AddToMixtape / AddToPlaylist) route
  each selected album through fetchAlbumTracks so local + Plex items
  resolve correctly. BulkActionBar mounted at the bottom of the albums
  grid.
- ArtistDetailView + LocalLibraryView: root-view padding now
  'padding: 8px 8px 100px 18px' and .back-btn margin-top 8px to match
  the AlbumDetailView / FavoritesView standard.

cc
2026-04-20 17:48:04 -06:00
vicrodh 4b6d8173af fix(queue): preserve source on session save/restore + resolve queue artwork
Two fixes that together clear the LocalLibrary auto-advance desync:
audio played a different track than the NowPlayingBar showed, and the
cover showed a '?' placeholder for local/Plex tracks.

- sessionService.ts: PersistedQueueTrack gains an optional source
  field so qobuz | local | plex round-trips through session_store.
  Without this, the restore path rebuilt the queue with is_local=true
  but source=undefined, and downstream callers that defaulted
  undefined-source to 'qobuz' routed v2_next_track results to
  v2_play_track — Qobuz then resolved library row ids to whatever
  random track shared the id.
- queueArtwork.ts: new resolveQueueTrackArtwork() turns a CoreQueueTrack
  artwork_url (http, file://, bare Plex /library/... path, or bare
  filesystem path) into something the WebView can actually fetch.
  Previously a raw Plex thumb path hit localhost:1420 and 404'd;
  local paths tried to load as if relative URLs.
- playbackService.ts: both auto-skip fallback paths now resolve next
  track artwork through the helper before handing off to playTrack.

cc
2026-04-20 17:47:51 -06:00
vicrodh 23f56b178a feat(mixtape): v2_enqueue_collection_item + Plex branch + repo hydration
Backend:
- New v2_enqueue_collection_item(collectionId, position, mode) routes a
  single collection item through the existing ProdItemResolver — same
  path v2_enqueue_collection uses, scoped to one position. Supports
  replace / play_next / append modes. Unlocks per-album Play for local
  and Plex items from the Collection detail view (previously only Qobuz
  had a working fast-path there).
- enqueue.rs: resolve_local_album now detects plex: prefixes and routes
  to plex_cache_get_album_tracks instead of querying local_tracks, so
  Collections with Plex albums actually enqueue end-to-end.
- repo.rs: list_collections now hydrates items for every collection so
  the item count in CollectionsView / MixtapesView is real, not 0.
- mixtapeCollectionsStore.ts: bindings updated for new + changed
  commands (add_item with allow_duplicate, item_exists, custom cover
  upload/remove).

cc
2026-04-20 17:47:38 -06:00