Configuration#
User preferences: TOML file in the platform config directory.
- remote_compression.config.CONFIG_TEMPLATE = '# rcomp configuration - command-line flags always win over this file.\n# Resolution order:\n# built-in defaults < [defaults] < [preset.X] (with --preset X) < explicit CLI flags.\n\n[defaults]\n# hostname = "remote_host" # ssh alias (~/.ssh/config), or "local"\n# remote_ffmpeg = "/usr/local/bin/ffmpeg" # explicit remote binary (space-free path); omitted = PATH\n# remote_workdir = ".rcomp" # remote workspace, as the ffmpeg shell sees it\n# remote_workdir_sftp = "/home/.rcomp" # same workspace, as SFTP sees it, when the two views\n# # differ (Synology chroots SFTP: /home = the login home)\n# codec = "libx265" # ffmpeg encoder (free choice: libx264, libsvtav1, hevc_nvenc, ...)\n# codec_name = "hevc" # ffprobe codec name considered compliant; derived from codec when omitted\n# crf = 28 # constant rate factor; omitted = encoder default\n# ffmpeg_preset = "medium" # ffmpeg -preset; omitted = encoder default\n# height = 720 # maximal height; 0 = never downscale\n# container = "mkv" # output container; mkv swallows about anything\n# map = true # explicit video/audio/subtitles stream mapping\n# replace = false # true: replace originals; false: keep them as ori_*\n# extensions = [".avi", ".mp4", ".flv", ".wmv", ".mkv", ".ts", ".webm", ".m4v",\n# ".mov", ".mpg", ".mpeg", ".m2ts", ".mts", ".3gp"]\n# auto_local = true # switch to local mode when the host is this machine\n# auto_purge_days = 7 # opportunistic remote workspace purge; 0 disables\n\n# Named presets use the same keys as [defaults]. Apply with --preset NAME.\n# Built-in presets (soft, hard, hard4) can be overridden here.\n\n# [preset.hard]\n# map = false\n# replace = true\n\n# [preset.av1]\n# codec = "libsvtav1"\n# crf = 32\n'#
TOML template written by
rcomp config --init(every key commented out).
- exception remote_compression.config.ConfigError[source]#
Invalid configuration (bad TOML, unknown preset…).
- remote_compression.config.builtin_presets()[source]#
- Returns:
Built-in presets as plain option dicts (overridable from the config file).
- Return type:
- remote_compression.config.config_path()[source]#
- Returns:
Location of the user configuration file.
- Return type:
- remote_compression.config.load_config(path=None)[source]#
Load the user configuration.
- Parameters:
path (
Pathorstr, optional) – Alternative file location (defaults toconfig_path()).- Returns:
{'defaults': {...}, 'presets': {name: {...}}}, normalized. Empty tables when the file does not exist.- Return type:
- Raises:
ConfigError – If the file exists but is not valid TOML.
- remote_compression.config.normalize_options(options)[source]#
Normalize one layer of options to
Settingsfields.
- remote_compression.config.resolve_settings(config, preset=None, cli_overrides=None)[source]#
Merge all option layers into a
Settings.- Parameters:
config (
dict) – Output ofload_config().preset (
str, optional) – Name of a preset (built-in or from the config file).cli_overrides (
dict, optional) – Options explicitly typed on the command line (Settings field names).
- Returns:
Resolved settings: dataclass defaults < config
[defaults]<[preset.X]< explicit CLI flags.- Return type:
- Raises:
ConfigError – If preset is not a known preset.
- remote_compression.config.write_template(path=None, force=False)[source]#
Write the commented configuration template.
- Parameters:
path (
Pathorstr, optional) – Alternative file location (defaults toconfig_path()).force (
bool) – Overwrite an existing file.
- Returns:
The written file.
- Return type:
- Raises:
ConfigError – If the file exists and force is False.