Command: powershell -NoProfile -Command "$f='C:\ProgramData\AudioProcess\current\chirp_direct_server.py';Select-String -Path $f -Pattern 'INSERT INTO jobs|sqlite3.connect|jobs.sqlite|def .*job|enqueue|add_job|create_job|source_path|original_path|input_file|media_path|video_path' -CaseSensitive:$false | Select-Object -First 220 | ForEach-Object {('{0}:{1}' -f $_.LineNumber,$_.Line.Trim())}"
Directory: projects
Status: SUCCESS
Exit code: 0
Cancel Job Rerun Command Refresh
1080:def connect(self) -> sqlite3.Connection:
1081:conn = sqlite3.connect(self.db_path, timeout=60)
1099:video_path TEXT NOT NULL UNIQUE,
1280:video_path TEXT NOT NULL DEFAULT '',
1313:"video_path": "TEXT NOT NULL DEFAULT ''",
1678:def run_local_whisper_srt(self, audio: Path, job_id: str, chunk_id: str, start_ms: int) -> list[Cue]:
1697:def transcribe_audio(self, path: Path, job_id: str) -> list[Cue]:
1788:def chunk_counts(self, job_id: str) -> dict[str, int]:
1802:def update_job_from_chunks(self, job_id: str, detail: str = "") -> None:
1877:def save_chirp_raw_result(self, job_id: str, chunk_id: str, response: Any) -> str:
1890:video = Path(str(row["video_path"]))
2039:def save_operation_json(self, job_id: str, chunk_id: str, operation_name: str, payload: Any) -> str:
2282:def requeue_job_for_resplit(self, job_id: str, reason: str) -> None:
2302:def finalize_original_if_ready(self, job_id: str) -> bool:
2348:video = Path(str(job["video_path"]))
2363:def translate_job(self, row: sqlite3.Row) -> None:
2365:video = Path(str(row["video_path"]))
2388:original_path=original_srt,
2391:quality_report["video_path"] = str(video)
2425:original_path=original_srt,
2428:quality_report["video_path"] = str(video)
2463:def claim_audio_job(self) -> sqlite3.Row | None:
2472:"ORDER BY updated_at,video_path LIMIT 1",
2492:def _chirp_focus_parent_job_id(self, conn: sqlite3.Connection) -> str | None:
2522:j.video_path
2590:def claim_translate_job(self) -> sqlite3.Row | None:
2600:"ORDER BY CASE WHEN status='translate_retry' THEN 0 WHEN status='original_ready' THEN 1 ELSE 2 END, updated_at, video_path LIMIT 1",
2616:def finalize_ready_jobs(self) -> int:
2716:INSERT INTO jobs(job_id,video_path,video_size,video_mtime,status,progress,detail,attempts,next_retry,active,created_at,updated_at)
2718:ON CONFLICT(job_id) DO UPDATE SET video_path=excluded.video_path,video_size=excluded.video_size,
2736:def update_job(self, job_id: str, **values: Any) -> None:
2761:def next_job(self) -> sqlite3.Row | None:
3529:def translate_cues(self, cues: list[Cue], job_id: str) -> list[Cue]:
3569:def register_generated(self, path: Path, job_id: str, kind: str, source_hash: str) -> None:
3579:def subtitle_quality_state(self, job_id: str) -> dict[str, Any] | None:
3594:original_path: Path | None = None,
3600:"original_srt_path": str(original_path) if original_path else "",
3776:def subtitle_chunk_quality_report(self, job_id: str) -> dict[str, Any]:
3785:"SELECT job_id,video_path,status,original_srt,english_srt FROM jobs WHERE job_id=?",
3887:"video_path": str(job["video_path"]) if job else "",
3932:SELECT j.job_id,j.video_path,j.status,j.original_srt,j.english_srt,j.updated_at,
3944:ORDER BY j.updated_at DESC, j.video_path
3973:stored_original_path = Path(stored_original_raw) if stored_original_raw else None
3976:stored_original_exists = bool(stored_original_path and stored_original_path.exists() and stored_original_path.stat().st_size > 0)
3980:parse_srt(stored_original_path.read_text(encoding="utf-8-sig", errors="replace")),
3997:"video_path": str(row["video_path"] or ""),
4001:"original_srt_path": str(stored_original_path or ""),
4031:def _subtitle_quality_backup(self, path: Path, job_id: str, reason: str) -> str:
4051:job_id,video_path,original_srt_path,english_srt_path,source_kind,score,verdict,needs_requeue,
4056:video_path=excluded.video_path,
4080:payload.get("video_path", ""),
4102:def requeue_job_for_quality(self, job: sqlite3.Row, report: dict[str, Any], english_path: Path | None = None, dry_run: bool = False) -> dict[str, Any]:
4104:video = Path(str(job["video_path"]))
4117:report["video_path"] = str(video)
4155:def requeue_job_for_full_rescan(self, job: sqlite3.Row, report: dict[str, Any], dry_run: bool = False) -> dict[str, Any]:
4157:video = Path(str(job["video_path"]))
4160:original_path = Path(original_raw) if original_raw else None
4169:report["video_path"] = str(video)
4193:for path in (original_path, english_path):
4236:j.video_path,
4247:ORDER BY j.updated_at DESC, j.video_path
4255:original_path = Path(str(row["original_srt"] or ""))
4259:original_path=original_path if str(original_path) else None,
4263:report["video_path"] = str(row["video_path"] or "")
4318:COALESCE(j.video_path, '') AS video_path,
4363:row.get("video_path", ""),
4438:str(row.get("video_path") or ""),
4452:def safe_output_targets(self, video: Path, job_id: str) -> tuple[Path, Path]:
4475:def process_job(self, row: sqlite3.Row) -> None:
4530:def expected_english_target_for_job(self, row: sqlite3.Row) -> Path:
4531:video = Path(str(row["video_path"]))
4534:def expected_original_target_for_job(self, row: sqlite3.Row) -> Path:
4535:video = Path(str(row["video_path"]))
4586:jobs = conn.execute("SELECT * FROM jobs WHERE COALESCE(video_path,'')<>'' ORDER BY video_path").fetchall()
4590:video = Path(str(row["video_path"] or ""))
4650:jobs = conn.execute("SELECT * FROM jobs WHERE active=1 ORDER BY video_path").fetchall()
4654:video = Path(str(job["video_path"] or ""))
4813:def _job_chunk_count(self, conn: sqlite3.Connection, job_id: str) -> int:
5135:"SELECT video_path,status,progress,detail,error,updated_at FROM jobs WHERE active=1 ORDER BY updated_at DESC LIMIT 20"
5175:jobs = conn.execute("SELECT * FROM jobs WHERE active=1 ORDER BY video_path").fetchall()
5197:video = Path(str(job["video_path"] or ""))
5352:jobs = conn.execute("SELECT * FROM jobs WHERE active=1 ORDER BY video_path").fetchall()
5356:video = Path(str(row["video_path"] or ""))
5447:def _subtitle_file_record(self, path: Path, tracked: set[str], job_by_path: dict[str, str]) -> dict[str, Any]:
5493:for row in conn.execute("SELECT job_id,video_path FROM jobs WHERE active=1").fetchall():
5626:jobs = conn.execute("SELECT * FROM jobs WHERE active=1 ORDER BY video_path").fetchall()
5630:video = Path(str(row["video_path"] or ""))
5758:def _process_job_thread(self, row: sqlite3.Row) -> None: