aboutsummaryrefslogtreecommitdiff
path: root/yt_dlp/postprocessor/common.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2022-08-30 20:58:28 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2022-08-30 21:03:07 +0530
commitda4db748fa813a8de684d5ab699b8f561b982e35 (patch)
treeb3a393bb7d9ed79c698783f3ce21fc08ac642455 /yt_dlp/postprocessor/common.py
parente1eabd7beb4cc83338a7422546ae1c9ae8b2097f (diff)
[utils] Add `deprecation_warning`
See https://github.com/yt-dlp/yt-dlp/pull/2173#issuecomment-1097021515
Diffstat (limited to 'yt_dlp/postprocessor/common.py')
-rw-r--r--yt_dlp/postprocessor/common.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/yt_dlp/postprocessor/common.py b/yt_dlp/postprocessor/common.py
index 20d890df0..44feda427 100644
--- a/yt_dlp/postprocessor/common.py
+++ b/yt_dlp/postprocessor/common.py
@@ -7,10 +7,10 @@ from ..utils import (
PostProcessingError,
RetryManager,
_configuration_args,
+ deprecation_warning,
encodeFilename,
network_exceptions,
sanitized_Request,
- write_string,
)
@@ -73,10 +73,14 @@ class PostProcessor(metaclass=PostProcessorMetaClass):
if self._downloader:
return self._downloader.report_warning(text, *args, **kwargs)
- def deprecation_warning(self, text):
+ def deprecation_warning(self, msg):
+ warn = getattr(self._downloader, 'deprecation_warning', deprecation_warning)
+ return warn(msg, stacklevel=1)
+
+ def deprecated_feature(self, msg):
if self._downloader:
- return self._downloader.deprecation_warning(text)
- write_string(f'DeprecationWarning: {text}')
+ return self._downloader.deprecated_feature(msg)
+ return deprecation_warning(msg, stacklevel=1)
def report_error(self, text, *args, **kwargs):
self.deprecation_warning('"yt_dlp.postprocessor.PostProcessor.report_error" is deprecated. '