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 -7
View File
@@ -15,7 +15,7 @@ func before_test() -> void:
Playlist.reset_playlist()
Playlist.is_song_downloading = false
Playlist.number_of_tracks_to_preload = 1
Settings.use_low_played_mode = false
Settings.random_mode = Settings.RandomMode.NORMAL
_server = FakeHttpTransport.new().install()
_server.respond_json("/music/list", [])
_server.respond_bytes("/music/rand", FileAccess.get_file_as_bytes("res://tests/data/short.mp3"))
@@ -79,15 +79,22 @@ func test_fetch_song_keeps_going_until_the_cache_is_full() -> void:
assert_int(_server.count("/music/rand")).is_equal(3)
func test_low_played_mode_uses_its_endpoint() -> void:
Settings.use_low_played_mode = true
_server.respond_bytes("/music/rand/low",
FileAccess.get_file_as_bytes("res://tests/data/short.mp3"))
@warning_ignore("unused_parameter")
func test_each_random_mode_uses_its_endpoint(mode: Settings.RandomMode, path: String,
test_parameters: Array = [
[Settings.RandomMode.NORMAL, "/music/rand"],
[Settings.RandomMode.LOW_PLAYED, "/music/rand/low"],
[Settings.RandomMode.CLASSIC, "/music/rand/classic"],
]) -> void:
Settings.random_mode = mode
_server.respond_bytes(path, FileAccess.get_file_as_bytes("res://tests/data/short.mp3"))
_loader.fetch_song()
assert_int(_server.count("/music/rand/low")).is_equal(1)
assert_int(_server.count("/music/rand")).is_equal(0)
assert_int(_server.count(path)).is_equal(1)
for other: String in ["/music/rand", "/music/rand/low", "/music/rand/classic"]:
if other != path:
assert_int(_server.count(other)).override_failure_message(other).is_equal(0)
func test_fetch_song_if_idle_does_nothing_while_downloading() -> void: