Add a soundtrack by picking or dropping a folder (#50)
"Add soundtrack…" in the statistics toolbar, or a folder dropped anywhere on the window, opens a popup that lists the folder's songs and uploads them to the server, which adds the soundtrack at once (Sansan/MusicServer#33). - The name comes from the folder and can be changed; characters the server refuses are replaced. - Only MP3s are uploaded, as the server takes no other; other song files are listed greyed out as left out. Hidden files are skipped. - Disc folders are flattened with the disc's number first ("1-01 Title.mp3"), as the server wants one folder. With one disc folder, names stay as they are. - Songs are sent one at a time with a progress bar, reading one file at a time. A failed song is sent again twice, then the upload is cancelled and the server's reason shown. Closing the popup cancels it too. - Not offered while the server syncs, offline, or without MP3s. - Afterwards search, the inspiration list and the statistics reload. The API types come from the server's spec (Upload, UploadFile, UploadRequest). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f39865fffc
commit
c86dacb890
25 files changed
+3306
-4314
No files matched your search
@@ -107,6 +107,17 @@ popup/item_2/id = 2
|
||||
popup/item_3/text = "Least played"
|
||||
popup/item_3/id = 3
|
||||
|
||||
[node name="AddSeparator" type="VSeparator" parent="Toolbar"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="AddSoundtrackButton" type="Button" parent="Toolbar"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
tooltip_text = "Upload a folder of songs to the server as a new soundtrack.
|
||||
You can also drop a folder anywhere on the window."
|
||||
focus_mode = 0
|
||||
text = "Add soundtrack…"
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="." unique_id=1212000010]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
|
||||
@@ -11,6 +11,8 @@ extends Panel
|
||||
|
||||
## Emitted when a card is clicked, to show all songs of [param soundtrack].
|
||||
signal soundtrack_selected(soundtrack: SoundtrackWithSongs)
|
||||
## Emitted when Add soundtrack… is pressed.
|
||||
signal add_soundtrack_pressed
|
||||
|
||||
## The orders the cards can be sorted in, in the order of the sort menu.
|
||||
enum SortOrder { A_TO_Z, Z_TO_A, MOST_PLAYED, LEAST_PLAYED }
|
||||
@@ -57,6 +59,7 @@ var _songs_ready: bool = false
|
||||
@onready var soundtracks_mode_button: Button = %SoundtracksModeButton
|
||||
@onready var songs_mode_button: Button = %SongsModeButton
|
||||
@onready var search_delay: Timer = %SearchDelay
|
||||
@onready var add_soundtrack_button: Button = %AddSoundtrackButton
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
@@ -69,6 +72,7 @@ func _ready() -> void:
|
||||
show_option.item_selected.connect(func(_index: int) -> void: apply_filter())
|
||||
sort_option.item_selected.connect(func(_index: int) -> void: apply_sort())
|
||||
retry_button.pressed.connect(refresh)
|
||||
add_soundtrack_button.pressed.connect(add_soundtrack_pressed.emit)
|
||||
retry_button.visible = false
|
||||
# The cards have moved by the end of the frame
|
||||
card_scroll.get_v_scroll_bar().value_changed.connect(
|
||||
|
||||
Reference in new issue
Block a user