Files
MusicPlayer/popups/UploadPopup.tscn
T
SansanandClaude Opus 5.5 c86dacb890
Build / test (pull_request) Successful in 2m3s
Build / build (pull_request) Skipped
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>
2026-10-15 21:43:59 +02:00

123 lines
3.4 KiB
Plaintext

[gd_scene format=3]
[ext_resource type="Script" path="res://popups/upload_popup.gd" id="popup_script"]
[node name="UploadPopup" type="Control" node_paths=PackedStringArray("panel")]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("popup_script")
panel = NodePath("UploadPanel")
[node name="UploadPanel" type="Panel" parent="."]
unique_name_in_owner = true
layout_mode = 0
offset_right = 760.0
offset_bottom = 680.0
theme_type_variation = &"PopupBackground"
[node name="Rows" type="VBoxContainer" parent="UploadPanel"]
layout_mode = 0
offset_left = 24.0
offset_top = 16.0
offset_right = 736.0
offset_bottom = 664.0
theme_override_constants/separation = 10
[node name="TitleLabel" type="Label" parent="UploadPanel/Rows"]
layout_mode = 2
theme_type_variation = &"Title"
text = "Add a soundtrack"
horizontal_alignment = 1
[node name="HelpLabel" type="Label" parent="UploadPanel/Rows"]
layout_mode = 2
autowrap_mode = 3
text = "The songs are uploaded to the server, which adds them as a new soundtrack right away. Songs in disc folders are added too, with the disc's number first."
[node name="NameRow" type="HBoxContainer" parent="UploadPanel/Rows"]
layout_mode = 2
theme_override_constants/separation = 10
[node name="NameTitle" type="Label" parent="UploadPanel/Rows/NameRow"]
layout_mode = 2
theme_type_variation = &"SettingsRowLabel"
text = "Name"
[node name="NameField" type="LineEdit" parent="UploadPanel/Rows/NameRow"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
placeholder_text = "Soundtrack name"
max_length = 200
[node name="ChooseFolderButton" type="Button" parent="UploadPanel/Rows/NameRow"]
unique_name_in_owner = true
layout_mode = 2
focus_mode = 0
text = "Other folder…"
[node name="FolderLabel" type="Label" parent="UploadPanel/Rows"]
unique_name_in_owner = true
layout_mode = 2
theme_type_variation = &"TextMedium"
text_overrun_behavior = 3
[node name="SongScroll" type="ScrollContainer" parent="UploadPanel/Rows"]
layout_mode = 2
size_flags_vertical = 3
horizontal_scroll_mode = 0
[node name="SongList" type="VBoxContainer" parent="UploadPanel/Rows/SongScroll"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
[node name="SummaryLabel" type="Label" parent="UploadPanel/Rows"]
unique_name_in_owner = true
layout_mode = 2
autowrap_mode = 3
[node name="UploadProgress" type="ProgressBar" parent="UploadPanel/Rows"]
unique_name_in_owner = true
visible = false
layout_mode = 2
show_percentage = false
[node name="StatusLabel" type="Label" parent="UploadPanel/Rows"]
unique_name_in_owner = true
visible = false
layout_mode = 2
theme_type_variation = &"HighlightMedium"
autowrap_mode = 3
[node name="Buttons" type="HBoxContainer" parent="UploadPanel/Rows"]
layout_mode = 2
theme_override_constants/separation = 12
alignment = 2
[node name="CancelButton" type="Button" parent="UploadPanel/Rows/Buttons"]
unique_name_in_owner = true
layout_mode = 2
focus_mode = 0
text = "Cancel"
[node name="UploadButton" type="Button" parent="UploadPanel/Rows/Buttons"]
unique_name_in_owner = true
layout_mode = 2
focus_mode = 0
text = "Upload"
[node name="FolderDialog" type="FileDialog" parent="."]
unique_name_in_owner = true
title = "Choose a soundtrack folder"
initial_position = 2
size = Vector2i(800, 500)
ok_button_text = "Select Current Folder"
file_mode = 2
access = 2
use_native_dialog = true