fix: nhãn của soundfont hiển thị sai và không load được instrument
This commit is contained in:
@@ -72,6 +72,30 @@ async def upload_soundfont(
|
||||
return {"id": file_id, "name": file.filename, "path": dest_path, "size_bytes": len(contents)}
|
||||
|
||||
|
||||
@router.delete("/soundfont/{sf_id}")
|
||||
async def delete_soundfont(sf_id: str, current_user: dict = Depends(get_current_user)):
|
||||
base_id = sf_id.replace("sf_", "")
|
||||
deleted = False
|
||||
for d in [UPLOAD_SF_DIR, os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), "static", "soundfonts")]:
|
||||
if not os.path.isdir(d):
|
||||
continue
|
||||
for f in os.listdir(d):
|
||||
if os.path.splitext(f)[0] == base_id:
|
||||
path = os.path.join(d, f)
|
||||
os.remove(path)
|
||||
# Remove associated .meta file
|
||||
meta_path = os.path.join(d, os.path.splitext(f)[0] + ".meta")
|
||||
if os.path.isfile(meta_path):
|
||||
os.remove(meta_path)
|
||||
deleted = True
|
||||
break
|
||||
if deleted:
|
||||
break
|
||||
if not deleted:
|
||||
raise HTTPException(status_code=404, detail="SoundFont not found")
|
||||
return {"deleted": True, "sf_id": sf_id}
|
||||
|
||||
|
||||
class RenderRequest(BaseModel):
|
||||
project_json: dict
|
||||
output_filename: Optional[str] = "render_output.wav"
|
||||
|
||||
Reference in New Issue
Block a user