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.
- remote_compression.compression.compress(source, settings, tracker=None, host=None, dry_run=False, progress_factory=None)[source]#
Compress one file according to settings.
- Parameters:
settings (
Settings) – Resolved settings.tracker (
Tracker, optional) – Central log for deterministic failures (never written in dry-run).host (
LocalHostorRemoteHost) – 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 callbackbuilt 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:
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.