ytdl-sub/src/ytdl_sub/prebuilt_presets/__init__.py
Jesse Bannon ff857c84af
[FEATURE] Prebuilt music presets (#780)
Adds the following prebuilt presets:
```
"Single"
"SoundCloud Discography"
"YouTube Releases"
"YouTube Full Albums"
"Bandcamp"
```

which require no config.yaml to use. Usage examples can be found in the `/examples` directory
2023-10-24 09:23:05 -07:00

31 lines
782 B
Python

import pathlib
from typing import Any
from typing import Dict
from typing import Set
import mergedeep
from ytdl_sub.utils.yaml import load_yaml
def _merge_presets() -> Dict[str, Any]:
merged_configs: Dict[str, Any] = {}
# Get all presets from the loose YAML files
for file in pathlib.Path(__file__).parent.resolve().rglob("*"):
if file.is_file() and file.name.endswith("yaml"):
mergedeep.merge(merged_configs, load_yaml(file))
return merged_configs["presets"]
PREBUILT_PRESETS: Dict[str, Any] = _merge_presets()
PREBUILT_PRESET_NAMES: Set[str] = set(PREBUILT_PRESETS.keys())
PUBLISHED_PRESET_NAMES: Set[str] = {
name for name in PREBUILT_PRESET_NAMES if not name.startswith("_")
}
class PrebuiltPresets:
preset_names: Set[str]