feat: auto-scan soundfont for Synth instrument list
Background daemon (30s interval) tracks scanned files via sf_scan_state.json (size+mtime). Only inspects new/changed SFs. Catalog served from scanner cache, no full re-scan per request. Upload/delete trigger immediate re-scan.
This commit is contained in:
@@ -15,6 +15,7 @@ from app.api.v1.ai_proxy import router as ai_proxy_router
|
||||
from app.api.v1.plugins import router as plugins_router
|
||||
from app.core.auth import seed_admin
|
||||
from app.core.soundfont_converter import SoundFontConverter
|
||||
from app.core.soundfont_scanner import SoundFontAutoScanner
|
||||
|
||||
# Ensure storage directories exist
|
||||
os.makedirs(settings.UPLOADS_DIR, exist_ok=True)
|
||||
@@ -65,6 +66,11 @@ async def startup_convert_soundfonts():
|
||||
print(f"[Startup] SoundFont conversion error: {e}")
|
||||
threading.Thread(target=_run, daemon=True).start()
|
||||
|
||||
@app.on_event("startup")
|
||||
async def startup_sf_scanner():
|
||||
scanner = SoundFontAutoScanner()
|
||||
scanner.start_background(interval=30)
|
||||
|
||||
@app.get("/", response_class=HTMLResponse)
|
||||
async def get_index():
|
||||
index_path = os.path.join(settings.TEMPLATES_DIR, "index.html")
|
||||
|
||||
Reference in New Issue
Block a user