muxtools.muxing.token_handling
replace_with_temp_tokens
Replace regular $ tokens with # tokens to be able to be used in filenames temporarily.
Source code in
muxtools/muxing/token_handling.py
apply_dynamic_tokens
apply_dynamic_tokens(string: str, token_source: PathLike | ParsedFile, is_global: bool, user_lang: str | None = None, caller: Any | None = None) -> str
Apply dynamic tokens to naming strings based on a file and/or user selected language (for raw tracks).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
string
|
str
|
The string to manipulate |
required |
token_source
|
PathLike | ParsedFile
|
The file to read metadata from |
required |
is_global
|
bool
|
Should be true if this string is meant to be used for a filename and False for tracks |
required |
user_lang
|
str | None
|
The language to be used if there is none or if it should be overridden |
None
|
caller
|
Any | None
|
The object to be used for the logging, mostly for internal usage |
None
|
Returns:
| Type | Description |
|---|---|
str
|
The modified string if anything was there to modify, otherwise the untouched input. |