Skip to content

Library split: Albums + Artists pages, artist hero redesign, Wikipedia bios, casing cleanup

jedmund requested to merge jedmund/library-split-and-redesign into main

Splits the single Library page into two distinct routes, redesigns the artist detail header, adds Wikipedia bios, persists view mode in localStorage, surfaces artist photos on cards/rows, and strips all-caps from headers across the app.

Routes

Before After
/ (Library, with Type toggle) / (Albums) — Type toggle dropped
/?type=artists /artists (no source toggle)
/artists → 308 redirect to /?type=artists /artists is the real page
/artist/[key] unchanged URL, redesigned hero

Nav becomes Albums | Artists | Random | Batch. Artists nav entry highlights on /artist/[key] too.

What changes

  • /artists drops the source toggle. Artists are inherently cross-source — pendingCount + sortedCount is the relevant number on every row. This fixes the bug where rows showed 0 because the inherited source toggle defaulted to Unsorted while every album was on the sorted side. ArtistCard / ArtistListRow now accept an optional source prop; omitting it (the new page does) shows combined totals.
  • View-mode persists per page via a new $lib/stores/viewMode.ts factory. Keys: library.albums.view, library.artists.view. Albums can be in List while Artists is in Grid (or vice versa).
  • Artist cards and list rows now render the cached /api/artist-art/[key] portrait with the existing person icon as the onerror fallback. ArtistCard uses a 48px circle; ArtistListRow gets a 32px circle inline with the artist name.
  • /artist/[key] hero redesign:
    • Portrait bumped from w-24 (96px) to w-28 (112px) — about 17%, matching the user's "about 10%" direction. Stays circular.
    • Row uses items-center so the larger portrait and the text hang together.
    • Title bumps to text-3xl.
    • Back link moves out of the hero to a standalone ← Artists link above it.
    • Sorted section now renders above Unsorted (prior order reversed per user direction — the user's catalog is sorted-dominant, so leading with that is more useful).
    • Bio paragraph rendered below the hero when Wikipedia matched, with a More on Wikipedia → link.
  • Wikipedia bio fetch:
    • New src/lib/server/api/wikipedia.ts hits https://en.wikipedia.org/api/rest_v1/page/summary/<name>.
    • Music-keyword heuristic on the article's short description prevents disambiguation pages and non-musician collisions from polluting the bio cache.
    • Five new columns on artists (bio / bio_url / bio_source / bio_fetched_at / bio_attempted_at). Independent 7-day back-off so a Wikipedia 404 doesn't share a retry clock with the photo fetch.
    • Hooked into the same sorted-scan loop that fetches photos — both run in parallel inside the 5-concurrency queue, so wall time grows by max(photo, bio) per artist rather than the sum. Independent log tallies.
  • Casing cleanup: stripped uppercase tracking-wide everywhere in the codebase. Affected files: AlbumTable.svelte, FileList.svelte, SortedAlbumPanel.svelte, batch/+page.svelte, settings/+page.svelte, artist/[key]/+page.svelte. Beets job statuses and log levels keep their dynamic source strings but render capitalize.

Verification

  • pnpm run build passes.
  • Visit / — Albums page, no Type toggle. Source toggle still works. View toggle persists across reloads.
  • Switch view on / to List. Visit /artists — that page stays in its own default until you toggle it (independent persistence).
  • Artists page shows non-zero counts for artists with sorted albums. Cards and rows render real portraits where cached, fallback icon otherwise.
  • Visit /artist/<known-artist> — portrait is visibly larger (~112px), title is text-3xl, back link reads ← Artists. Sorted section renders above Unsorted. If Wikipedia matched, a 2–3 line bio sits under the hero with a More on Wikipedia → link at the end.
  • No text-uppercase / uppercase text anywhere — verify artist detail table headers, section labels, settings page, batch page.
  • Trigger a manual scan; logs show both Artist photos: and Artist bios: tallies. Subsequent scans show high backed-off counts for both kinds.
  • Wikipedia API unreachable: bio fetch logs a warning, page still renders without the bio paragraph.

Notes

  • Bio fetch is tied to the sorted scan (same as photos). Unsorted-only artists won't get a bio until they appear on the sorted side. Mirrors the existing photo pattern.
  • The Wikipedia music-keyword heuristic is conservative — it might miss bios for very obscure or non-English-described artists. The cost of a false negative (no bio) is much lower than a false positive (a politician's bio on a musician's page), so the heuristic prefers caution.

Merge request reports

Loading