diff options
author | coletdjnz <coletdjnz@protonmail.com> | 2025-02-23 11:00:46 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-23 11:00:46 +1300 |
commit | 4445f37a7a66b248dbd8376c43137e6e441f138e (patch) | |
tree | b37561f1213bc25420f1f1004e8b6c8560e8b92f /yt_dlp/globals.py | |
parent | 3a1583ca75fb523cbad0e5e174387ea7b477d175 (diff) |
[core] Load plugins on demand (#11305)
- Adds `--no-plugin-dirs` to disable plugin loading
- `--plugin-dirs` now supports post-processors
Authored by: coletdjnz, Grub4K, pukkandan
Diffstat (limited to 'yt_dlp/globals.py')
-rw-r--r-- | yt_dlp/globals.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/yt_dlp/globals.py b/yt_dlp/globals.py new file mode 100644 index 000000000..e1c189d5a --- /dev/null +++ b/yt_dlp/globals.py @@ -0,0 +1,30 @@ +from collections import defaultdict + +# Please Note: Due to necessary changes and the complex nature involved in the plugin/globals system, +# no backwards compatibility is guaranteed for the plugin system API. +# However, we will still try our best. + + +class Indirect: + def __init__(self, initial, /): + self.value = initial + + def __repr__(self, /): + return f'{type(self).__name__}({self.value!r})' + + +postprocessors = Indirect({}) +extractors = Indirect({}) + +# Plugins +all_plugins_loaded = Indirect(False) +plugin_specs = Indirect({}) +plugin_dirs = Indirect(['default']) + +plugin_ies = Indirect({}) +plugin_pps = Indirect({}) +plugin_ies_overrides = Indirect(defaultdict(list)) + +# Misc +IN_CLI = Indirect(False) +LAZY_EXTRACTORS = Indirect(False) # `False`=force, `None`=disabled, `True`=enabled |