Implemented drag and drop loading

This commit is contained in:
patben8 committed 2026-10-06 23:08:34 +02:00
1 parent 7ba71981c8
commit c87444bda5
12 files changed
+267 -34

No files matched your search

+11 -4
View File
@@ -2445,11 +2445,18 @@ def start_import(body: ImportRequest) -> JobStatus:
folder_name = body.folder_name
if folder_name is None and STATE.source is not None:
folder_name = STATE.source.capabilities().save.library_label
library = STATE.library_id
job = JOBS.submit(
"import",
lambda handle: importer.run(source, dest, plan, handle, folder_name=folder_name),
)
def work(handle):
result = importer.run(
source, dest, plan, handle, folder_name=folder_name, into_playlist=body.into_playlist,
)
# As folder add: an export set is Konduktor's data, updated afterwards.
if body.export_id is not None and library is not None:
exports.add(library, body.export_id, track_ids=result["track_ids"])
return result
job = JOBS.submit("import", work)
return JobStatus(**job.as_dict())
+5
View File
@@ -507,6 +507,11 @@ class ImportRequest(BaseModel):
# Playlists land in a folder named after the drive. Null keeps them at the
# root; the default is filled in from the source's label.
folder_name: str | None = None
# Device tracks dropped on a collection playlist / an export (drag and
# drop): every imported track — and every one the collection already
# holds — goes into it, as folder add does.
into_playlist: str | None = None
export_id: str | None = None
class Drive(BaseModel):