Command#
Pure logic: decide what to do with a file and build the ffmpeg command.
- remote_compression.command.FORBIDDEN_CHARS = {'\n', '\r', '!', '"', '$', '%', '&', ';', '<', '>', '^', '`', '|'}#
Characters banned from remote command lines (cmd.exe expansion, redirections, separators, sh substitutions). Remote paths are hex names generated by us, and option tokens are fixed ASCII, so hitting this guard means a programming error.
- class remote_compression.command.FfmpegPlan(tokens: tuple)[source]#
A ready-to-run ffmpeg command with
SOURCE/TARGETplaceholders.- command(r_source, r_target, binary=None)[source]#
Substitute placeholders and return the remote execution form.
- Parameters:
- Returns:
A single command line safe for both POSIX shells and cmd.exe.
- Return type:
- Raises:
ValueError – If any token or path is non-ASCII or contains a forbidden character. The original file name never travels through a remote shell (only through SFTP), so this cannot be triggered by user data.
- class remote_compression.command.Plan(todo: bool, transcode: bool, resize: bool, warnings: tuple = ())[source]#
What has to be done for a given file.
- remote_compression.command.SOURCE = '{source}'#
Sentinel tokens substituted at execution time.
- remote_compression.command.build_ffmpeg_command(info, settings)[source]#
Build the full ffmpeg command for a file.
- Parameters:
- Returns:
Command with placeholders, usable locally (
FfmpegPlan.argv()) or remotely (FfmpegPlan.command()).- Return type:
Notes
-nostats -progress pipe:1replaces the stderr chatter with a machine-readablekey=valuestream on stdout: it feeds the progress bar and doubles as the liveness heartbeat for remote execution.
- remote_compression.command.subtitle_args(subtitles)[source]#
Build the subtitle handling arguments for an mkv target.
- Parameters:
subtitles (
tupleofSubtitleStream) – Subtitle streams of the source.- Returns: