muxtools.main
Setup
pydantic-model
Setup(episode: str = '01', config_path: str | Path | None = None, *, show_name: str = 'Example', clean_work_dirs: bool = False, out_dir: str = 'premux', out_name: str = '$show$ - $ep$ (premux)', mkv_title_naming: str = '$show$ - $ep$', debug: bool = True, error_on_danger: bool = False, work_dir: str | None = None, **options: Any)
Bases: MuxSettings
Something like an environment used for a lot of functions in this package. Mostly used for muxing and data locations (work directory and what not).
If you want to change any of the variables AFTER initialization make sure to use the Setup.edit function to do so.
Read its docstring to get why.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
episode
|
str
|
Episode identifier used for workdir and muxing |
'01'
|
config_path
|
str | Path | None
|
Optional explicit pyproject.toml or muxtools.toml path. |
None
|
show_name
|
str
|
The name of the show. Used for the $show$ placeholder in muxing. |
'Example'
|
clean_work_dirs
|
bool
|
Cleanup the work directories after muxing. Might be useful if you're muxing a ton of stuff. |
False
|
out_dir
|
str
|
The folder the muxed files will go into. |
'premux'
|
out_name
|
str
|
The naming template applied to the muxed files. |
'$show$ - $ep$ (premux)'
|
mkv_title_naming
|
str
|
The naming template applied to the mkv title. |
'$show$ - $ep$'
|
work_dir
|
str | None
|
In case you want to set a custom work directory for all the temp files. |
None
|
debug
|
bool
|
Enable or Disable various, possibly interesting, debug output of all functions in this package. |
True
|
error_on_danger
|
bool
|
Raise an error when normally a "danger" log would be printed. |
False
|
Show JSON schema:
{
"additionalProperties": true,
"description": "Something like an environment used for a lot of functions in this package.\nMostly used for muxing and data locations (work directory and what not).\n\nIf you want to change any of the variables AFTER initialization make sure to use the `Setup.edit` function to do so.\nRead its docstring to get why.\n\n:param episode: Episode identifier used for workdir and muxing\n:param config_path: Optional explicit pyproject.toml or muxtools.toml path.\n\n:param show_name: The name of the show. Used for the $show$ placeholder in muxing.\n:param clean_work_dirs: Cleanup the work directories after muxing. Might be useful if you're muxing a ton of stuff.\n:param out_dir: The folder the muxed files will go into.\n:param out_name: The naming template applied to the muxed files.\n:param mkv_title_naming: The naming template applied to the mkv title.\n:param work_dir: In case you want to set a custom work directory for all the temp files.\n:param debug: Enable or Disable various, possibly interesting, debug output of all functions in this package.\n:param error_on_danger: Raise an error when normally a \"danger\" log would be printed.",
"properties": {
"show_name": {
"default": "Example",
"title": "Show Name",
"type": "string"
},
"clean_work_dirs": {
"default": false,
"title": "Clean Work Dirs",
"type": "boolean"
},
"out_dir": {
"default": "premux",
"title": "Out Dir",
"type": "string"
},
"out_name": {
"default": "$show$ - $ep$ (premux)",
"title": "Out Name",
"type": "string"
},
"mkv_title_naming": {
"default": "$show$ - $ep$",
"title": "Mkv Title Naming",
"type": "string"
},
"debug": {
"default": true,
"title": "Debug",
"type": "boolean"
},
"error_on_danger": {
"default": false,
"title": "Error On Danger",
"type": "boolean"
},
"episode": {
"default": "01",
"title": "Episode",
"type": "string"
},
"config_path": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Config Path"
},
"work_dir": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Work Dir"
}
},
"title": "Setup",
"type": "object"
}
Config:
extra:allowstrict:True
Fields:
-
show_name(str) -
clean_work_dirs(bool) -
out_dir(str) -
out_name(str) -
mkv_title_naming(str) -
debug(bool) -
error_on_danger(bool) -
episode(str) -
config_path(str | None) -
work_dir(str | None)
Source code in muxtools/main.py
edit
Sets a variable inside of Setup and saves it to the environment variables. You should use this to apply any changes because other functions will not make use of them otherwise!
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
attr
|
str
|
The name of the variable/attribute you want to change |
required |
value
|
Any
|
The value this variable/attribute will have. |
required |
Source code in
muxtools/main.py
set_default_sub_timesource
set_default_sub_timesource(timesource: Path | GlobSearch | str | float | list[int], timescale: TimeScale | int | None = None) -> Self
Set a default timesource and timescale for conversions in subtitle functions.
The source selection for this is a bit more limited than the explicit params in the respective functions due to certain types being hard to store in the environment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timesource
|
Path | GlobSearch | str | float | list[int]
|
The source of timestamps/timecodes. This can be a video file, a timestamps txt file, actual timestamps as integers, a muxtools VideoMeta json file or FPS as a fraction string or float. |
required |
timescale
|
TimeScale | int | None
|
Unit of time (in seconds) in terms of which frame timestamps are represented. For details check the docstring on the type. |
None
|