Commit graph

3 commits

Author SHA1 Message Date
dlynas
1afc79a64b feat: full discography, explicit badges, smart selection, and sorting
Pagination: raise discography limit from 50 to 500 across all three API
call sites (artist-detail page, discography download modal, source-detail
view). Deezer/iTunes/Spotify already paginated internally; Discogs updated
to paginate all pages instead of a single capped request.

Explicit flag: add explicit field to the Album dataclass in every metadata
source (Deezer, Spotify, iTunes, Discogs, MusicBrainz, Hydrabase). Deezer
extracts explicit_lyrics, iTunes extracts collectionExplicitness, Hydrabase
forwards the field from the server response; Discogs/MusicBrainz/Spotify
stay None. The field threads through _build_discography_release_dict and
_build_artist_detail_release_card so it reaches the frontend on every
release object. A small "E" badge renders next to explicit album titles in
both the discography download modal and artist-detail page cards.

Smart selection: "Select Best" button in the discography download modal
groups visible cards by normalised title (edition/variant suffixes stripped)
and within each group checks only the highest-scoring version. Scoring
mirrors the existing Python _variant_score logic: explicit > non-clean >
no variant suffix > more tracks > newer release date.

Sort controls: Date desc/asc and Name A-Z/Z-A dropdown added to the
discography modal filter bar. Sorting reorders DOM nodes in place so
checked state is preserved across sort changes.

UI: discography card titles now wrap to full text instead of truncating
with ellipsis; card artwork and checkbox pin to the top when titles wrap.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 19:24:34 -04:00
Antti Kettunen
50e1ae3a3f
Move metadata helpers into package modules
- split metadata lookup logic into core/metadata/*
- keep core/metadata_service.py as the legacy barrel
- update tests and artist-detail code to patch concrete modules
2026-04-29 11:28:42 +03:00
Broque Thomas
14893c85a9 Extract _build_source_only_artist_detail into core/artist_source_detail.py
JohnBaumb's review: "If we're going to refactor the web_server.py soon,
might as well start moving stuff away from web_server.py in our PRs.
_build_source_only_artist_detail, make it a module, it's perfect."

This continues the pattern the prior commit started with the source-ID
lookup helpers: move the pure data-building logic to a side-effect-free
core module, leave a thin wrapper in web_server.py that bridges the
Flask response and the module-global clients.

**core/artist_source_detail.py** — pure function that takes the artist id,
name, and source plus dependency-injected per-source clients (spotify,
deezer, itunes, discogs) and a Last.fm API key. Returns
(payload_dict, http_status) so it isn't coupled to Flask.

**web_server.py wrapper** — builds the client bag from the module globals
(checks Spotify auth, constructs the Discogs client from the configured
token, reads the Last.fm API key) and wraps the core return in jsonify.
147 lines of logic go away from web_server.py; the 24-line wrapper is
purely glue.

**tests/test_artist_source_detail.py** — 21 focused tests covering the
response envelope, the source-specific ID-field stamping for all six
supported sources, the dedup_variants=False contract (the behaviour
that originally motivated the split of MetadataLookupOptions), per-source
genre/follower extraction with safe handling of missing or throwing
clients, and the Last.fm enrichment branch including the no-key and
error-path cases. Runtime 0.26s.
2026-04-23 08:09:29 -07:00