diff options
author | Matthew <coletdjnz@protonmail.com> | 2023-01-01 04:29:22 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-01 04:29:22 +0000 |
commit | 8e40b9d1ec132ae1bcac50b3ee520ece46ac9c55 (patch) | |
tree | 910f1b931be45b9293dc763d9f46c33f7159c199 /ytdlp_plugins/postprocessor/sample.py | |
parent | 2fb0f858686c46abc50a0e253245afe750746775 (diff) | |
download | hypervideo-pre-8e40b9d1ec132ae1bcac50b3ee520ece46ac9c55.tar.lz hypervideo-pre-8e40b9d1ec132ae1bcac50b3ee520ece46ac9c55.tar.xz hypervideo-pre-8e40b9d1ec132ae1bcac50b3ee520ece46ac9c55.zip |
Improve plugin architecture (#5553)
to make plugins easier to develop and use:
* Plugins are now loaded as namespace packages.
* Plugins can be loaded in any distribution of yt-dlp (binary, pip, source, etc.).
* Plugin packages can be installed and managed via pip, or dropped into any of the documented locations.
* Users do not need to edit any code files to install plugins.
* Backwards-compatible with previous plugin architecture.
As a side-effect, yt-dlp will now search in a few more locations for config files.
Closes https://github.com/yt-dlp/yt-dlp/issues/1389
Authored by: flashdagger, coletdjnz, pukkandan, Grub4K
Co-authored-by: Marcel <flashdagger@googlemail.com>
Co-authored-by: pukkandan <pukkandan.ytdlp@gmail.com>
Co-authored-by: Simon Sawicki <accounts@grub4k.xyz>
Diffstat (limited to 'ytdlp_plugins/postprocessor/sample.py')
-rw-r--r-- | ytdlp_plugins/postprocessor/sample.py | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/ytdlp_plugins/postprocessor/sample.py b/ytdlp_plugins/postprocessor/sample.py deleted file mode 100644 index 4563e1c11..000000000 --- a/ytdlp_plugins/postprocessor/sample.py +++ /dev/null @@ -1,26 +0,0 @@ -# ⚠ Don't use relative imports -from yt_dlp.postprocessor.common import PostProcessor - - -# ℹ️ See the docstring of yt_dlp.postprocessor.common.PostProcessor -class SamplePluginPP(PostProcessor): - def __init__(self, downloader=None, **kwargs): - # ⚠ Only kwargs can be passed from the CLI, and all argument values will be string - # Also, "downloader", "when" and "key" are reserved names - super().__init__(downloader) - self._kwargs = kwargs - - # ℹ️ See docstring of yt_dlp.postprocessor.common.PostProcessor.run - def run(self, info): - if info.get('_type', 'video') != 'video': # PP was called for playlist - self.to_screen(f'Post-processing playlist {info.get("id")!r} with {self._kwargs}') - elif info.get('filepath'): # PP was called after download (default) - filepath = info.get('filepath') - self.to_screen(f'Post-processed {filepath!r} with {self._kwargs}') - elif info.get('requested_downloads'): # PP was called after_video - filepaths = [f.get('filepath') for f in info.get('requested_downloads')] - self.to_screen(f'Post-processed {filepaths!r} with {self._kwargs}') - else: # PP was called before actual download - filepath = info.get('_filename') - self.to_screen(f'Pre-processed {filepath!r} with {self._kwargs}') - return [], info # return list_of_files_to_delete, info_dict |