mirror of
https://github.com/MrPatben8/konduktor.git
synced 2026-11-27 10:22:51 +01:00
Added warning for Rekordbox Library exports
This commit is contained in:
1 parent
4b9716d47a
commit
3a9dc90344
6 files changed
+25
No files matched your search
@@ -114,6 +114,8 @@ class RekordboxExporter:
|
|||||||
#: A COMPUTER library (master.db), which Rekordbox never reads from a stick —
|
#: A COMPUTER library (master.db), which Rekordbox never reads from a stick —
|
||||||
#: named so, beside "Rekordbox Export" (the stick's Device Library).
|
#: named so, beside "Rekordbox Export" (the stick's Device Library).
|
||||||
display_name = "Rekordbox Library"
|
display_name = "Rekordbox Library"
|
||||||
|
#: Rekordbox opens a master.db only from its own library folder.
|
||||||
|
computer_only = True
|
||||||
library_filename = "master.db"
|
library_filename = "master.db"
|
||||||
drive_root = False
|
drive_root = False
|
||||||
|
|
||||||
|
|||||||
@@ -216,6 +216,9 @@ class PlatformOption(BaseModel):
|
|||||||
removable: bool = False
|
removable: bool = False
|
||||||
#: As an export TARGET: its library is only found at a drive's root.
|
#: As an export TARGET: its library is only found at a drive's root.
|
||||||
drive_root: bool = False
|
drive_root: bool = False
|
||||||
|
#: As an export TARGET: its library is only ever read on a computer, never
|
||||||
|
#: from a drive — so it does nothing beside a stick format.
|
||||||
|
computer_only: bool = False
|
||||||
|
|
||||||
|
|
||||||
class RemapSample(BaseModel):
|
class RemapSample(BaseModel):
|
||||||
|
|||||||
@@ -633,6 +633,7 @@ def export_targets() -> list[PlatformOption]:
|
|||||||
found=0,
|
found=0,
|
||||||
removable=bool(getattr(d, "removable", False)),
|
removable=bool(getattr(d, "removable", False)),
|
||||||
drive_root=bool(getattr(exporter, "drive_root", False)),
|
drive_root=bool(getattr(exporter, "drive_root", False)),
|
||||||
|
computer_only=bool(getattr(exporter, "computer_only", False)),
|
||||||
))
|
))
|
||||||
# Targets with no reader of their own (the stick's legacy Device Library):
|
# Targets with no reader of their own (the stick's legacy Device Library):
|
||||||
# listed too, or registering one would not make it selectable.
|
# listed too, or registering one would not make it selectable.
|
||||||
@@ -650,6 +651,7 @@ def export_targets() -> list[PlatformOption]:
|
|||||||
found=0,
|
found=0,
|
||||||
removable=bool(getattr(exporter, "drive_root", False)),
|
removable=bool(getattr(exporter, "drive_root", False)),
|
||||||
drive_root=bool(getattr(exporter, "drive_root", False)),
|
drive_root=bool(getattr(exporter, "drive_root", False)),
|
||||||
|
computer_only=bool(getattr(exporter, "computer_only", False)),
|
||||||
))
|
))
|
||||||
# Each exporter states its own place; a platform with no exporter (not yet a
|
# Each exporter states its own place; a platform with no exporter (not yet a
|
||||||
# target, shown disabled) goes last. Stable, so equal places keep their order.
|
# target, shown disabled) goes last. Stable, so equal places keep their order.
|
||||||
|
|||||||
@@ -223,6 +223,10 @@ from konduktor.main import app # noqa: E402
|
|||||||
names = [o["name"] for o in TestClient(app).get("/api/export-targets").json()]
|
names = [o["name"] for o in TestClient(app).get("/api/export-targets").json()]
|
||||||
check("OneLibrary, Traktor, Rekordbox Export, Rekordbox Library",
|
check("OneLibrary, Traktor, Rekordbox Export, Rekordbox Library",
|
||||||
names[:4] == ["OneLibrary", "Traktor", "Rekordbox Export", "Rekordbox Library"], names)
|
names[:4] == ["OneLibrary", "Traktor", "Rekordbox Export", "Rekordbox Library"], names)
|
||||||
|
flags = {o["name"]: o for o in TestClient(app).get("/api/export-targets").json()}
|
||||||
|
check("Rekordbox Library says it is computer-only (the dialog warns beside a stick format)",
|
||||||
|
flags["Rekordbox Library"]["computer_only"] and not flags["Rekordbox Export"]["computer_only"]
|
||||||
|
and flags["Rekordbox Export"]["drive_root"])
|
||||||
|
|
||||||
print("\n" + ("❌ FAILED" if failed else "✅ PASSED"))
|
print("\n" + ("❌ FAILED" if failed else "✅ PASSED"))
|
||||||
raise SystemExit(1 if failed else 0)
|
raise SystemExit(1 if failed else 0)
|
||||||
@@ -279,6 +279,8 @@ export interface PlatformOption {
|
|||||||
removable: boolean
|
removable: boolean
|
||||||
/** As an export target: its library is only found at a drive's ROOT. */
|
/** As an export target: its library is only found at a drive's ROOT. */
|
||||||
drive_root?: boolean
|
drive_root?: boolean
|
||||||
|
/** As an export target: only ever read on a computer, never from a drive. */
|
||||||
|
computer_only?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface EditState {
|
export interface EditState {
|
||||||
|
|||||||
@@ -57,6 +57,11 @@ export function ExportDialog({ editing, onClose, onSaved, onError }: Props) {
|
|||||||
const needsRoot = (targets.data ?? []).filter(
|
const needsRoot = (targets.data ?? []).filter(
|
||||||
(p) => p.drive_root && chosen.includes(p.platform),
|
(p) => p.drive_root && chosen.includes(p.platform),
|
||||||
)
|
)
|
||||||
|
// A computer-only library ticked beside a stick format: harmless, but it does
|
||||||
|
// nothing on the stick, which is easy to mistake for a broken export.
|
||||||
|
const computerOnly = (targets.data ?? []).filter(
|
||||||
|
(p) => p.computer_only && chosen.includes(p.platform),
|
||||||
|
)
|
||||||
|
|
||||||
const toggle = (platform: string, on: boolean) =>
|
const toggle = (platform: string, on: boolean) =>
|
||||||
setChosen((prev) =>
|
setChosen((prev) =>
|
||||||
@@ -138,6 +143,13 @@ export function ExportDialog({ editing, onClose, onSaved, onError }: Props) {
|
|||||||
</label>
|
</label>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
{computerOnly.length > 0 && needsRoot.length > 0 && (
|
||||||
|
<div className="mt-2 rounded well px-3 py-2 text-xs text-gold">
|
||||||
|
{computerOnly.map((p) => p.name).join(' and ')} is only read on a computer, never
|
||||||
|
from a USB drive, so it adds nothing to {needsRoot.map((p) => p.name).join(' and ')}.
|
||||||
|
It replaces a collection on this computer and only works on this machine.
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
Reference in new issue
Block a user