FEAT: cài đặt các thư viện để chuẩn bị build exe trên window
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import os
|
||||
import platform
|
||||
from fastapi import APIRouter, Depends
|
||||
from pydantic import BaseModel
|
||||
from typing import Optional
|
||||
from app.core.vst_scanner import NativePluginScanner
|
||||
from app.api.v1.auth import get_current_user
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
# Thư mục mặc định theo OS (spec desktop VST 2026-08-08)
|
||||
DEFAULT_PLUGIN_DIRS = {
|
||||
"Linux": ["/opt/daw_engine/vst3", os.path.expanduser("~/.vst3")],
|
||||
"Windows": [os.path.expandvars(r"%ProgramFiles%\Common Files\VST3")],
|
||||
"Darwin": ["/Library/Audio/Plug-Ins/Components", os.path.expanduser("~/Library/Audio/Plug-Ins/Components")],
|
||||
}
|
||||
|
||||
|
||||
class PluginScanRequest(BaseModel):
|
||||
custom_directories: Optional[list] = None
|
||||
scan_formats: Optional[list] = None
|
||||
force_rescan: Optional[bool] = False
|
||||
|
||||
|
||||
@router.post("/plugins/scan")
|
||||
async def scan_desktop_plugins(req: PluginScanRequest, current_user: dict = Depends(get_current_user)):
|
||||
"""Quét VST3/AU từ thư mục custom — spec: POST /api/v1/desktop/plugins/scan."""
|
||||
os_name = platform.system()
|
||||
dirs = req.custom_directories or DEFAULT_PLUGIN_DIRS.get(os_name, ["/opt/daw_engine/vst3"])
|
||||
if isinstance(dirs, str):
|
||||
dirs = [dirs]
|
||||
scanner = NativePluginScanner()
|
||||
plugins = scanner.scan_directories(dirs)
|
||||
return {
|
||||
"status": "success",
|
||||
"os": os_name,
|
||||
"scanned_directories": dirs,
|
||||
"total_found": len(plugins),
|
||||
"plugins": plugins,
|
||||
}
|
||||
@@ -18,6 +18,7 @@ os.makedirs(UPLOAD_SF_DIR, exist_ok=True)
|
||||
|
||||
SYSTEM_SF_DIR = "/opt/daw_engine/soundfonts"
|
||||
|
||||
|
||||
_inspector = None
|
||||
_scanner = None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user