aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/downloader/common.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2022-04-29 07:18:36 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2022-04-29 07:39:33 +0530
commit1d485a1a799bbeeb2faea0595676ca7d4c0f3716 (patch)
tree17e1f06c8a4e3a1fa8083c2017812988e6acc8f5 /yt_dlp/downloader/common.py
parent0a41f331cc3e06007b8d1abe104da196c565b505 (diff)
downloadhypervideo-pre-1d485a1a799bbeeb2faea0595676ca7d4c0f3716.tar.lz
hypervideo-pre-1d485a1a799bbeeb2faea0595676ca7d4c0f3716.tar.xz
hypervideo-pre-1d485a1a799bbeeb2faea0595676ca7d4c0f3716.zip
[cleanup] Misc fixes
Closes #3565, https://github.com/yt-dlp/yt-dlp/issues/3514#issuecomment-1105944364
Diffstat (limited to 'yt_dlp/downloader/common.py')
-rw-r--r--yt_dlp/downloader/common.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/yt_dlp/downloader/common.py b/yt_dlp/downloader/common.py
index 022a9cd17..d79863300 100644
--- a/yt_dlp/downloader/common.py
+++ b/yt_dlp/downloader/common.py
@@ -12,6 +12,7 @@ from ..minicurses import (
QuietMultilinePrinter,
)
from ..utils import (
+ NUMBER_RE,
LockingUnsupportedError,
Namespace,
decodeArgument,
@@ -91,7 +92,8 @@ class FileDownloader:
'trouble',
'write_debug',
):
- setattr(self, func, getattr(ydl, func))
+ if not hasattr(self, func):
+ setattr(self, func, getattr(ydl, func))
def to_screen(self, *args, **kargs):
self.ydl.to_screen(*args, quiet=self.params.get('quiet'), **kargs)
@@ -170,7 +172,7 @@ class FileDownloader:
@staticmethod
def parse_bytes(bytestr):
"""Parse a string indicating a byte quantity into an integer."""
- matchobj = re.match(r'(?i)^(\d+(?:\.\d+)?)([kMGTPEZY]?)$', bytestr)
+ matchobj = re.match(rf'(?i)^({NUMBER_RE})([kMGTPEZY]?)$', bytestr)
if matchobj is None:
return None
number = float(matchobj.group(1))