feat: bổ sung MIDI
This commit is contained in:
@@ -303,3 +303,27 @@ def cleanup_expired_files_task(max_age_hours: int = 24):
|
||||
"cleaned_size_mb": round(cleaned_size / (1024 * 1024), 2),
|
||||
"max_age_hours": max_age_hours
|
||||
}
|
||||
|
||||
|
||||
@celery_app.task
|
||||
def render_project_task(project_id: str, project_name: str, project_json_str: str, sample_rate: int = 44100):
|
||||
"""
|
||||
Task Celery để kết xuất dự án ngoại tuyến (Offline Project Mixdown) áp dụng specs 30_DAW_ARCHITECT.md.
|
||||
"""
|
||||
import json
|
||||
from app.core.render_engine import PythonRenderEngine
|
||||
|
||||
project_json = json.loads(project_json_str)
|
||||
output_filename = f"{project_id}_render.wav"
|
||||
output_path = os.path.join(settings.PROCESSED_DIR, output_filename)
|
||||
|
||||
engine = PythonRenderEngine(sample_rate=sample_rate)
|
||||
engine.render_project(project_json, output_path)
|
||||
|
||||
return {
|
||||
"project_id": project_id,
|
||||
"project_name": project_name,
|
||||
"success": True,
|
||||
"output_file_id": output_filename
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user