mirror of
https://github.com/MrPatben8/konduktor.git
synced 2026-11-27 10:22:51 +01:00
Added device file exploration and file importing
This commit is contained in:
1 parent
b9d43dd7ea
commit
bd425f8cd6
18 files changed
+1819
-120
No files matched your search
@@ -60,6 +60,9 @@ def capabilities_for(path: Path, editable_fields: list[str]) -> Capabilities:
|
||||
editable_fields=sorted(editable_fields),
|
||||
media_kinds=["audio", "stem"],
|
||||
removable=True,
|
||||
# `.mp4` covers stem files (`.stem.mp4`). Traktor also reads WMA,
|
||||
# but only on Windows, and a file added on one OS must play on both.
|
||||
audio_formats=[".mp3", ".wav", ".aif", ".aiff", ".flac", ".m4a", ".mp4", ".ogg"],
|
||||
artwork=True,
|
||||
artwork_note=(
|
||||
"Traktor caches its own cover thumbnail, so a replaced image may "
|
||||
|
||||
@@ -20,7 +20,9 @@ from pydantic import BaseModel
|
||||
# "Konduktor cannot write this platform YET" is a roadmap gap the user should
|
||||
# expect to close, whereas "this library is synced with Rekordbox Cloud" is a
|
||||
# permanent refusal protecting their other machines.
|
||||
ReadonlyCause = Literal["platform_incomplete", "cloud_synced"]
|
||||
# `not_in_library` is a folder of loose files being browsed: nothing there is a
|
||||
# library to write to, and the way to edit one is to add it to the collection.
|
||||
ReadonlyCause = Literal["platform_incomplete", "cloud_synced", "not_in_library"]
|
||||
|
||||
CueType = Literal["cue", "fade_in", "fade_out", "load", "loop"]
|
||||
CueRole = Literal["hotcue", "memory"]
|
||||
@@ -61,6 +63,10 @@ class TrackCapabilities(BaseModel):
|
||||
# Tracks can be removed from the library (and so from its playlists). The
|
||||
# audio file is never touched either way.
|
||||
removable: bool = False
|
||||
# The audio files this library can hold, as lower-case suffixes. What a
|
||||
# browsed folder offers to add — a file the library would refuse, or that
|
||||
# the DJ app cannot play, is not worth listing as addable.
|
||||
audio_formats: list[str] = [".mp3", ".wav", ".aif", ".aiff", ".flac", ".m4a"]
|
||||
artwork: bool = False
|
||||
artwork_note: str | None = None
|
||||
|
||||
|
||||
@@ -0,0 +1,200 @@
|
||||
"""A folder of loose audio files, read as if it were a (read-only) library.
|
||||
|
||||
The sidebar's Files trees browse any drive, and selecting a folder shows the
|
||||
audio in it in the ordinary track table and deck. Projecting the folder into the
|
||||
generic `Track` model is what makes that cheap: the table, the deck, the
|
||||
read-only gating and the importer all already speak it, so none of them needs to
|
||||
learn what a folder is.
|
||||
|
||||
Deliberately NOT a registered driver. `can_open()` on "any directory" would make
|
||||
every folder a library to the picker, and the collection picker offering
|
||||
`~/Downloads` as a library is exactly the confusion the registry exists to avoid.
|
||||
This is opened by the folder routes and nothing else.
|
||||
|
||||
Three rules:
|
||||
|
||||
* **This folder only.** Subfolders are not scanned — the tree is how you get to
|
||||
them — so a click on a drive root never walks the whole drive.
|
||||
* **A track id is the file's absolute path.** It is the one identity a loose
|
||||
file has, and it is what the audio route checks a request against.
|
||||
* **Tags are read once per folder state.** Reading tags opens every file, which
|
||||
on a slow stick is the whole cost; the result is cached until the folder's
|
||||
own mtime changes (a file added, removed or renamed).
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import os
|
||||
import threading
|
||||
from pathlib import Path
|
||||
|
||||
from .capabilities import Capabilities, SaveCapabilities, TrackCapabilities
|
||||
from .model import PlaylistNode, Track, TrackCues
|
||||
from .places import is_hidden
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def _first(tags, key: str) -> str | None:
|
||||
try:
|
||||
values = tags.get(key)
|
||||
except (KeyError, ValueError):
|
||||
return None
|
||||
if not values:
|
||||
return None
|
||||
value = str(values[0]).strip()
|
||||
return value or None
|
||||
|
||||
|
||||
def _bpm(tags) -> float | None:
|
||||
raw = _first(tags, "bpm")
|
||||
if raw is None:
|
||||
return None
|
||||
try:
|
||||
bpm = float(raw)
|
||||
except ValueError:
|
||||
return None
|
||||
return bpm if 20 <= bpm <= 400 else None
|
||||
|
||||
|
||||
def read_track(path: Path) -> Track:
|
||||
"""Project one audio file. Never raises: an unreadable tag is an untitled track."""
|
||||
track = Track(id=str(path), title=path.stem, filepath=str(path))
|
||||
try:
|
||||
import mutagen
|
||||
|
||||
audio = mutagen.File(path, easy=True)
|
||||
except Exception: # noqa: BLE001 — a corrupt file must not hide the folder
|
||||
log.debug("could not read tags from %s", path, exc_info=True)
|
||||
return track
|
||||
if audio is None:
|
||||
return track
|
||||
tags = audio.tags or {}
|
||||
track.title = _first(tags, "title") or path.stem
|
||||
track.artist = _first(tags, "artist")
|
||||
track.album = _first(tags, "album")
|
||||
track.genre = _first(tags, "genre")
|
||||
track.label = _first(tags, "organization")
|
||||
track.bpm = _bpm(tags)
|
||||
info = getattr(audio, "info", None)
|
||||
if info is not None:
|
||||
length = getattr(info, "length", None)
|
||||
track.length = int(round(length)) if length else None
|
||||
bitrate = getattr(info, "bitrate", None)
|
||||
track.bitrate = int(bitrate) if bitrate else None
|
||||
# Key is left out on purpose: tagged keys arrive in every notation there is
|
||||
# ("Am", "8A", "1m", "A minor"), and passing one through to a library would
|
||||
# write a string its own analysis never would.
|
||||
return track
|
||||
|
||||
|
||||
def audio_files(folder: Path, formats: list[str]) -> list[Path]:
|
||||
"""The visible audio files directly inside `folder`, sorted by name."""
|
||||
wanted = {f.lower() for f in formats}
|
||||
out: list[Path] = []
|
||||
try:
|
||||
with os.scandir(folder) as it:
|
||||
for entry in it:
|
||||
try:
|
||||
if not entry.is_file() or is_hidden(entry):
|
||||
continue
|
||||
except OSError:
|
||||
continue
|
||||
if Path(entry.name).suffix.lower() in wanted:
|
||||
out.append(Path(entry.path))
|
||||
except OSError:
|
||||
return []
|
||||
return sorted(out, key=lambda p: p.name.lower())
|
||||
|
||||
|
||||
def capabilities_for(folder: Path) -> Capabilities:
|
||||
return Capabilities(
|
||||
platform="folder",
|
||||
writable=False,
|
||||
readonly_cause="not_in_library",
|
||||
tracks=TrackCapabilities(editable_fields=[], artwork=False),
|
||||
save=SaveCapabilities(
|
||||
app_name="Files",
|
||||
library_label=folder.name or str(folder),
|
||||
overwrite_risk="none",
|
||||
history=False,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
class FolderSource:
|
||||
"""The read half of the adapter protocol, over one folder's audio files.
|
||||
|
||||
Only what the table, the deck and the importer ask a source for. There are
|
||||
no commands at all: nothing here can be written, so nothing here pretends
|
||||
it could.
|
||||
"""
|
||||
|
||||
def __init__(self, folder: Path, tracks: list[Track]):
|
||||
self.path = folder
|
||||
self._tracks = tracks
|
||||
self._by_id = {t.id: t for t in tracks}
|
||||
|
||||
@property
|
||||
def tracks(self) -> list[Track]:
|
||||
return self._tracks
|
||||
|
||||
def track(self, track_id: str) -> Track | None:
|
||||
return self._by_id.get(track_id)
|
||||
|
||||
def track_cues(self, track_id: str) -> TrackCues | None:
|
||||
return TrackCues(cues=[], grid_markers=[]) if track_id in self._by_id else None
|
||||
|
||||
def audio_path(self, track_id: str) -> Path | None:
|
||||
return Path(track_id) if track_id in self._by_id else None
|
||||
|
||||
def playlist_tree(self) -> list[PlaylistNode]:
|
||||
return []
|
||||
|
||||
def playlist_tracks(self, node_id: str) -> list[Track] | None:
|
||||
return None
|
||||
|
||||
def capabilities(self) -> Capabilities:
|
||||
return capabilities_for(self.path)
|
||||
|
||||
|
||||
class FolderScanner:
|
||||
"""Scans folders on request, caching each until its contents change.
|
||||
|
||||
Also the gatekeeper for streaming: `source_for_file` answers only for a file
|
||||
found by a scan, so the audio route cannot be used to read an arbitrary path
|
||||
off the disk — only audio the user has browsed to.
|
||||
"""
|
||||
|
||||
def __init__(self) -> None:
|
||||
self._lock = threading.Lock()
|
||||
self._cache: dict[str, tuple[float, tuple[str, ...], FolderSource]] = {}
|
||||
|
||||
def scan(self, folder: Path, formats: list[str]) -> FolderSource:
|
||||
folder = Path(folder)
|
||||
try:
|
||||
mtime = folder.stat().st_mtime
|
||||
except OSError:
|
||||
mtime = -1.0
|
||||
key = str(folder)
|
||||
fmts = tuple(sorted(f.lower() for f in formats))
|
||||
with self._lock:
|
||||
hit = self._cache.get(key)
|
||||
if hit is not None and hit[0] == mtime and hit[1] == fmts:
|
||||
return hit[2]
|
||||
source = FolderSource(folder, [read_track(p) for p in audio_files(folder, formats)])
|
||||
with self._lock:
|
||||
self._cache[key] = (mtime, fmts, source)
|
||||
return source
|
||||
|
||||
def source_for_file(self, track_id: str) -> FolderSource | None:
|
||||
folder = str(Path(track_id).parent)
|
||||
with self._lock:
|
||||
hit = self._cache.get(folder)
|
||||
if hit is None or hit[2].track(track_id) is None:
|
||||
return None
|
||||
return hit[2]
|
||||
|
||||
def clear(self) -> None:
|
||||
with self._lock:
|
||||
self._cache.clear()
|
||||
@@ -168,3 +168,127 @@ def volume_places() -> list[dict]:
|
||||
except OSError:
|
||||
continue
|
||||
return out
|
||||
|
||||
|
||||
# ---- local vs external drives -------------------------------------------------
|
||||
#
|
||||
# Only the boot disk is identifiable everywhere. Whether ANOTHER volume is an
|
||||
# internal SSD or a USB stick needs the OS's own answer, and where that answer is
|
||||
# not available (or not trustworthy — Windows reports most USB SSDs as "fixed")
|
||||
# a volume is filed as EXTERNAL. Guessing "local" wrongly would present a stick
|
||||
# that is about to be unplugged as a permanent home for referenced tracks.
|
||||
|
||||
# Keyed by (path, st_dev): a volume's answer does not change while it is mounted,
|
||||
# and `diskutil` is a subprocess — too slow to run for every drive on every poll.
|
||||
_mac_info_cache: dict[tuple[str, int], dict] = {}
|
||||
|
||||
|
||||
def _mac_info(path: Path) -> dict:
|
||||
import plistlib
|
||||
import subprocess
|
||||
|
||||
try:
|
||||
key = (str(path), path.stat().st_dev)
|
||||
except OSError:
|
||||
return {}
|
||||
if key not in _mac_info_cache:
|
||||
try:
|
||||
out = subprocess.run(
|
||||
["diskutil", "info", "-plist", str(path)],
|
||||
capture_output=True, timeout=5, check=True,
|
||||
).stdout
|
||||
_mac_info_cache[key] = plistlib.loads(out)
|
||||
except (OSError, subprocess.SubprocessError, plistlib.InvalidFileException, ValueError):
|
||||
_mac_info_cache[key] = {}
|
||||
return _mac_info_cache[key]
|
||||
|
||||
|
||||
def is_internal(path: Path) -> bool:
|
||||
"""Whether a non-boot volume is a drive built into this computer."""
|
||||
if sys.platform != "darwin":
|
||||
return False
|
||||
info = _mac_info(path)
|
||||
return (
|
||||
bool(info.get("Internal"))
|
||||
and not info.get("Ejectable")
|
||||
and not info.get("RemovableMediaOrExternalDevice")
|
||||
and not info.get("RemovableMedia")
|
||||
)
|
||||
|
||||
|
||||
def _is_disk_image(path: Path) -> bool:
|
||||
"""A mounted .dmg (an installer, usually) — a mount, but not a drive."""
|
||||
return sys.platform == "darwin" and _mac_info(path).get("BusProtocol") == "Disk Image"
|
||||
|
||||
|
||||
def drives() -> list[dict]:
|
||||
"""Every drive, split into `local` (boot + internal) and `external`.
|
||||
|
||||
The boot disk's path is the filesystem root, not its `/Volumes` alias: on
|
||||
macOS `/Volumes/Macintosh HD` is a link back to `/`, and browsing through it
|
||||
would show every path twice over.
|
||||
"""
|
||||
out: list[dict] = []
|
||||
boot_seen = False
|
||||
for vol in sorted(set(mount_points()), key=lambda p: p.name.lower()):
|
||||
try:
|
||||
if is_boot_volume(vol):
|
||||
if boot_seen:
|
||||
continue
|
||||
boot_seen = True
|
||||
root = Path(vol.anchor) if sys.platform == "win32" else Path("/")
|
||||
out.append({"name": vol.name or str(vol), "path": str(root), "kind": "local"})
|
||||
continue
|
||||
if _is_disk_image(vol):
|
||||
continue
|
||||
kind = "local" if is_internal(vol) else "external"
|
||||
out.append({"name": vol.name or str(vol), "path": str(vol), "kind": kind})
|
||||
except OSError:
|
||||
continue
|
||||
if not boot_seen and sys.platform != "win32":
|
||||
# Linux mounts nothing for the root filesystem under /media.
|
||||
out.insert(0, {"name": "Computer", "path": "/", "kind": "local"})
|
||||
return out
|
||||
|
||||
|
||||
# ---- what a folder listing should show ----------------------------------------
|
||||
|
||||
_UF_HIDDEN = 0x8000 # macOS/BSD `chflags hidden`: /usr, /bin, /Volumes, …
|
||||
_WIN_HIDDEN = 0x2 | 0x4 # FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM
|
||||
|
||||
|
||||
def is_hidden(entry: os.DirEntry | Path) -> bool:
|
||||
"""Whether a file browser should leave this entry out.
|
||||
|
||||
macOS hides its system folders by FLAG, not by name, so a list of names to
|
||||
skip would be both incomplete and wrong on a renamed volume. The flag is what
|
||||
Finder itself reads.
|
||||
"""
|
||||
name = entry.name
|
||||
if name.startswith(".") or is_os_housekeeping(name):
|
||||
return True
|
||||
try:
|
||||
st = entry.stat(follow_symlinks=False) if isinstance(entry, os.DirEntry) else entry.lstat()
|
||||
except OSError:
|
||||
return True
|
||||
if getattr(st, "st_flags", 0) & _UF_HIDDEN:
|
||||
return True
|
||||
if getattr(st, "st_file_attributes", 0) & _WIN_HIDDEN:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def subfolders(path: Path) -> list[Path]:
|
||||
"""The visible folders directly inside `path`, sorted as Finder would."""
|
||||
out: list[Path] = []
|
||||
try:
|
||||
with os.scandir(path) as it:
|
||||
for entry in it:
|
||||
try:
|
||||
if entry.is_dir(follow_symlinks=True) and not is_hidden(entry):
|
||||
out.append(Path(entry.path))
|
||||
except OSError:
|
||||
continue
|
||||
except OSError:
|
||||
return []
|
||||
return sorted(out, key=lambda p: p.name.lower())
|
||||
@@ -11,13 +11,22 @@ already exist when it reaches the destination, because a file copy that failed
|
||||
halfway is not something a library write should be discovering.
|
||||
|
||||
Scope, chosen deliberately: **everything is added as a new entry**. Nothing is
|
||||
matched against tracks the destination already holds, so there is no merge policy
|
||||
and no cross-platform identity problem. Re-importing the same stick duplicates,
|
||||
and a preview warns about that rather than preventing it.
|
||||
matched against tracks the destination already holds by metadata, so there is no
|
||||
merge policy and no cross-platform identity problem. Re-importing the same stick
|
||||
duplicates, and a preview warns about that rather than preventing it.
|
||||
|
||||
The one match that IS made is by **file**: a source file the destination already
|
||||
points at is never added again. Copying never hits that (it writes a fresh
|
||||
path), but **referencing in place** does — the folder browser can add
|
||||
`~/Music/x.mp3` to a collection that already holds it — and on Traktor two
|
||||
entries for one path share a primary key, which is a corrupt collection rather
|
||||
than a duplicate track. Such a file maps to the EXISTING track instead, so a
|
||||
playlist or export it was headed for still gets it.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import os
|
||||
import shutil
|
||||
from dataclasses import dataclass, field
|
||||
from pathlib import Path
|
||||
@@ -46,6 +55,9 @@ class PlannedTrack:
|
||||
# True when the destination already holds a track with this filename. Only a
|
||||
# warning: the user chose "add everything as new entries".
|
||||
duplicate: bool = False
|
||||
# The destination's own id for this exact file, when it already holds it.
|
||||
# Not added again; it stands in for the new id wherever one is needed.
|
||||
existing_id: str | None = None
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -56,7 +68,11 @@ class ImportPlan:
|
||||
|
||||
@property
|
||||
def importable(self) -> list[PlannedTrack]:
|
||||
return [t for t in self.tracks if not t.missing]
|
||||
return [t for t in self.tracks if not t.missing and t.existing_id is None]
|
||||
|
||||
@property
|
||||
def existing(self) -> list[PlannedTrack]:
|
||||
return [t for t in self.tracks if t.existing_id is not None]
|
||||
|
||||
@property
|
||||
def total_bytes(self) -> int:
|
||||
@@ -68,6 +84,7 @@ class ImportPlan:
|
||||
"importable": len(self.importable),
|
||||
"missing": [t.title for t in self.tracks if t.missing],
|
||||
"duplicates": [t.title for t in self.tracks if t.duplicate],
|
||||
"existing": [t.title for t in self.existing],
|
||||
"playlists": [name for _, name in self.playlists],
|
||||
"total_bytes": self.total_bytes,
|
||||
"destination": str(self.destination) if self.destination else None,
|
||||
@@ -88,7 +105,29 @@ def _existing_filenames(dest) -> set[str]:
|
||||
return out
|
||||
|
||||
|
||||
def plan(source, dest, destination: Path, *, track_ids=None, playlist_ids=None) -> ImportPlan:
|
||||
def _key(path: Path) -> str:
|
||||
return os.path.normcase(os.path.normpath(str(path)))
|
||||
|
||||
|
||||
def _existing_files(dest) -> dict[str, str]:
|
||||
"""Every audio file the destination points at → its track id.
|
||||
|
||||
Resolved through the adapter's own `audio_path`, which is the only answer
|
||||
that includes the volume and the active path mapping; the projected
|
||||
`filepath` is a display string and is not good enough to match on.
|
||||
"""
|
||||
out: dict[str, str] = {}
|
||||
for track in dest.tracks:
|
||||
try:
|
||||
path = dest.audio_path(track.id)
|
||||
except Exception: # noqa: BLE001
|
||||
path = None
|
||||
if path is not None:
|
||||
out.setdefault(_key(path), track.id)
|
||||
return out
|
||||
|
||||
|
||||
def plan(source, dest, destination: Path | None, *, track_ids=None, playlist_ids=None) -> ImportPlan:
|
||||
"""Work out what an import would do, WITHOUT doing any of it.
|
||||
|
||||
Computed fresh every time and never stored. Playlist membership on the source
|
||||
@@ -126,6 +165,7 @@ def plan(source, dest, destination: Path, *, track_ids=None, playlist_ids=None)
|
||||
plan.playlists.append((node_id, name))
|
||||
|
||||
existing = _existing_filenames(dest)
|
||||
held = _existing_files(dest)
|
||||
for track_id in wanted:
|
||||
track = source.track(track_id)
|
||||
if track is None:
|
||||
@@ -140,7 +180,8 @@ def plan(source, dest, destination: Path, *, track_ids=None, playlist_ids=None)
|
||||
try:
|
||||
if path is not None and path.is_file():
|
||||
planned.size = path.stat().st_size
|
||||
planned.duplicate = path.name.lower() in existing
|
||||
planned.existing_id = held.get(_key(path))
|
||||
planned.duplicate = planned.existing_id is None and path.name.lower() in existing
|
||||
else:
|
||||
planned.missing = True
|
||||
except OSError:
|
||||
@@ -224,7 +265,16 @@ def copy_file(src: Path, dst: Path, handle: JobHandle, on_bytes) -> None:
|
||||
shutil.copystat(src, dst, follow_symlinks=True)
|
||||
|
||||
|
||||
def run(source, dest, plan: ImportPlan, handle: JobHandle, *, folder_name: str | None = None) -> dict:
|
||||
def run(
|
||||
source,
|
||||
dest,
|
||||
plan: ImportPlan,
|
||||
handle: JobHandle,
|
||||
*,
|
||||
folder_name: str | None = None,
|
||||
reference: bool = False,
|
||||
into_playlist: str | None = None,
|
||||
) -> dict:
|
||||
"""Perform the import. Returns a summary dict for the job result.
|
||||
|
||||
Ordering is the safety property. Audio is copied FIRST and the library is
|
||||
@@ -235,10 +285,16 @@ def run(source, dest, plan: ImportPlan, handle: JobHandle, *, folder_name: str |
|
||||
This is a COMMITTED action — it saves at the end — rather than an in-memory
|
||||
edit the Save button flushes. A multi-gigabyte copy is not a pending tweak,
|
||||
and audio on disk with unsaved entries pointing at it is the worst of both.
|
||||
|
||||
`reference` adds each file WHERE IT IS instead of copying it, so there is no
|
||||
destination and nothing to roll back. `into_playlist` appends every planned
|
||||
track — the new ones and those the destination already held — to one of the
|
||||
destination's playlists before the save, so both land in one commit.
|
||||
"""
|
||||
destination = plan.destination
|
||||
assert destination is not None
|
||||
destination.mkdir(parents=True, exist_ok=True)
|
||||
if not reference:
|
||||
assert destination is not None
|
||||
destination.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
importable = plan.importable
|
||||
total = plan.total_bytes or len(importable)
|
||||
@@ -261,8 +317,11 @@ def run(source, dest, plan: ImportPlan, handle: JobHandle, *, folder_name: str |
|
||||
try:
|
||||
for planned in importable:
|
||||
handle.raise_if_cancelled()
|
||||
handle.progress(message=f"Copying {planned.title}")
|
||||
assert planned.source_path is not None
|
||||
if reference:
|
||||
copied.append((planned, planned.source_path))
|
||||
continue
|
||||
handle.progress(message=f"Copying {planned.title}")
|
||||
target = _unique_target(destination, planned.source_path.name, taken)
|
||||
created.append(target) # registered BEFORE the write, so a cancel
|
||||
copy_file(planned.source_path, target, handle, bump) # mid-file is cleaned
|
||||
@@ -288,6 +347,17 @@ def run(source, dest, plan: ImportPlan, handle: JobHandle, *, folder_name: str |
|
||||
planned.track_id: new_id
|
||||
for (planned, _), new_id in zip(copied, new_ids)
|
||||
}
|
||||
by_source.update({t.track_id: t.existing_id for t in plan.existing})
|
||||
# Every planned track's id in the destination, in plan order.
|
||||
all_ids = [by_source[t.track_id] for t in plan.tracks if t.track_id in by_source]
|
||||
|
||||
if into_playlist is not None:
|
||||
handle.progress(message="Adding to the playlist…")
|
||||
current = dest.playlist_entries(into_playlist) or []
|
||||
have = set(current)
|
||||
dest.set_playlist_entries(
|
||||
into_playlist, current + [i for i in all_ids if i not in have]
|
||||
)
|
||||
|
||||
playlists_made = _rebuild_playlists(
|
||||
source, dest, plan, by_source, folder_name, handle
|
||||
@@ -297,9 +367,11 @@ def run(source, dest, plan: ImportPlan, handle: JobHandle, *, folder_name: str |
|
||||
outcome, _commit = _save(dest)
|
||||
return {
|
||||
"tracks": len(new_ids),
|
||||
"track_ids": all_ids,
|
||||
"already_held": len(plan.existing),
|
||||
"playlists": playlists_made,
|
||||
"skipped_missing": len(plan.tracks) - len(importable),
|
||||
"destination": str(destination),
|
||||
"skipped_missing": len([t for t in plan.tracks if t.missing]),
|
||||
"destination": str(destination) if destination else None,
|
||||
"summary": getattr(outcome, "summary", ""),
|
||||
}
|
||||
except BaseException:
|
||||
|
||||
@@ -20,6 +20,7 @@ from .core import grid_detect, structure
|
||||
from . import importer
|
||||
from .core import export as core_export
|
||||
from .core import places, registry
|
||||
from .core.folder import FolderScanner, FolderSource
|
||||
from .core.adapter import (
|
||||
AdapterError,
|
||||
InvalidCommand,
|
||||
@@ -56,6 +57,9 @@ from .schemas import (
|
||||
ExportSetMembers,
|
||||
ExportSetOut,
|
||||
ExportPreview,
|
||||
Drive,
|
||||
FolderAddRequest,
|
||||
FolderTracks,
|
||||
FsEntry,
|
||||
FsListing,
|
||||
FsPlace,
|
||||
@@ -1402,6 +1406,185 @@ def source_track_audio(track_id: str) -> FileResponse:
|
||||
return FileResponse(path, media_type=mime)
|
||||
|
||||
|
||||
# ---- drives and folders -----------------------------------------------
|
||||
#
|
||||
# The sidebar's Devices and Local Storage trees. Browsing a folder is READ-ONLY
|
||||
# and needs no library of its own: the files are projected as tracks for the
|
||||
# table and deck, and adding them goes through the ordinary importer.
|
||||
|
||||
FOLDERS = FolderScanner()
|
||||
|
||||
|
||||
def _drive_of(path: Path, drives: list[dict]) -> dict | None:
|
||||
"""The drive `path` lives on: the longest drive root that contains it."""
|
||||
best = None
|
||||
for d in drives:
|
||||
root = Path(d["path"])
|
||||
try:
|
||||
path.relative_to(root)
|
||||
except ValueError:
|
||||
continue
|
||||
if best is None or len(root.parts) > len(Path(best["path"]).parts):
|
||||
best = d
|
||||
return best
|
||||
|
||||
|
||||
@app.get("/api/fs/drives", response_model=list[Drive])
|
||||
def fs_drives() -> list[Drive]:
|
||||
"""Every drive, with the OneLibrary library on it where there is one.
|
||||
|
||||
Polled, like `/api/sources`, because drives come and go while the app is
|
||||
open. Cheap after the first call: which drives are internal is cached per
|
||||
mount, since asking the OS is a subprocess on macOS.
|
||||
"""
|
||||
found = places.drives()
|
||||
libraries = sources()
|
||||
out = [Drive(**d) for d in found]
|
||||
externals = [d for d in found if d["path"] != "/"]
|
||||
for lib in libraries:
|
||||
home = _drive_of(Path(lib.path), externals)
|
||||
if home is None:
|
||||
continue
|
||||
for drive in out:
|
||||
if drive.path == home["path"]:
|
||||
drive.library = lib
|
||||
return out
|
||||
|
||||
|
||||
@app.get("/api/fs/folders", response_model=list[FsEntry])
|
||||
def fs_folders(path: str) -> list[FsEntry]:
|
||||
"""The visible folders directly inside `path` — one level of a Files tree."""
|
||||
base = Path(path).expanduser()
|
||||
if not base.is_dir():
|
||||
raise HTTPException(404, f"Not a folder: {base}")
|
||||
return [FsEntry(name=p.name, path=str(p)) for p in places.subfolders(base)]
|
||||
|
||||
|
||||
def _formats() -> list[str]:
|
||||
return require_adapter().capabilities().tracks.audio_formats
|
||||
|
||||
|
||||
@app.get("/api/folder/tracks", response_model=FolderTracks)
|
||||
def folder_tracks(path: str) -> FolderTracks:
|
||||
"""The audio files directly inside a folder, and which are already held."""
|
||||
base = Path(path).expanduser()
|
||||
if not base.is_dir():
|
||||
raise HTTPException(404, f"Not a folder: {base}")
|
||||
source = FOLDERS.scan(base, _formats())
|
||||
held = importer._existing_files(require_adapter())
|
||||
drive = _drive_of(base, places.drives())
|
||||
return FolderTracks(
|
||||
path=str(base),
|
||||
tracks=source.tracks,
|
||||
in_collection=[t.id for t in source.tracks if importer._key(Path(t.id)) in held],
|
||||
removable=drive is None or drive["kind"] == "external",
|
||||
)
|
||||
|
||||
|
||||
def _folder_track(track_id: str) -> FolderSource:
|
||||
# Only a file a scan found. This is what keeps the audio route from being a
|
||||
# way to read any path on the disk.
|
||||
source = FOLDERS.source_for_file(track_id)
|
||||
if source is None:
|
||||
raise HTTPException(404, "Track not found — browse to its folder first")
|
||||
return source
|
||||
|
||||
|
||||
@app.get("/api/folder/capabilities", response_model=Capabilities)
|
||||
def folder_capabilities(path: str) -> Capabilities:
|
||||
from .core.folder import capabilities_for
|
||||
|
||||
return capabilities_for(Path(path))
|
||||
|
||||
|
||||
@app.get("/api/folder/tracks/cues", response_model=TrackCues)
|
||||
def folder_track_cues(track_id: str) -> TrackCues:
|
||||
cues = _folder_track(track_id).track_cues(track_id)
|
||||
assert cues is not None
|
||||
return cues
|
||||
|
||||
|
||||
@app.get("/api/folder/tracks/audio")
|
||||
def folder_track_audio(track_id: str) -> FileResponse:
|
||||
path = _folder_track(track_id).audio_path(track_id)
|
||||
if path is None or not path.is_file():
|
||||
raise HTTPException(404, "Audio file not found")
|
||||
mime = _AUDIO_MIME.get(path.suffix.lower(), "application/octet-stream")
|
||||
return FileResponse(path, media_type=mime)
|
||||
|
||||
|
||||
def _folder_add_plan(body: FolderAddRequest):
|
||||
dest = require_adapter()
|
||||
tracks = []
|
||||
for track_id in body.track_ids:
|
||||
track = _folder_track(track_id).track(track_id)
|
||||
if track is not None:
|
||||
tracks.append(track)
|
||||
if not tracks:
|
||||
raise HTTPException(400, "No tracks to add")
|
||||
# One source across however many folders the ids came from.
|
||||
source = FolderSource(Path(tracks[0].id).parent, tracks)
|
||||
destination = None
|
||||
if body.mode == "copy":
|
||||
if not body.destination:
|
||||
raise HTTPException(400, "Copying needs a destination folder")
|
||||
destination = Path(body.destination).expanduser()
|
||||
if body.playlist_id is not None and dest.playlist_entries(body.playlist_id) is None:
|
||||
raise HTTPException(404, f"Playlist not found: {body.playlist_id}")
|
||||
if body.export_id is not None:
|
||||
if STATE.library_id is None or exports.get(STATE.library_id, body.export_id) is None:
|
||||
raise HTTPException(404, f"Export not found: {body.export_id}")
|
||||
return source, dest, destination, importer.plan(
|
||||
source, dest, destination, track_ids=[t.id for t in tracks]
|
||||
)
|
||||
|
||||
|
||||
@app.post("/api/folder/add/preview")
|
||||
def folder_add_preview(body: FolderAddRequest) -> dict:
|
||||
_source, _dest, destination, plan = _folder_add_plan(body)
|
||||
out = plan.as_dict(free_bytes=importer.free_bytes(destination) if destination else None)
|
||||
if body.mode == "reference":
|
||||
# Nothing is copied, so there is no size to fit anywhere.
|
||||
out.update(total_bytes=0, free_bytes=None, enough_space=None)
|
||||
drive = _drive_of(Path(body.track_ids[0]), places.drives()) if body.track_ids else None
|
||||
out["removable"] = drive is None or drive["kind"] == "external"
|
||||
return out
|
||||
|
||||
|
||||
@app.post("/api/folder/add", response_model=JobStatus)
|
||||
def folder_add(body: FolderAddRequest) -> JobStatus:
|
||||
"""Add browsed files to the collection. A job, like import: copying can be long."""
|
||||
source, dest, destination, plan = _folder_add_plan(body)
|
||||
if not plan.importable and not plan.existing:
|
||||
raise HTTPException(400, "Nothing to add (none of those files exist)")
|
||||
if body.mode == "copy":
|
||||
free = importer.free_bytes(destination)
|
||||
if free is not None and free < plan.total_bytes + importer.SPACE_HEADROOM:
|
||||
raise HTTPException(
|
||||
400,
|
||||
f"Not enough space: {plan.total_bytes / 1e9:.1f} GB needed, "
|
||||
f"{free / 1e9:.1f} GB free at {destination}",
|
||||
)
|
||||
if JOBS.active("import"):
|
||||
raise HTTPException(409, "An import is already running")
|
||||
library = STATE.library_id
|
||||
|
||||
def work(handle):
|
||||
result = importer.run(
|
||||
source, dest, plan, handle,
|
||||
reference=body.mode == "reference",
|
||||
into_playlist=body.playlist_id,
|
||||
)
|
||||
# Export sets are Konduktor's own data, not the library's, so they are
|
||||
# updated after the library has been saved rather than inside it.
|
||||
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())
|
||||
|
||||
|
||||
# ---- import -----------------------------------------------------------
|
||||
#
|
||||
# The only operation in the app that can run for minutes, so it is the only one
|
||||
|
||||
@@ -382,6 +382,47 @@ class ImportRequest(BaseModel):
|
||||
folder_name: str | None = None
|
||||
|
||||
|
||||
class Drive(BaseModel):
|
||||
"""A drive in the sidebar, under Devices (`external`) or Local Storage.
|
||||
|
||||
`library` is the OneLibrary database on it, when there is one — the same
|
||||
candidate `/api/sources` reports, attached to the drive it lives on so the
|
||||
sidebar can show one row per drive rather than a device list and a drive
|
||||
list that disagree about what is plugged in.
|
||||
"""
|
||||
|
||||
name: str
|
||||
path: str
|
||||
kind: Literal["local", "external"]
|
||||
library: SourceCandidate | None = None
|
||||
|
||||
|
||||
class FolderTracks(BaseModel):
|
||||
"""The audio files directly inside one folder, projected as tracks."""
|
||||
|
||||
path: str
|
||||
tracks: list[Track]
|
||||
# Ids (= absolute paths) of the files the collection already points at.
|
||||
in_collection: list[str]
|
||||
# On an external drive: a track referenced in place goes missing when the
|
||||
# drive is unplugged, which the add dialog has to say.
|
||||
removable: bool
|
||||
|
||||
|
||||
class FolderAddRequest(BaseModel):
|
||||
"""Add browsed files to the collection, and optionally to a playlist/export.
|
||||
|
||||
`mode` is asked every time rather than defaulted, because the right answer
|
||||
depends on the drive and on how the DJ keeps their music.
|
||||
"""
|
||||
|
||||
track_ids: list[str]
|
||||
mode: Literal["copy", "reference"]
|
||||
destination: str | None = None # required for `copy`
|
||||
playlist_id: str | None = None
|
||||
export_id: str | None = None
|
||||
|
||||
|
||||
class JobStatus(BaseModel):
|
||||
id: str
|
||||
kind: str
|
||||
|
||||
@@ -6,7 +6,7 @@ cd "$(dirname "${BASH_SOURCE[0]}")"
|
||||
source .venv/bin/activate
|
||||
|
||||
fail=0
|
||||
for t in test_layering.py test_save_fidelity.py test_traktor_adapter.py test_rekordbox_adapter.py test_rekordbox_fidelity.py test_onelibrary_adapter.py test_import.py test_grid_detect.py test_auto_hotcues.py test_grid_batch.py test_bulk_remove.py test_picker.py test_library_id.py test_exports.py test_export.py test_export_pioneer.py test_phase3.py test_history.py; do
|
||||
for t in test_layering.py test_save_fidelity.py test_traktor_adapter.py test_rekordbox_adapter.py test_rekordbox_fidelity.py test_onelibrary_adapter.py test_import.py test_grid_detect.py test_auto_hotcues.py test_grid_batch.py test_bulk_remove.py test_folders.py test_picker.py test_library_id.py test_exports.py test_export.py test_export_pioneer.py test_phase3.py test_history.py; do
|
||||
echo "──────────────────────────────────────────"
|
||||
echo "▶ $t"
|
||||
echo "──────────────────────────────────────────"
|
||||
|
||||
@@ -0,0 +1,203 @@
|
||||
"""Browsing drives and folders, and adding loose files, through the routes.
|
||||
|
||||
Runs on a temp copy of the real collection, a temp app-data dir, and FLAC files
|
||||
generated here — so the tags are known rather than borrowed from a real file.
|
||||
|
||||
Pins the things that would fail SILENTLY or dangerously:
|
||||
|
||||
* a folder lists only the audio DIRECTLY in it, and never hidden or
|
||||
OS-housekeeping files (macOS writes a `._` twin beside every file on FAT);
|
||||
* the audio route streams only files a scan found — it is not a way to read
|
||||
any path on the disk;
|
||||
* a file the collection already points at is never added twice. On Traktor two
|
||||
entries for one path share a primary key, which is a corrupt collection —
|
||||
and that is exactly what "add in place" would do on a second click;
|
||||
* such a file still reaches the playlist or export it was headed for;
|
||||
* "copy" leaves the collection pointing at the COPY, and "reference" at the
|
||||
original, with nothing copied.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
import tempfile
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
import numpy as np
|
||||
import soundfile as sf
|
||||
|
||||
REAL = Path(__file__).resolve().parents[1] / "collection.nml"
|
||||
_DATA = tempfile.TemporaryDirectory()
|
||||
os.environ["KONDUKTOR_DATA_DIR"] = _DATA.name
|
||||
|
||||
failed = False
|
||||
|
||||
|
||||
def check(label, cond, detail=""):
|
||||
global failed
|
||||
print(f" [{'PASS' if cond else 'FAIL'}] {label}" + (f" — {detail}" if detail and not cond else ""))
|
||||
if not cond:
|
||||
failed = True
|
||||
|
||||
|
||||
def flac(path: Path, **tags) -> Path:
|
||||
from mutagen.flac import FLAC
|
||||
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
sf.write(path, np.zeros((44100, 2), dtype="float32"), 44100, format="FLAC")
|
||||
audio = FLAC(path)
|
||||
for k, v in tags.items():
|
||||
audio[k] = str(v)
|
||||
audio.save()
|
||||
return path
|
||||
|
||||
|
||||
# ---- the folder on disk ------------------------------------------------------
|
||||
music = Path(tempfile.mkdtemp()) / "Loose"
|
||||
one = flac(music / "one.flac", title="First Light", artist="Someone", genre="House", bpm=124)
|
||||
two = flac(music / "two.flac") # untagged: titled by its filename
|
||||
flac(music / "Deeper" / "three.flac", title="Not Listed")
|
||||
(music / "notes.txt").write_text("not audio")
|
||||
shutil.copy2(one, music / "._one.flac") # a macOS AppleDouble twin
|
||||
flac(music / ".hidden.flac")
|
||||
(music / ".secret-folder").mkdir()
|
||||
(music / ".Trashes").mkdir()
|
||||
|
||||
work = Path(tempfile.mkdtemp()) / "collection.nml"
|
||||
shutil.copy2(REAL, work)
|
||||
os.environ["KONDUKTOR_NML"] = str(work)
|
||||
|
||||
from fastapi.testclient import TestClient # noqa: E402
|
||||
|
||||
import konduktor.main as main # noqa: E402
|
||||
from konduktor import exports # noqa: E402
|
||||
from konduktor.app_state import STATE # noqa: E402
|
||||
from konduktor.core import places # noqa: E402
|
||||
|
||||
|
||||
def wait(c, job):
|
||||
while job["state"] == "running":
|
||||
time.sleep(0.05)
|
||||
job = c.get(f"/api/jobs/{job['id']}").json()
|
||||
return job
|
||||
|
||||
|
||||
with TestClient(main.app, raise_server_exceptions=False) as c:
|
||||
a = main.require_adapter()
|
||||
before = len(a.tracks)
|
||||
|
||||
print("== drives ==")
|
||||
r = c.get("/api/fs/drives")
|
||||
check("answers 200", r.status_code == 200, r.text[:200])
|
||||
drives = r.json()
|
||||
check("the boot disk is local, at the filesystem root",
|
||||
any(d["kind"] == "local" and d["path"] == "/" for d in drives), str(drives))
|
||||
check("each drive is listed once", len({d["path"] for d in drives}) == len(drives))
|
||||
|
||||
print("== folder tree: visible folders only ==")
|
||||
r = c.get("/api/fs/folders", params={"path": str(music)})
|
||||
names = [e["name"] for e in r.json()]
|
||||
check("lists the subfolder", names == ["Deeper"], str(names))
|
||||
if sys.platform == "darwin":
|
||||
flagged = music / "Flagged"
|
||||
flagged.mkdir()
|
||||
os.chflags(flagged, 0x8000) # UF_HIDDEN, as macOS sets on /usr and /bin
|
||||
names = [e["name"] for e in c.get("/api/fs/folders", params={"path": str(music)}).json()]
|
||||
check("a folder hidden by FLAG is left out, as Finder does", "Flagged" not in names, str(names))
|
||||
check("a missing folder is a 404",
|
||||
c.get("/api/fs/folders", params={"path": str(music / "nope")}).status_code == 404)
|
||||
|
||||
print("== a folder's tracks: this folder only, audio only ==")
|
||||
r = c.get("/api/folder/tracks", params={"path": str(music)})
|
||||
check("answers 200", r.status_code == 200, r.text[:300])
|
||||
body = r.json()
|
||||
ids = [t["id"] for t in body["tracks"]]
|
||||
check("exactly the two visible audio files", ids == [str(one), str(two)], str(ids))
|
||||
first = body["tracks"][0]
|
||||
check("tags are read", (first["title"], first["artist"], first["genre"], first["bpm"])
|
||||
== ("First Light", "Someone", "House", 124.0), str(first))
|
||||
check("an untagged file is titled by its name", body["tracks"][1]["title"] == "two")
|
||||
check("the length comes from the audio", first["length"] == 1, str(first["length"]))
|
||||
check("nothing is in the collection yet", body["in_collection"] == [])
|
||||
caps = c.get("/api/folder/capabilities", params={"path": str(music)}).json()
|
||||
check("the view is read-only, and says why",
|
||||
caps["writable"] is False and caps["readonly_cause"] == "not_in_library")
|
||||
|
||||
print("== the audio route streams only what a scan found ==")
|
||||
r = c.get("/api/folder/tracks/audio", params={"track_id": str(one)})
|
||||
check("a scanned file streams", r.status_code == 200 and len(r.content) > 0)
|
||||
check("an arbitrary file does not",
|
||||
c.get("/api/folder/tracks/audio", params={"track_id": "/etc/passwd"}).status_code == 404)
|
||||
check("nor does real audio in a folder nobody browsed",
|
||||
c.get("/api/folder/tracks/audio",
|
||||
params={"track_id": str(music / "Deeper" / "three.flac")}).status_code == 404)
|
||||
check("nor a hidden file beside a scanned one",
|
||||
c.get("/api/folder/tracks/audio",
|
||||
params={"track_id": str(music / ".hidden.flac")}).status_code == 404)
|
||||
check("cues are empty, not an error",
|
||||
c.get("/api/folder/tracks/cues", params={"track_id": str(one)}).json()["cues"] == [])
|
||||
|
||||
print("== reference in place, into a playlist ==")
|
||||
playlist = a.create_playlist("Folder Test")
|
||||
req = {"track_ids": [str(one)], "mode": "reference", "playlist_id": playlist}
|
||||
p = c.post("/api/folder/add/preview", json=req).json()
|
||||
check("the preview counts one to add", p["importable"] == 1 and p["existing"] == [], str(p))
|
||||
check("and nothing to copy", p["total_bytes"] == 0)
|
||||
job = wait(c, c.post("/api/folder/add", json=req).json())
|
||||
check("the job finishes", job["state"] == "done", str(job))
|
||||
check("one entry was added", len(a.tracks) == before + 1)
|
||||
added = job["result"]["track_ids"][0]
|
||||
check("it points at the ORIGINAL file", a.audio_path(added) == one, str(a.audio_path(added)))
|
||||
check("its tags came with it", a.track(added).title == "First Light")
|
||||
check("it is in the playlist", a.playlist_entries(playlist) == [added])
|
||||
check("it was saved, not left pending", not a.dirty)
|
||||
body = c.get("/api/folder/tracks", params={"path": str(music)}).json()
|
||||
check("the folder now marks it as held", body["in_collection"] == [str(one)], str(body["in_collection"]))
|
||||
|
||||
print("== a held file is never added twice, but still reaches its target ==")
|
||||
library = STATE.library_id
|
||||
eset = exports.create(library, name="Folder Export", target="traktor",
|
||||
destination=str(Path(tempfile.mkdtemp()) / "out"))
|
||||
req = {"track_ids": [str(one), str(two)], "mode": "reference",
|
||||
"playlist_id": playlist, "export_id": eset.id}
|
||||
p = c.post("/api/folder/add/preview", json=req).json()
|
||||
check("the preview reports it as already held", p["existing"] == ["First Light"], str(p))
|
||||
job = wait(c, c.post("/api/folder/add", json=req).json())
|
||||
check("the job finishes", job["state"] == "done", str(job))
|
||||
check("only the NEW file was added", len(a.tracks) == before + 2, f"{len(a.tracks) - before}")
|
||||
check("the held one kept its id", job["result"]["track_ids"][0] == added)
|
||||
new = job["result"]["track_ids"][1]
|
||||
check("the playlist holds both, once each", a.playlist_entries(playlist) == [added, new],
|
||||
str(a.playlist_entries(playlist)))
|
||||
check("and so does the export", exports.get(library, eset.id).track_ids == [added, new])
|
||||
|
||||
print("== copy: the collection points at the copy ==")
|
||||
three_dir = music / "Deeper"
|
||||
c.get("/api/folder/tracks", params={"path": str(three_dir)})
|
||||
dest = Path(tempfile.mkdtemp()) / "Imported"
|
||||
req = {"track_ids": [str(three_dir / "three.flac")], "mode": "copy", "destination": str(dest)}
|
||||
p = c.post("/api/folder/add/preview", json=req).json()
|
||||
check("the preview sizes the copy", p["total_bytes"] > 0, str(p))
|
||||
job = wait(c, c.post("/api/folder/add", json=req).json())
|
||||
check("the job finishes", job["state"] == "done", str(job))
|
||||
copied_id = job["result"]["track_ids"][0]
|
||||
check("the audio was copied", (dest / "three.flac").is_file())
|
||||
check("the entry points at the copy", a.audio_path(copied_id) == dest / "three.flac",
|
||||
str(a.audio_path(copied_id)))
|
||||
check("the original is untouched", (three_dir / "three.flac").is_file())
|
||||
check("copy without a destination is refused",
|
||||
c.post("/api/folder/add", json={"track_ids": [str(one)], "mode": "copy"}).status_code == 400)
|
||||
check("an unscanned file cannot be added",
|
||||
c.post("/api/folder/add/preview",
|
||||
json={"track_ids": ["/etc/passwd"], "mode": "reference"}).status_code == 404)
|
||||
|
||||
print("== hidden entries ==")
|
||||
check("AppleDouble twins are hidden", places.is_hidden(music / "._one.flac"))
|
||||
check("OS housekeeping is hidden", places.is_hidden(music / ".Trashes"))
|
||||
check("an ordinary file is not", not places.is_hidden(one))
|
||||
|
||||
print("\n" + ("❌ FAILED" if failed else "✅ PASSED"))
|
||||
_DATA.cleanup()
|
||||
raise SystemExit(1 if failed else 0)
|
||||
Reference in new issue
Block a user