Statistics: switch between soundtracks and a list of all songs #47

Closed
opened 2026-10-09 16:06:04 +02:00 by Sansan · 1 comment
Owner

Add a switch in the statistics view to show all songs instead of the soundtrack cards: a list of every song with its soundtrack. The list can be searched, filtered and sorted like the cards.

Feasibility

Yes, client only. MusicServerClient.fetch_soundtrack_statistics already returns every soundtrack with its songs (SoundtrackWithSongs.songs: Array[SongInfoForStats]), so the songs mode needs no new endpoint.

Plan

  • Switch. statistics/StatisticsView.tscn: a Soundtracks / Songs switch in the toolbar, next to the show and sort menus, e.g. two TabButton-styled buttons in a ButtonGroup or a CheckButton.
  • Songs list.
    • A new SongStatsList scene shown instead of CardGrid in songs mode.
    • It's a ScrollContainer with one row per song: song name, soundtrack name (dimmer), times played and last played, if the server sends it for songs (check SongInfoForStats).
    • Rows use ListRowEven/ListRowOdd, like the other lists.
    • With thousands of songs, building every row is slow. Build rows once and only toggle visible on filter, like the cards. If it is still slow, only make the rows that are on screen.
  • Search. Matches the song name and the soundtrack name (reuse SoundtrackSearch, which has the loose "lttp" matching), with the matching letters highlighted like in the Search popup.
  • Show filter. All / Played / Never played, on the song's times_played.
  • Sort.
    • A–Z and Z–A by song name.
    • Most played and least played.
    • Maybe also "By soundtrack".
  • Click. Clicking a row opens SoundtrackStatsPopup for its soundtrack.
  • Count label. "%d of %d songs".
  • Remember the choice. The chosen mode is remembered for the session (or saved in settings.cfg under [app]).

Tests

  • Switching modes shows and hides the right container.
  • Search finds songs by song name and by soundtrack name.
  • Filter and sort give the right order (unit test the comparison, like _comes_before).

Question

  • Should the song list show "last played" per song? Only if the server already sends it per song; otherwise it's a small MusicServer change.
Add a switch in the statistics view to show all songs instead of the soundtrack cards: a list of every song with its soundtrack. The list can be searched, filtered and sorted like the cards. ## Feasibility Yes, client only. `MusicServerClient.fetch_soundtrack_statistics` already returns every soundtrack with its songs (`SoundtrackWithSongs.songs: Array[SongInfoForStats]`), so the songs mode needs no new endpoint. ## Plan - **Switch.** `statistics/StatisticsView.tscn`: a Soundtracks / Songs switch in the toolbar, next to the show and sort menus, e.g. two `TabButton`-styled buttons in a ButtonGroup or a CheckButton. - **Songs list.** - A new `SongStatsList` scene shown instead of `CardGrid` in songs mode. - It's a ScrollContainer with one row per song: song name, soundtrack name (dimmer), times played and last played, if the server sends it for songs (check `SongInfoForStats`). - Rows use `ListRowEven`/`ListRowOdd`, like the other lists. - With thousands of songs, building every row is slow. Build rows once and only toggle `visible` on filter, like the cards. If it is still slow, only make the rows that are on screen. - **Search.** Matches the song name and the soundtrack name (reuse `SoundtrackSearch`, which has the loose "lttp" matching), with the matching letters highlighted like in the Search popup. - **Show filter.** All / Played / Never played, on the song's `times_played`. - **Sort.** - A–Z and Z–A by song name. - Most played and least played. - Maybe also "By soundtrack". - **Click.** Clicking a row opens `SoundtrackStatsPopup` for its soundtrack. - **Count label.** "%d of %d songs". - **Remember the choice.** The chosen mode is remembered for the session (or saved in `settings.cfg` under `[app]`). ## Tests - Switching modes shows and hides the right container. - Search finds songs by song name and by soundtrack name. - Filter and sort give the right order (unit test the comparison, like `_comes_before`). ## Question - Should the song list show "last played" per song? Only if the server already sends it per song; otherwise it's a small MusicServer change.
Sansan added the feature label 2026-10-09 16:06:04 +02:00
Sansan added this to the 2.0.0 milestone 2026-10-09 17:49:01 +02:00
Author
Owner

Done in a4e6da4 and 84e137e on develop. The song list only shows played songs, and there is no last played column, since the server doesn't send that per song.

Done in a4e6da4 and 84e137e on develop. The song list only shows played songs, and there is no last played column, since the server doesn't send that per song.
Sign in to join this conversation.