Compression#

Per-file pipeline: probe, decide, compress, verify, swap.

class remote_compression.compression.FileResult(path: Path, status: str, message: str = '', old_size: int = 0, new_size: int = 0)[source]#

Outcome of compress() for one file.

path#

The file concerned (the produced file when status is done).

Type:

Path

status#

done, conform, failed, not_profitable or dry_run.

Type:

str

message#

Failure reason or extra context.

Type:

str

old_size#

Source size in bytes (when relevant).

Type:

int

new_size#

Output size in bytes (when produced).

Type:

int

remote_compression.compression.compress(source, settings, tracker=None, host=None, dry_run=False, progress_factory=None)[source]#

Compress one file according to settings.

Parameters:
  • source (Path or str) – Video to compress.

  • settings (Settings) – Resolved settings.

  • tracker (Tracker, optional) – Central log for deterministic failures (never written in dry-run).

  • host (LocalHost or RemoteHost) – Execution host (already bootstrapped). Unused in dry-run.

  • dry_run (bool) – Show what would be done without touching anything.

  • progress_factory (callable, optional) – factory(source, info) -> chunk callback built once the file is probed (the probe provides the duration for the bar).

Returns:

Business failures are returned, never raised; connection losses and Ctrl-C propagate to the batch loop.

Return type:

FileResult

Notes

Both replace modes share the same success checks (ffmpeg exit status, output present and non-empty, then a profitability ratio): a corrupt or bigger output can no longer overwrite a source.