Let the user add a soundtrack from the app by picking a folder or dragging one onto the window. The songs are uploaded to the server, which creates the folder and adds them to the database right away, without waiting for a sync.
FileDialog in folder mode (already used for the music folder);
get_window().files_dropped for drag and drop. It gives the dropped paths on Windows, macOS and Linux (X11 and Wayland).
Server. It can sync a single folder already. #33 adds the upload endpoints.
Plan
Entry points.
An "Add soundtrack…" button, in the Sync popup or the statistics toolbar.
Dropping a folder anywhere on the main window opens the same popup with it.
Upload popup (new BasePopup):
The soundtrack name, filled in from the folder name and editable.
The list of songs found. Reuse MusicFolder._songs_in and AudioFile.is_playable so only playable files are listed.
Total size.
Upload / Cancel buttons.
Uploading.
The calls: start_upload(name) → upload_file(id, name, bytes) per song → finish_upload(id), with cancel_upload(id) on cancel or error.
One song at a time, with a progress bar ("12 of 30 songs").
A failed song is retried a couple of times before the upload is cancelled.
Transport.
HttpTransport needs a way to send a raw PackedByteArray body (HTTPRequest.request_raw) with a PUT.
Big files are read one at a time, so memory stays at one song.
Afterwards. Refresh the inspiration list, the search and the statistics, so the new soundtrack shows up.
Disabled:
while syncing (Settings.currently_syncing), and the server refuses too;
in offline mode.
Errors. Show the server's error: name taken, file too big, not a song.
Tests
With FakeHttpTransport: the calls happen in the right order with the right bodies; a failure cancels the upload; the lists refresh at the end.
Dropping a folder opens the popup with its songs. Simulate by calling the files_dropped handler.
Hidden and non-audio files are left out.
Questions
Where should the button live: the Sync popup, the statistics view, or the top bar?
Dropping a folder with subfolders (e.g. several soundtracks): add each subfolder as its own soundtrack, or treat it as one soundtrack with discs?
Let the user add a soundtrack from the app by picking a folder or dragging one onto the window. The songs are uploaded to the server, which creates the folder and adds them to the database right away, without waiting for a sync.
Needs the upload API: Sansan/MusicServer#33.
## Feasibility
Yes.
- **Godot.** It has what the app needs:
- `FileDialog` in folder mode (already used for the music folder);
- `get_window().files_dropped` for drag and drop. It gives the dropped paths on Windows, macOS and Linux (X11 and Wayland).
- **Server.** It can sync a single folder already. #33 adds the upload endpoints.
## Plan
- **Entry points.**
- An "Add soundtrack…" button, in the Sync popup or the statistics toolbar.
- Dropping a folder anywhere on the main window opens the same popup with it.
- **Upload popup (new `BasePopup`):**
- The soundtrack name, filled in from the folder name and editable.
- The list of songs found. Reuse `MusicFolder._songs_in` and `AudioFile.is_playable` so only playable files are listed.
- Total size.
- Upload / Cancel buttons.
- **Uploading.**
- The calls: `start_upload(name)` → `upload_file(id, name, bytes)` per song → `finish_upload(id)`, with `cancel_upload(id)` on cancel or error.
- One song at a time, with a progress bar ("12 of 30 songs").
- A failed song is retried a couple of times before the upload is cancelled.
- **Transport.**
- `HttpTransport` needs a way to send a raw `PackedByteArray` body (`HTTPRequest.request_raw`) with a PUT.
- Big files are read one at a time, so memory stays at one song.
- **Afterwards.** Refresh the inspiration list, the search and the statistics, so the new soundtrack shows up.
- **Disabled:**
- while syncing (`Settings.currently_syncing`), and the server refuses too;
- in offline mode.
- **Errors.** Show the server's error: name taken, file too big, not a song.
## Tests
- With `FakeHttpTransport`: the calls happen in the right order with the right bodies; a failure cancels the upload; the lists refresh at the end.
- Dropping a folder opens the popup with its songs. Simulate by calling the `files_dropped` handler.
- Hidden and non-audio files are left out.
## Questions
- Where should the button live: the Sync popup, the statistics view, or the top bar?
- Dropping a folder with subfolders (e.g. several soundtracks): add each subfolder as its own soundtrack, or treat it as one soundtrack with discs?
Sansan
added the feature label 2026-10-09 16:06:06 +02:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Let the user add a soundtrack from the app by picking a folder or dragging one onto the window. The songs are uploaded to the server, which creates the folder and adds them to the database right away, without waiting for a sync.
Needs the upload API: Sansan/MusicServer#33.
Feasibility
Yes.
FileDialogin folder mode (already used for the music folder);get_window().files_droppedfor drag and drop. It gives the dropped paths on Windows, macOS and Linux (X11 and Wayland).Plan
BasePopup):MusicFolder._songs_inandAudioFile.is_playableso only playable files are listed.start_upload(name)→upload_file(id, name, bytes)per song →finish_upload(id), withcancel_upload(id)on cancel or error.HttpTransportneeds a way to send a rawPackedByteArraybody (HTTPRequest.request_raw) with a PUT.Settings.currently_syncing), and the server refuses too;Tests
FakeHttpTransport: the calls happen in the right order with the right bodies; a failure cancels the upload; the lists refresh at the end.files_droppedhandler.Questions