View Source Whispex (whispex v0.1.0)
Create and execute whisper CLI commands.
Note that adding options is backwards from using the whisper CLI; when using whisper CLI, you specify the options before each file. But with Whispex (this library), you add the file first, then add the relevant options afterward.
example
Example
import Whispex
use Whispex.Options
command =
Whispex.new_command
|> add_input_file("/path/to/input.avi")
|> add_file_option(option_language("English"))
|> add_file_option(option_output_dir("other_dir"))
|> add_file_option(option_output_format("vtt"))
|> add_file_option(option_model("tiny"))
:ok = execute(command)
Link to this section Summary
Functions
Add a per-file option to the command.
Add an input file to the command.
Add an output file to the command.
Execute the command using whisper CLI.
Begin a new blank (no options) whisper command.
Prepares the command to be executed, by converting the %Command{}
into
proper parameters to be feeded to System.cmd/3
or Port.open/2
.
Link to this section Functions
Add a per-file option to the command.
Applies to the most recently added file.
Add an input file to the command.
Add an output file to the command.
@spec execute(command :: Whispex.Command.t()) :: {:ok, binary()} | {:error, {Collectable.t(), exit_status :: non_neg_integer()}}
Execute the command using whisper CLI.
Returns {:ok, output}
on success, or {:error, {cmd_output, exit_status}}
on error.
Begin a new blank (no options) whisper command.
Prepares the command to be executed, by converting the %Command{}
into
proper parameters to be feeded to System.cmd/3
or Port.open/2
.
Under normal circumstances Whispex.execute/1
should be used, use prepare
only when converted args are needed to be feeded in a custom execution method.