Bugs are fixed in the backend, it works now

This commit is contained in:
2026-08-01 08:40:53 +00:00
parent cd56637d2a
commit b6ace3f68b
8 changed files with 180 additions and 10 deletions
+30 -7
View File
@@ -15,7 +15,9 @@ from backend.models.response import TaskStatus
def run_split_task(task_id: str, tracklist: List[TracklistEntry], options: Dict[str, Any]) -> None:
try:
task_manager.update_task(task_id, progress=5, message="Initializing...")
task_manager.update_task_with_progress(
task_id, progress=5, message="Initializing..."
)
input_path = FileManager.get_input_path(task_id)
if not input_path or not input_path.exists():
@@ -63,24 +65,45 @@ def run_split_task(task_id: str, tracklist: List[TracklistEntry], options: Dict[
from audio_splitter.core import split_audio
task_manager.update_task(task_id, progress=10, message="Starting split...")
# We need to track progress from the core.
# Since the core doesn't have a progress callback, we'll update progress
# based on track list size (approximate).
total_tracks = len(tracks)
progress_base = 10 # Starting progress after init
task_manager.update_task_with_progress(
task_id, progress=progress_base, message="Starting split..."
)
# Run the split
# The core prints progress to stdout, but we can't easily capture it.
# We'll update progress based on track count.
# For now, we'll report progress after the split completes.
# A more advanced implementation would capture stdout or add a callback.
split_audio(str(input_path), str(output_dir), tracks, args)
# After split completes, get the output files
output_files = FileManager.get_output_files(task_id)
task_manager.update_task(
task_manager.update_task_with_progress(
task_id,
status=TaskStatus.DONE,
progress=100,
message="Split complete",
status=TaskStatus.DONE
)
# Add tracks to the task state
task_manager.update_task(
task_id,
tracks=output_files
)
except Exception as e:
task_manager.update_task(
task_manager.update_task_with_progress(
task_id,
progress=0,
message="Split failed",
status=TaskStatus.ERROR,
error=str(e),
message="Split failed"
error=str(e)
)