Classic mode for picking random songs #51

Closed
opened 2026-10-11 21:44:18 +02:00 by Sansan · 0 comments
Owner

Background

The MusicServer has three ways to pick a random song:

Mode Endpoint How it picks
Normal GET /api/v1/music/rand A random soundtrack, then a random song from it
Low played GET /api/v1/music/rand/low Like normal, but favours soundtracks played less than average
Classic GET /api/v1/music/rand/classic Every song has the same chance, regardless of soundtrack

The game can only use normal and low played today. Settings has an on/off switch for low played (Settings.use_low_played_mode, LowPlayedCheckButton in popups/settings_popup.gd). MusicServerClient.fetch_random_song_classic() already exists but nothing calls it.

What to do

  • Replace the low-played switch with a choice between Normal, Low played and Classic, for example an OptionButton.
  • Store the choice in Settings as one value, an enum, in place of the use_low_played_mode bool.
  • quiz/song_loader.gd picks the endpoint from that value. fetch_random_song and fetch_random_song_classic can become one call that takes the mode.
  • Like low played today, the choice is not saved in settings.cfg.

The server will also start recording which mode was used, for statistics (MusicServer #37).

Acceptance criteria

  • Settings has a Normal / Low played / Classic choice in place of the low-played switch.
  • With Classic chosen, new songs come from /music/rand/classic.
  • Tests cover all three modes in test_song_loader.gd and the settings popup.
## Background The MusicServer has three ways to pick a random song: | Mode | Endpoint | How it picks | |---|---|---| | Normal | `GET /api/v1/music/rand` | A random soundtrack, then a random song from it | | Low played | `GET /api/v1/music/rand/low` | Like normal, but favours soundtracks played less than average | | Classic | `GET /api/v1/music/rand/classic` | Every song has the same chance, regardless of soundtrack | The game can only use normal and low played today. Settings has an on/off switch for low played (`Settings.use_low_played_mode`, `LowPlayedCheckButton` in `popups/settings_popup.gd`). `MusicServerClient.fetch_random_song_classic()` already exists but nothing calls it. ## What to do - Replace the low-played switch with a choice between Normal, Low played and Classic, for example an `OptionButton`. - Store the choice in `Settings` as one value, an enum, in place of the `use_low_played_mode` bool. - `quiz/song_loader.gd` picks the endpoint from that value. `fetch_random_song` and `fetch_random_song_classic` can become one call that takes the mode. - Like low played today, the choice is not saved in `settings.cfg`. The server will also start recording which mode was used, for statistics (MusicServer #37). ## Acceptance criteria - [ ] Settings has a Normal / Low played / Classic choice in place of the low-played switch. - [ ] With Classic chosen, new songs come from `/music/rand/classic`. - [ ] Tests cover all three modes in `test_song_loader.gd` and the settings popup.
Sansan added the improvement label 2026-10-11 21:44:18 +02:00
Sign in to join this conversation.