diff options
Diffstat (limited to 'yt_dlp/postprocessor')
-rw-r--r-- | yt_dlp/postprocessor/common.py | 6 | ||||
-rw-r--r-- | yt_dlp/postprocessor/exec.py | 9 | ||||
-rw-r--r-- | yt_dlp/postprocessor/ffmpeg.py | 7 | ||||
-rw-r--r-- | yt_dlp/postprocessor/metadataparser.py | 18 | ||||
-rw-r--r-- | yt_dlp/postprocessor/sponskrub.py | 7 |
5 files changed, 39 insertions, 8 deletions
diff --git a/yt_dlp/postprocessor/common.py b/yt_dlp/postprocessor/common.py index b36716743..ab9eb6acf 100644 --- a/yt_dlp/postprocessor/common.py +++ b/yt_dlp/postprocessor/common.py @@ -9,6 +9,7 @@ from ..utils import ( _configuration_args, encodeFilename, PostProcessingError, + write_string, ) @@ -74,6 +75,11 @@ class PostProcessor(metaclass=PostProcessorMetaClass): if self._downloader: return self._downloader.report_warning(text, *args, **kwargs) + def deprecation_warning(self, text): + if self._downloader: + return self._downloader.deprecation_warning(text) + write_string(f'DeprecationWarning: {text}') + def report_error(self, text, *args, **kwargs): # Exists only for compatibility. Do not use if self._downloader: diff --git a/yt_dlp/postprocessor/exec.py b/yt_dlp/postprocessor/exec.py index 7a3cb4999..28a7c3d70 100644 --- a/yt_dlp/postprocessor/exec.py +++ b/yt_dlp/postprocessor/exec.py @@ -38,5 +38,10 @@ class ExecPP(PostProcessor): return [], info -class ExecAfterDownloadPP(ExecPP): # for backward compatibility - pass +# Deprecated +class ExecAfterDownloadPP(ExecPP): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.deprecation_warning( + 'yt_dlp.postprocessor.ExecAfterDownloadPP is deprecated ' + 'and may be removed in a future version. Use yt_dlp.postprocessor.ExecPP instead') diff --git a/yt_dlp/postprocessor/ffmpeg.py b/yt_dlp/postprocessor/ffmpeg.py index f712547a8..609f97e47 100644 --- a/yt_dlp/postprocessor/ffmpeg.py +++ b/yt_dlp/postprocessor/ffmpeg.py @@ -167,6 +167,13 @@ class FFmpegPostProcessor(PostProcessor): self.probe_basename = p break + if self.basename == 'avconv': + self.deprecation_warning( + 'Support for avconv is deprecated and may be removed in a future version. Use ffmpeg instead') + if self.probe_basename == 'avprobe': + self.deprecation_warning( + 'Support for avprobe is deprecated and may be removed in a future version. Use ffprobe instead') + @property def available(self): return self.basename is not None diff --git a/yt_dlp/postprocessor/metadataparser.py b/yt_dlp/postprocessor/metadataparser.py index 96aac9beb..54b2c5627 100644 --- a/yt_dlp/postprocessor/metadataparser.py +++ b/yt_dlp/postprocessor/metadataparser.py @@ -16,7 +16,7 @@ class MetadataParserPP(PostProcessor): for f in actions: action = f[0] assert isinstance(action, self.Actions) - self._actions.append(getattr(self, action._value_)(*f[1:])) + self._actions.append(getattr(self, action.value)(*f[1:])) @classmethod def validate_action(cls, action, *data): @@ -26,7 +26,7 @@ class MetadataParserPP(PostProcessor): ''' if not isinstance(action, cls.Actions): raise ValueError(f'{action!r} is not a valid action') - getattr(cls, action._value_)(cls, *data) + getattr(cls, action.value)(cls, *data) @staticmethod def field_to_template(tmpl): @@ -96,6 +96,7 @@ class MetadataParserPP(PostProcessor): return f +# Deprecated class MetadataFromFieldPP(MetadataParserPP): @classmethod def to_action(cls, f): @@ -108,9 +109,16 @@ class MetadataFromFieldPP(MetadataParserPP): match.group('out')) def __init__(self, downloader, formats): - MetadataParserPP.__init__(self, downloader, [self.to_action(f) for f in formats]) + super().__init__(self, downloader, [self.to_action(f) for f in formats]) + self.deprecation_warning( + 'yt_dlp.postprocessor.MetadataFromFieldPP is deprecated ' + 'and may be removed in a future version. Use yt_dlp.postprocessor.MetadataParserPP instead') -class MetadataFromTitlePP(MetadataParserPP): # for backward compatibility +# Deprecated +class MetadataFromTitlePP(MetadataParserPP): def __init__(self, downloader, titleformat): - MetadataParserPP.__init__(self, downloader, [(self.Actions.INTERPRET, 'title', titleformat)]) + super().__init__(self, downloader, [(self.Actions.INTERPRET, 'title', titleformat)]) + self.deprecation_warning( + 'yt_dlp.postprocessor.MetadataFromTitlePP is deprecated ' + 'and may be removed in a future version. Use yt_dlp.postprocessor.MetadataParserPP instead') diff --git a/yt_dlp/postprocessor/sponskrub.py b/yt_dlp/postprocessor/sponskrub.py index 37e7411e4..86149aeef 100644 --- a/yt_dlp/postprocessor/sponskrub.py +++ b/yt_dlp/postprocessor/sponskrub.py @@ -22,13 +22,18 @@ class SponSkrubPP(PostProcessor): _temp_ext = 'spons' _exe_name = 'sponskrub' - def __init__(self, downloader, path='', args=None, ignoreerror=False, cut=False, force=False): + def __init__(self, downloader, path='', args=None, ignoreerror=False, cut=False, force=False, _from_cli=False): PostProcessor.__init__(self, downloader) self.force = force self.cutout = cut self.args = str_or_none(args) or '' # For backward compatibility self.path = self.get_exe(path) + if not _from_cli: + self.deprecation_warning( + 'yt_dlp.postprocessor.SponSkrubPP support is deprecated and may be removed in a future version. ' + 'Use yt_dlp.postprocessor.SponsorBlock and yt_dlp.postprocessor.ModifyChaptersPP instead') + if not ignoreerror and self.path is None: if path: raise PostProcessingError('sponskrub not found in "%s"' % path) |