main
Setup
dataclass
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_file
|
str
|
An ini file where the config will be loaded from. You can disable this by leaving it empty or setting None. Make sure you set the relevant variables in this constructor in that case. You can also set other, technically, not existing variables in there and access them from python after. |
'config.ini'
|
bdmv_dir
|
str
|
Convenience path for sources and what not. |
'BDMV'
|
show_name
|
str
|
The name of the show. Used for the $show$ placeholder in muxing. |
'Nice Series'
|
allow_binary_download
|
bool
|
This will download any executables needed for doing what you're requesting to do. For example x265, opusenc, etc. |
True
|
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
|
Source code in muxtools/main.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
|
edit(attr, value)
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
do_audio(fileIn, track=0, trims=None, fps=Fraction(24000, 1001), num_frames=0, extractor=FFMpeg.Extractor(), trimmer=AutoTrimmer(), encoder=AutoEncoder(), quiet=True, output=None)
One-liner to handle the whole audio processing
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fileIn
|
PathLike | list[PathLike]
|
Input file |
required |
track
|
int
|
Audio track number |
0
|
trims
|
Trim | list[Trim] | None
|
Frame ranges to trim and/or combine, e.g. (24, -24) or [(24, 500), (700, 900)] |
None
|
fps
|
Fraction | PathLike
|
FPS Fraction used for the conversion to time. Also accepts a timecode (v2) file. |
Fraction(24000, 1001)
|
num_frames
|
int
|
Total number of frames, used for negative numbers in trims |
0
|
extractor
|
Extractor
|
Tool used to extract the audio |
Extractor()
|
trimmer
|
Trimmer | None
|
Tool used to trim the audio AutoTrimmer means it will choose ffmpeg for lossy and Sox for lossless |
AutoTrimmer()
|
encoder
|
Encoder | None
|
Tool used to encode the audio AutoEncoder means it won't reencode lossy and choose opus otherwise |
AutoEncoder()
|
quiet
|
bool
|
Whether the tool output should be visible |
True
|
output
|
PathLike | None
|
Custom output file or directory, extensions will be automatically added |
None
|
Returns:
Type | Description |
---|---|
AudioFile
|
AudioFile Object containing file path, delays and source |
Source code in muxtools/functions.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
|