Add Short songs and a choice of how random songs are picked (#30, #51)
Build / test (push) Successful in 1m40s
Build / build (push) Successful in 1m28s

Short songs (#30): a quiz settings switch and a Seconds per song row (30 by
default, 10-120 in steps of 5), saved with the quiz settings. Only part of
each quiz song plays, from a random point 10-60% into it, picked once per song
so restart and repeat play the same part. The progress bar, time and seeking
stay within the part, a hidden beginning counts inside it, and its end counts
as the song ending (repeat, stop or go to the next song as set).

Random songs (#51): the low-played switch in Settings is now a Normal / Low
played / Classic choice, stored as Settings.random_mode and not saved.
fetch_random_song(mode) picks /music/rand, /music/rand/low or
/music/rand/classic.

Closes #30
Closes #51

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
SansanandClaude Opus 5.5 committed 2026-10-13 21:21:20 +02:00
1 parent 0fc3be79e1
commit a735c515bf
20 files changed
+1325 -327

No files matched your search

+14 -9
View File
@@ -51,17 +51,22 @@ func fetch_song_list(on_done: Callable, on_failed: Callable = Callable()) -> voi
get_json_list("/music/list", SongInfo, on_done, on_failed)
## Downloads a random song as MP3 bytes. With [param low_played] the server prefers
## soundtracks that have been played the least.
func fetch_random_song(
low_played: bool, on_done: Callable, on_failed: Callable = Callable()) -> void:
get_bytes("/music/rand/low" if low_played else "/music/rand", on_done, on_failed)
## Downloads a random song as MP3 bytes, picked the way [param mode] (a
## [code]Settings.RandomMode[/code]) says: a random soundtrack and then one of its songs,
## the same but preferring soundtracks played less than average, or every song with the
## same chance.
func fetch_random_song(mode: int, on_done: Callable, on_failed: Callable = Callable()) -> void:
get_bytes(random_song_path(mode), on_done, on_failed)
## Downloads a random song as MP3 bytes, picked the way the server did before low played
## mode existed: any soundtrack is as likely as any other.
func fetch_random_song_classic(on_done: Callable, on_failed: Callable = Callable()) -> void:
get_bytes("/music/rand/classic", on_done, on_failed)
## The endpoint for random songs picked the way [param mode] says.
static func random_song_path(mode: int) -> String:
match mode:
Settings.RandomMode.LOW_PLAYED:
return "/music/rand/low"
Settings.RandomMode.CLASSIC:
return "/music/rand/classic"
return "/music/rand"
## Adds the most recently fetched random song to the server playlist.