Metadata-Version: 2.5
Name: kazesynth
Version: 0.1.0a0
Summary: A terminal UI and CLI to queue and run VapourSynth encodes.
Author-email: Vardë <ichunjo.le.terrible@gmail.com>
License-Expression: EUPL-1.2
License-File: LICENSE
Keywords: cli,encoding,job-queue,kaze,textual,tui,vapoursynth,video,x265
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: End Users/Desktop
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.15
Classifier: Topic :: Multimedia :: Video
Classifier: Topic :: Multimedia :: Video :: Conversion
Classifier: Typing :: Typed
Requires-Python: >=3.15
Requires-Dist: cyclopts>=5.5.3
Requires-Dist: platformdirs>=4.14.8
Requires-Dist: textual>=8.2.8
Requires-Dist: tomlkit>=0.15.3
Description-Content-Type: text/markdown

# Kazé

<div align="center">
  <img src="https://raw.githubusercontent.com/Ichunjo/kazesynth/refs/heads/master/assets/home.svg" height="500"/>

A lightweight terminal UI for queuing and managing VapourSynth encode jobs.
</div>

## Installation

```bash
uv tool install --python 3.15 kazesynth
```

## TUI

```bash
uv run kaze
```

## Job files and CLI

`kaze template ep01.toml` writes a job file with comments that list every field.

```toml
script = "ep01.vpy"

[[track]]
node = 0
preset = "x265-slow" # from <config>/presets/x265-slow.toml
options = { crf = 16 } # optional: replaces crf from the preset

[[track]]
node = 1
tool = "flac"

[mux]
output = "Episode 01.mkv"
```

```bash
uv run kaze run ep01.toml          # add the job and run the queue until it is idle
uv run kaze run --background       # the same, in a background process
uv run kaze add ep02.toml --queue night
uv run kaze jobs
uv run kaze cancel 3
uv run kaze retry 3                # done tasks are skipped
uv run kaze stop                   # stop the process that runs jobs
```

`kaze --help` lists all the commands. Only one Kazé process runs jobs at a time, and the TUI and the other commands talk to it.

Without `python` in the job, Kazé uses a `.venv` or `venv` folder next to the script or in a parent folder.
If it finds none, it tries the last interpreter used for that folder.
After that, it uses `default_python` from the settings.

Without `binary` in a track or preset, Kazé uses `[tools]` from the settings, and then PATH.

- A `binary` with a folder part, like `tools/x265.exe`, is a path.
- A relative path starts at the folder of the file that sets it: the job file, the preset file or the project file.
- A name without a folder, like `x265-mod`, is found in PATH.

The settings live in `<config>/settings.toml` (see `src/kazesynth/config.py`). To keep all Kazé files in one folder, set `KAZE_HOME`.

## Project presets

A project can have its own presets.
You write them in a `kaze.toml` file, or in the `[tool.kaze]` table of `pyproject.toml`:

```toml
# kaze.toml
[presets.x265-show]
tool = "x265"
options = { crf = 15, preset = "slower" }

# the same preset in pyproject.toml
[tool.kaze.presets.x265-show]
tool = "x265"
options = { crf = 15, preset = "slower" }
```

A project preset can build on a global preset, like a job track can:

```toml
[presets.x265-slow]
preset = "x265-slow" # the global preset with the same name, or any other global preset
options = { crf = 20 } # replaces only crf
```

`options` replace the options with the same name and `extra_args` come after the arguments of the global preset.
The base must be a global preset, not another project preset.
A change to the global preset also changes the project presets built on it.

- A job file uses the project of its own folder, or of the closest parent folder that has one. In one folder, `kaze.toml` wins over `pyproject.toml`.
- A project preset wins over a global preset with the same name.
- Project presets are copied into the job when you add it, like global presets. Editing the file later does not change queued jobs.
- The TUI uses the project of the folder you open it in, for `/presets` and `/new`.
  `/presets` shows where each preset comes from, and you can copy a project preset to a global preset there.

  To change or delete a project preset, you must edit the file. Kazé never writes to it.

## Flags added for x264 and x265

Kazé reads the props of frame 0 and adds these flags:

| Flag                        | From                                                     |
| --------------------------- | -------------------------------------------------------- |
| `--output-depth`            | the bit depth of the clip                                |
| `--colormatrix`             | `_Matrix`                                                |
| `--transfer`                | `_Transfer`                                              |
| `--colorprim`               | `_Primaries`                                             |
| `--range`                   | `_Range` (`tv`/`pc` for x264, `limited`/`full` for x265) |
| `--input-range` (x264 only) | `_Range`                                                 |
| `--chromaloc`               | `_ChromaLocation`                                        |
| `--sar`                     | `_SARNum` and `_SARDen`                                  |

- A flag you set yourself always wins. `-D` counts as `--output-depth`.
- A missing or unspecified prop sends nothing. Kazé never guesses.
- If you set `--input-range` for x264, Kazé does not send `--range` either.
