Files
MusicPlayer/statistics/StatisticsView.tscn
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

185 lines
4.8 KiB
Plaintext

[gd_scene format=3]
[ext_resource type="Script" path="res://statistics/statistics_view.gd" id="view_script"]
[ext_resource type="PackedScene" path="res://statistics/SongStatsList.tscn" id="song_list_scene"]
[sub_resource type="ButtonGroup" id="ButtonGroup_mode"]
[node name="StatisticsView" type="Panel" unique_id=1212000001]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = 56.0
grow_horizontal = 2
grow_vertical = 2
theme_type_variation = &"WindowBackground"
script = ExtResource("view_script")
[node name="Toolbar" type="HBoxContainer" parent="." unique_id=1212000002]
layout_mode = 1
anchors_preset = 10
anchor_right = 1.0
offset_left = 32.0
offset_top = 16.0
offset_right = -32.0
offset_bottom = 56.0
grow_horizontal = 2
theme_override_constants/separation = 12
[node name="SoundtracksModeButton" type="Button" parent="Toolbar"]
unique_name_in_owner = true
custom_minimum_size = Vector2(120, 0)
layout_mode = 2
focus_mode = 0
theme_type_variation = &"TabButton"
toggle_mode = true
button_pressed = true
button_group = SubResource("ButtonGroup_mode")
text = "Soundtracks"
[node name="SongsModeButton" type="Button" parent="Toolbar"]
unique_name_in_owner = true
custom_minimum_size = Vector2(120, 0)
layout_mode = 2
focus_mode = 0
theme_type_variation = &"TabButton"
toggle_mode = true
button_group = SubResource("ButtonGroup_mode")
text = "Songs"
[node name="ModeSeparator" type="VSeparator" parent="Toolbar"]
layout_mode = 2
[node name="SearchField" type="LineEdit" parent="Toolbar" unique_id=1212000003]
unique_name_in_owner = true
custom_minimum_size = Vector2(480, 0)
layout_mode = 2
placeholder_text = "Search soundtracks"
clear_button_enabled = true
[node name="ClearButton" type="Button" parent="Toolbar" unique_id=1212000004]
unique_name_in_owner = true
layout_mode = 2
focus_mode = 0
text = "Clear"
[node name="CountLabel" type="Label" parent="Toolbar" unique_id=1212000005]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
horizontal_alignment = 1
[node name="ShowLabel" type="Label" parent="Toolbar" unique_id=1212000006]
layout_mode = 2
text = "Show"
[node name="ShowOption" type="OptionButton" parent="Toolbar" unique_id=1212000007]
unique_name_in_owner = true
custom_minimum_size = Vector2(160, 0)
layout_mode = 2
focus_mode = 0
selected = 0
item_count = 3
popup/item_0/text = "All"
popup/item_0/id = 0
popup/item_1/text = "Played"
popup/item_1/id = 1
popup/item_2/text = "Never played"
popup/item_2/id = 2
[node name="SortLabel" type="Label" parent="Toolbar" unique_id=1212000008]
layout_mode = 2
text = "Sort"
[node name="SortOption" type="OptionButton" parent="Toolbar" unique_id=1212000009]
unique_name_in_owner = true
custom_minimum_size = Vector2(160, 0)
layout_mode = 2
focus_mode = 0
selected = 0
item_count = 4
popup/item_0/text = "A-Z"
popup/item_0/id = 0
popup/item_1/text = "Z-A"
popup/item_1/id = 1
popup/item_2/text = "Most played"
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
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = 32.0
offset_top = 72.0
offset_right = -32.0
offset_bottom = -16.0
grow_horizontal = 2
grow_vertical = 2
horizontal_scroll_mode = 0
[node name="CardGrid" type="GridContainer" parent="ScrollContainer" unique_id=1212000011]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 0
theme_type_variation = &"StatisticsGrid"
columns = 6
[node name="SongList" parent="." instance=ExtResource("song_list_scene")]
unique_name_in_owner = true
visible = false
layout_mode = 1
offset_left = 32.0
offset_top = 72.0
offset_right = -32.0
offset_bottom = -16.0
[node name="SearchDelay" type="Timer" parent="."]
unique_name_in_owner = true
wait_time = 0.15
one_shot = true
[node name="StatusLabel" type="Label" parent="." unique_id=1212000012]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 14
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
offset_top = -40.0
offset_bottom = -4.0
grow_horizontal = 2
grow_vertical = 2
theme_type_variation = &"Title"
horizontal_alignment = 1
[node name="RetryButton" type="Button" parent="." unique_id=1212000013]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -50.0
offset_top = 8.0
offset_right = 50.0
offset_bottom = 48.0
grow_horizontal = 2
grow_vertical = 2
focus_mode = 0
text = "Retry"