Covers on statistics cards and editing alternative names #49

Closed
opened 2026-10-09 16:06:05 +02:00 by Sansan · 0 comments
Owner

Show each soundtrack's cover on its statistics card, and let the user add alternative names to a soundtrack from the statistics popup.

Needs from MusicServer:

The server finds the covers in the background, so the API key stays on the server and the app only downloads small pictures.

Covers

  • API calls. MusicServerClient.fetch_soundtrack_cover(uuid, on_done, on_failed) → bytes. A 404 means there is no cover yet.
  • Cache.
    • A CoverCache like common/character_cache.gd, in its own folder Settings.config_dir()/covers/, with an index.json of cover_modified per soundtrack UUID.
    • A cover is only downloaded again when the server's time changed.
    • Covers of removed soundtracks are deleted.
    • Share the index logic with CharacterCache by pulling out a small FileCache class.
  • Loading.
    • Covers load when the card is visible, not all at once when the tab opens: a short queue with a few requests at a time.
    • The card shows a placeholder until its cover arrives.
  • Card layout (statistics/SoundtrackCard.tscn): the cover on the left or top (TextureRect, keep aspect, rounded corners through the theme). The grid card size may need adjusting.
  • Popup. SoundtrackStatsPopup shows the cover larger.
  • Offline mode. No covers, or a cover.jpg in the soundtrack's folder if present.

Alternative names

  • Popup. popups/SoundtrackStatsPopup.tscn gets an Edit button by the title. It opens a small editor: the list of alternative names with remove buttons, and a field plus Add.
  • Saving. Save with PUT /api/v1/soundtracks/{uuid}/alternative-names (new MusicServerClient call). Update the card and the search without a full reload.
  • Search.
    • The statistics search, the Search popup (common/soundtrack_search.gd) and the inspiration list match alternative names too.
    • The result shows the real name, and the matched alternative name in smaller text.
  • Generated types. Regenerate the API types (tools/generate_api_types.gd) after the server change.

Tests

  • CoverCache: fresh/stale/removed like the CharacterCache tests, with FakeHttpTransport.
  • Cards show the cover when the fake server returns one and the placeholder on 404.
  • Editing names sends the PUT and the search then finds the soundtrack by its new name.

Question

  • Should editing names need some kind of "admin" step, or may every user of the app change them?
Show each soundtrack's cover on its statistics card, and let the user add alternative names to a soundtrack from the statistics popup. Needs from MusicServer: - Sansan/MusicServer#12: covers fetched and stored by the server. - Sansan/MusicServer#32: alternative names. The server finds the covers in the background, so the API key stays on the server and the app only downloads small pictures. ## Covers - **API calls.** `MusicServerClient.fetch_soundtrack_cover(uuid, on_done, on_failed)` → bytes. A 404 means there is no cover yet. - **Cache.** - A `CoverCache` like `common/character_cache.gd`, in its own folder `Settings.config_dir()/covers/`, with an `index.json` of `cover_modified` per soundtrack UUID. - A cover is only downloaded again when the server's time changed. - Covers of removed soundtracks are deleted. - Share the index logic with `CharacterCache` by pulling out a small `FileCache` class. - **Loading.** - Covers load when the card is visible, not all at once when the tab opens: a short queue with a few requests at a time. - The card shows a placeholder until its cover arrives. - **Card layout** (`statistics/SoundtrackCard.tscn`): the cover on the left or top (`TextureRect`, keep aspect, rounded corners through the theme). The grid card size may need adjusting. - **Popup.** `SoundtrackStatsPopup` shows the cover larger. - **Offline mode.** No covers, or a `cover.jpg` in the soundtrack's folder if present. ## Alternative names - **Popup.** `popups/SoundtrackStatsPopup.tscn` gets an Edit button by the title. It opens a small editor: the list of alternative names with remove buttons, and a field plus Add. - **Saving.** Save with `PUT /api/v1/soundtracks/{uuid}/alternative-names` (new `MusicServerClient` call). Update the card and the search without a full reload. - **Search.** - The statistics search, the Search popup (`common/soundtrack_search.gd`) and the inspiration list match alternative names too. - The result shows the real name, and the matched alternative name in smaller text. - **Generated types.** Regenerate the API types (`tools/generate_api_types.gd`) after the server change. ## Tests - `CoverCache`: fresh/stale/removed like the `CharacterCache` tests, with `FakeHttpTransport`. - Cards show the cover when the fake server returns one and the placeholder on 404. - Editing names sends the PUT and the search then finds the soundtrack by its new name. ## Question - Should editing names need some kind of "admin" step, or may every user of the app change them?
Sansan added the feature label 2026-10-09 16:06:05 +02:00
Sign in to join this conversation.