mkv2cast.json_progress

JSON progress output for mkv2cast.

This module provides structured JSON output for integration with other applications (web UIs, monitoring tools, etc.).

Functions

parse_ffmpeg_progress_for_json(line)

Parse FFmpeg progress line for JSON output.

Classes

FileProgress(filename, filepath, status[, ...])

Progress information for a single file.

JSONProgressOutput([stream])

Manages JSON progress output to stdout.

JSONProgressState(version, timestamp, event, ...)

Complete state for JSON progress output.

OverallProgress([total_files, ...])

Overall progress for the entire batch.

class mkv2cast.json_progress.FileProgress(filename: str, filepath: str, status: str, progress_percent: float = 0.0, current_frame: int = 0, total_frames: int = 0, current_time_ms: int = 0, duration_ms: int = 0, fps: float = 0.0, speed: str = '', bitrate: str = '', size_bytes: int = 0, eta_seconds: float = 0.0, error: str | None = None, started_at: float | None = None, finished_at: float | None = None, output_path: str | None = None)[source]

Bases: object

Progress information for a single file.

filename: str
filepath: str
status: str
progress_percent: float = 0.0
current_frame: int = 0
total_frames: int = 0
current_time_ms: int = 0
duration_ms: int = 0
fps: float = 0.0
speed: str = ''
bitrate: str = ''
size_bytes: int = 0
eta_seconds: float = 0.0
error: str | None = None
started_at: float | None = None
finished_at: float | None = None
output_path: str | None = None
class mkv2cast.json_progress.OverallProgress(total_files: int = 0, processed_files: int = 0, converted_files: int = 0, skipped_files: int = 0, failed_files: int = 0, current_file: str | None = None, overall_percent: float = 0.0, eta_seconds: float = 0.0, started_at: float | None = None, backend: str = '', encode_workers: int = 1, integrity_workers: int = 1)[source]

Bases: object

Overall progress for the entire batch.

total_files: int = 0
processed_files: int = 0
converted_files: int = 0
skipped_files: int = 0
failed_files: int = 0
current_file: str | None = None
overall_percent: float = 0.0
eta_seconds: float = 0.0
started_at: float | None = None
backend: str = ''
encode_workers: int = 1
integrity_workers: int = 1
class mkv2cast.json_progress.JSONProgressState(version: str = '1.0', timestamp: float = <factory>, event: str = 'progress', overall: OverallProgress = <factory>, files: Dict[str, ~mkv2cast.json_progress.FileProgress]=<factory>, current_encoding: List[str] = <factory>, current_checking: List[str] = <factory>)[source]

Bases: object

Complete state for JSON progress output.

version: str = '1.0'
timestamp: float
event: str = 'progress'
overall: OverallProgress
files: Dict[str, FileProgress]
current_encoding: List[str]
current_checking: List[str]
class mkv2cast.json_progress.JSONProgressOutput(stream=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)[source]

Bases: object

Manages JSON progress output to stdout.

start(total_files: int, backend: str, encode_workers: int, integrity_workers: int) None[source]

Signal start of processing.

set_file_duration(filepath: str, duration_ms: int) None[source]

Set the duration for a file (from probe).

file_queued(filepath: Path, duration_ms: int = 0) None[source]

Signal a file has been queued.

file_checking(filepath: Path) None[source]

Signal a file integrity check has started.

file_check_done(filepath: Path) None[source]

Signal a file integrity check has finished.

file_encoding_start(filepath: Path, duration_ms: int = 0) None[source]

Signal encoding has started for a file.

file_progress(filepath: Path, frame: int = 0, fps: float = 0.0, time_ms: int = 0, bitrate: str = '', speed: str = '', size_bytes: int = 0) None[source]

Update encoding progress for a file.

file_done(filepath: Path, output_path: Path | None = None, skipped: bool = False, error: str | None = None) None[source]

Signal a file has finished processing.

complete() None[source]

Signal all processing is complete.

mkv2cast.json_progress.parse_ffmpeg_progress_for_json(line: str) Dict[str, Any][source]

Parse FFmpeg progress line for JSON output.

Returns a dict with parsed values.