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:
1 parent
0fc3be79e1
commit
a735c515bf
20 files changed
+1325
-327
No files matched your search
@@ -50,6 +50,49 @@ focus_mode = 0
|
||||
action_mode = 0
|
||||
text = "Hide next track"
|
||||
|
||||
[node name="ShortSongsCheckButton" type="CheckButton" parent="CardPanel/VBox"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
tooltip_text = "Play only a part of each song, from a random point, so more songs fit in a game"
|
||||
focus_mode = 0
|
||||
action_mode = 0
|
||||
text = "Short songs"
|
||||
|
||||
[node name="ShortSongSecondsRow" type="HBoxContainer" parent="CardPanel/VBox"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Title" type="Label" parent="CardPanel/VBox/ShortSongSecondsRow"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_type_variation = &"SettingsRowLabel"
|
||||
text = "Seconds per song"
|
||||
|
||||
[node name="ShortSongSecondsLabel" type="Label" parent="CardPanel/VBox/ShortSongSecondsRow"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(48, 0)
|
||||
layout_mode = 2
|
||||
text = "30"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="LowerShortSongSecondsButton" type="Button" parent="CardPanel/VBox/ShortSongSecondsRow"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(30, 0)
|
||||
layout_mode = 2
|
||||
focus_mode = 0
|
||||
action_mode = 0
|
||||
theme_type_variation = &"StepButton"
|
||||
text = "-5"
|
||||
|
||||
[node name="IncreaseShortSongSecondsButton" type="Button" parent="CardPanel/VBox/ShortSongSecondsRow"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(30, 0)
|
||||
layout_mode = 2
|
||||
focus_mode = 0
|
||||
action_mode = 0
|
||||
theme_type_variation = &"StepButton"
|
||||
text = "+5"
|
||||
|
||||
[node name="HideBeginningCheckButton" type="CheckButton" parent="CardPanel/VBox"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
||||
@@ -13,6 +13,10 @@ extends BasePopup
|
||||
|
||||
## The most seconds of a song's beginning that can be hidden.
|
||||
const MAX_HIDE_SECONDS: float = 10.0
|
||||
## The shortest and longest part of a song that Short songs plays, and the step between.
|
||||
const MIN_SHORT_SONG_SECONDS: int = 10
|
||||
const MAX_SHORT_SONG_SECONDS: int = 120
|
||||
const SHORT_SONG_STEP: int = 5
|
||||
## Space between the rows and the card's edges.
|
||||
const PADDING: Vector2 = Vector2(16, 12)
|
||||
|
||||
@@ -21,6 +25,11 @@ const PADDING: Vector2 = Vector2(16, 12)
|
||||
@onready var auto_repeat_button: CheckButton = %AutoRepeatCheckButton
|
||||
@onready var stop_after_current_button: CheckButton = %StopAfterCurrentCheckButton
|
||||
@onready var hide_next_track_button: CheckButton = %HideNextTrackCheckButton
|
||||
@onready var short_songs_button: CheckButton = %ShortSongsCheckButton
|
||||
@onready var short_song_seconds_row: HBoxContainer = %ShortSongSecondsRow
|
||||
@onready var short_song_seconds_label: Label = %ShortSongSecondsLabel
|
||||
@onready var lower_short_song_seconds_button: Button = %LowerShortSongSecondsButton
|
||||
@onready var increase_short_song_seconds_button: Button = %IncreaseShortSongSecondsButton
|
||||
@onready var hide_beginning_button: CheckButton = %HideBeginningCheckButton
|
||||
@onready var hide_for_seconds_row: HBoxContainer = %HideForSecondsRow
|
||||
@onready var hide_for_seconds_label: Label = %HideForSecondsLabel
|
||||
@@ -41,6 +50,11 @@ func _ready() -> void:
|
||||
auto_repeat_button.toggled.connect(_save_toggle.bind(&"auto_repeat_song"))
|
||||
stop_after_current_button.toggled.connect(_save_toggle.bind(&"stop_after_current"))
|
||||
hide_next_track_button.toggled.connect(_save_toggle.bind(&"hide_next_track"))
|
||||
short_songs_button.toggled.connect(_on_short_songs_toggled)
|
||||
lower_short_song_seconds_button.pressed.connect(
|
||||
set_short_song_seconds.bind(-SHORT_SONG_STEP, true))
|
||||
increase_short_song_seconds_button.pressed.connect(
|
||||
set_short_song_seconds.bind(SHORT_SONG_STEP, true))
|
||||
hide_beginning_button.toggled.connect(_on_hide_beginning_toggled)
|
||||
hide_length_button.toggled.connect(_save_toggle.bind(&"hide_length"))
|
||||
hide_ticks_button.toggled.connect(_save_toggle.bind(&"hide_ticks"))
|
||||
@@ -60,6 +74,9 @@ func show_settings() -> void:
|
||||
auto_repeat_button.set_pressed_no_signal(Settings.auto_repeat_song)
|
||||
stop_after_current_button.set_pressed_no_signal(Settings.stop_after_current)
|
||||
hide_next_track_button.set_pressed_no_signal(Settings.hide_next_track)
|
||||
short_songs_button.set_pressed_no_signal(Settings.short_songs)
|
||||
short_song_seconds_row.visible = Settings.short_songs
|
||||
short_song_seconds_label.text = str(Settings.short_song_seconds)
|
||||
hide_beginning_button.set_pressed_no_signal(Settings.hide_beginning)
|
||||
hide_length_button.set_pressed_no_signal(Settings.hide_length)
|
||||
hide_ticks_button.set_pressed_no_signal(Settings.hide_ticks)
|
||||
@@ -117,6 +134,23 @@ func _save_toggle(on: bool, setting: StringName) -> void:
|
||||
Settings.save_settings()
|
||||
|
||||
|
||||
## Sets how many seconds of each song Short songs plays, between
|
||||
## [constant MIN_SHORT_SONG_SECONDS] and [constant MAX_SHORT_SONG_SECONDS]. With
|
||||
## [param relative] the seconds are added to the current length.
|
||||
func set_short_song_seconds(seconds: int, relative: bool = false) -> void:
|
||||
var length: int = Settings.short_song_seconds + seconds if relative else seconds
|
||||
Settings.short_song_seconds = clampi(length, MIN_SHORT_SONG_SECONDS,
|
||||
MAX_SHORT_SONG_SECONDS)
|
||||
short_song_seconds_label.text = str(Settings.short_song_seconds)
|
||||
Settings.save_settings()
|
||||
|
||||
|
||||
func _on_short_songs_toggled(on: bool) -> void:
|
||||
_save_toggle(on, &"short_songs")
|
||||
short_song_seconds_row.visible = on
|
||||
_fit_to_rows()
|
||||
|
||||
|
||||
func _on_hide_beginning_toggled(on: bool) -> void:
|
||||
_save_toggle(on, &"hide_beginning")
|
||||
hide_for_seconds_row.visible = on
|
||||
|
||||
+1
-1
@@ -122,7 +122,7 @@ func _download_random_song(new_song_object: SongObject) -> void:
|
||||
return
|
||||
Playlist.store_song(new_song_object, body)
|
||||
_add_song_to_queue(new_song_object)
|
||||
MusicServerClient.fetch_random_song(Settings.use_low_played_mode, song_downloaded,
|
||||
MusicServerClient.fetch_random_song(Settings.random_mode, song_downloaded,
|
||||
_retry_later.bind(_download_random_song.bind(new_song_object)))
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user