mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-09-23 23:30:11 +00:00
[core] Load plugins on demand (#11305)
Some checks are pending
CodeQL / Analyze (python) (push) Waiting to run
Core Tests / Core Tests (ubuntu-latest, 3.10) (push) Waiting to run
Core Tests / Core Tests (ubuntu-latest, 3.11) (push) Waiting to run
Core Tests / Core Tests (ubuntu-latest, 3.12) (push) Waiting to run
Core Tests / Core Tests (ubuntu-latest, 3.13) (push) Waiting to run
Core Tests / Core Tests (ubuntu-latest, pypy-3.10) (push) Waiting to run
Core Tests / Core Tests (windows-latest, 3.10) (push) Waiting to run
Core Tests / Core Tests (windows-latest, 3.12) (push) Waiting to run
Core Tests / Core Tests (windows-latest, 3.13) (push) Waiting to run
Core Tests / Core Tests (windows-latest, 3.9) (push) Waiting to run
Core Tests / Core Tests (windows-latest, pypy-3.10) (push) Waiting to run
Download Tests / Quick Download Tests (push) Waiting to run
Download Tests / Full Download Tests (ubuntu-latest, 3.10) (push) Waiting to run
Download Tests / Full Download Tests (ubuntu-latest, 3.11) (push) Waiting to run
Download Tests / Full Download Tests (ubuntu-latest, 3.12) (push) Waiting to run
Download Tests / Full Download Tests (ubuntu-latest, 3.13) (push) Waiting to run
Download Tests / Full Download Tests (ubuntu-latest, pypy-3.10) (push) Waiting to run
Download Tests / Full Download Tests (windows-latest, 3.9) (push) Waiting to run
Download Tests / Full Download Tests (windows-latest, pypy-3.10) (push) Waiting to run
Quick Test / Core Test (push) Waiting to run
Quick Test / Code check (push) Waiting to run
Release (master) / release (push) Waiting to run
Release (master) / publish_pypi (push) Blocked by required conditions
Some checks are pending
CodeQL / Analyze (python) (push) Waiting to run
Core Tests / Core Tests (ubuntu-latest, 3.10) (push) Waiting to run
Core Tests / Core Tests (ubuntu-latest, 3.11) (push) Waiting to run
Core Tests / Core Tests (ubuntu-latest, 3.12) (push) Waiting to run
Core Tests / Core Tests (ubuntu-latest, 3.13) (push) Waiting to run
Core Tests / Core Tests (ubuntu-latest, pypy-3.10) (push) Waiting to run
Core Tests / Core Tests (windows-latest, 3.10) (push) Waiting to run
Core Tests / Core Tests (windows-latest, 3.12) (push) Waiting to run
Core Tests / Core Tests (windows-latest, 3.13) (push) Waiting to run
Core Tests / Core Tests (windows-latest, 3.9) (push) Waiting to run
Core Tests / Core Tests (windows-latest, pypy-3.10) (push) Waiting to run
Download Tests / Quick Download Tests (push) Waiting to run
Download Tests / Full Download Tests (ubuntu-latest, 3.10) (push) Waiting to run
Download Tests / Full Download Tests (ubuntu-latest, 3.11) (push) Waiting to run
Download Tests / Full Download Tests (ubuntu-latest, 3.12) (push) Waiting to run
Download Tests / Full Download Tests (ubuntu-latest, 3.13) (push) Waiting to run
Download Tests / Full Download Tests (ubuntu-latest, pypy-3.10) (push) Waiting to run
Download Tests / Full Download Tests (windows-latest, 3.9) (push) Waiting to run
Download Tests / Full Download Tests (windows-latest, pypy-3.10) (push) Waiting to run
Quick Test / Core Test (push) Waiting to run
Quick Test / Code check (push) Waiting to run
Release (master) / release (push) Waiting to run
Release (master) / publish_pypi (push) Blocked by required conditions
- Adds `--no-plugin-dirs` to disable plugin loading - `--plugin-dirs` now supports post-processors Authored by: coletdjnz, Grub4K, pukkandan
This commit is contained in:
@@ -33,15 +33,38 @@ from .movefilesafterdownload import MoveFilesAfterDownloadPP
|
||||
from .sponskrub import SponSkrubPP
|
||||
from .sponsorblock import SponsorBlockPP
|
||||
from .xattrpp import XAttrMetadataPP
|
||||
from ..plugins import load_plugins
|
||||
from ..globals import plugin_pps, postprocessors
|
||||
from ..plugins import PACKAGE_NAME, register_plugin_spec, PluginSpec
|
||||
from ..utils import deprecation_warning
|
||||
|
||||
_PLUGIN_CLASSES = load_plugins('postprocessor', 'PP')
|
||||
|
||||
def __getattr__(name):
|
||||
lookup = plugin_pps.value
|
||||
if name in lookup:
|
||||
deprecation_warning(
|
||||
f'Importing a plugin Post-Processor from {__name__} is deprecated. '
|
||||
f'Please import {PACKAGE_NAME}.postprocessor.{name} instead.')
|
||||
return lookup[name]
|
||||
|
||||
raise AttributeError(f'module {__name__!r} has no attribute {name!r}')
|
||||
|
||||
|
||||
def get_postprocessor(key):
|
||||
return globals()[key + 'PP']
|
||||
return postprocessors.value[key + 'PP']
|
||||
|
||||
|
||||
globals().update(_PLUGIN_CLASSES)
|
||||
__all__ = [name for name in globals() if name.endswith('PP')]
|
||||
__all__.extend(('FFmpegPostProcessor', 'PostProcessor'))
|
||||
register_plugin_spec(PluginSpec(
|
||||
module_name='postprocessor',
|
||||
suffix='PP',
|
||||
destination=postprocessors,
|
||||
plugin_destination=plugin_pps,
|
||||
))
|
||||
|
||||
_default_pps = {
|
||||
name: value
|
||||
for name, value in globals().items()
|
||||
if name.endswith('PP') or name in ('FFmpegPostProcessor', 'PostProcessor')
|
||||
}
|
||||
postprocessors.value.update(_default_pps)
|
||||
|
||||
__all__ = list(_default_pps.values())
|
||||
|
Reference in New Issue
Block a user