Files
jadssss 15c0ba5d66 add resume support, metadata paths, LRCLIB order and overall progress
- store source track path in metadata.json and validate it when skipping ready files
- add skip_existing/resume_partial options to config and GUI
- identify lyrics via embedded text, Shazam, then one LRCLIB author search
- keep post-ASR LRCLIB text matching and allow cancelling safely
- recover from CUDA OOM and free VRAM between batch stages
- add overall completed/total file progress bar to GUI and pipelines
2026-10-25 20:24:01 +03:00

46 lines
1.5 KiB
Python

"""QThread wrapper. Supports three task types: main, lrc, embed."""
from __future__ import annotations
import threading
from PySide6.QtCore import QThread, Signal
from core.config import PipelineConfig
class PipelineWorker(QThread):
log = Signal(str)
progress = Signal(str, int, int) # stage, current, total_for_stage
overall_progress = Signal(int, int) # completed_files, total_files
finished_ok = Signal(list)
failed = Signal(str)
def __init__(self, config: PipelineConfig, task: str = "main", parent=None):
super().__init__(parent)
self._config = config
self._task = task
self._stop_event = threading.Event()
def stop(self) -> None:
self._stop_event.set()
def run(self) -> None:
try:
if self._task == "lrc":
from core.lrc_pipeline import run_lrc_pipeline as runner
elif self._task == "embed":
from core.lrc_pipeline import run_embed_pipeline as runner
else:
from core.pipeline import run_pipeline as runner
results = runner(
self._config,
log=self.log.emit,
on_progress=lambda s, d, t: self.progress.emit(s, d, t),
stop_event=self._stop_event,
on_overall_progress=lambda d, t: self.overall_progress.emit(d, t),
)
self.finished_ok.emit(results)
except Exception as exc: # noqa: BLE001
self.failed.emit(f"{type(exc).__name__}: {exc}")