diff options
author | Imran Hussain <ih@imranh.co.uk> | 2024-10-20 18:10:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-20 17:10:26 +0000 |
commit | 0f593dca9fa995d88eb763170a932da61c8f24dc (patch) | |
tree | 601f201d5981bb0b12b6a01e782be97849cc177e /yt_dlp/plugins.py | |
parent | 8de431ec97a4b62b73df8f686b6e21e462775336 (diff) |
Add option `--plugin-dirs` (#11277)
Closes #3260
Authored by: imranh2, coletdjnz
Co-authored-by: coletdjnz <coletdjnz@protonmail.com>
Diffstat (limited to 'yt_dlp/plugins.py')
-rw-r--r-- | yt_dlp/plugins.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/yt_dlp/plugins.py b/yt_dlp/plugins.py index d777d14e7..204558d60 100644 --- a/yt_dlp/plugins.py +++ b/yt_dlp/plugins.py @@ -15,6 +15,7 @@ from zipfile import ZipFile from .compat import functools # isort: split from .utils import ( + Config, get_executable_path, get_system_config_dirs, get_user_config_dirs, @@ -84,6 +85,12 @@ class PluginFinder(importlib.abc.MetaPathFinder): with contextlib.suppress(ValueError): # Added when running __main__.py directly candidate_locations.remove(Path(__file__).parent) + # TODO(coletdjnz): remove when plugin globals system is implemented + if Config._plugin_dirs: + candidate_locations.extend(_get_package_paths( + *Config._plugin_dirs, + containing_folder='')) + parts = Path(*fullname.split('.')) for path in orderedSet(candidate_locations, lazy=True): candidate = path / parts |