aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/utils.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2022-06-11 00:33:54 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2022-06-11 05:00:12 +0530
commit56ba69e4c991e81a449882258be08d0b6b98c648 (patch)
tree8ee7d44819c3be3ee93001c3dec791c3804a9acb /yt_dlp/utils.py
parentd05460e5fee0dca9ab7463c78c630653fb37dcde (diff)
downloadhypervideo-pre-56ba69e4c991e81a449882258be08d0b6b98c648.tar.lz
hypervideo-pre-56ba69e4c991e81a449882258be08d0b6b98c648.tar.xz
hypervideo-pre-56ba69e4c991e81a449882258be08d0b6b98c648.zip
[cleanup] Misc fixes
Closes #4027
Diffstat (limited to 'yt_dlp/utils.py')
-rw-r--r--yt_dlp/utils.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py
index 45af4ec61..137d29d0a 100644
--- a/yt_dlp/utils.py
+++ b/yt_dlp/utils.py
@@ -3498,13 +3498,13 @@ def match_filter_func(filters):
def download_range_func(chapters, ranges):
def inner(info_dict, ydl):
warning = ('There are no chapters matching the regex' if info_dict.get('chapters')
- else 'Chapter information is unavailable')
+ else 'Cannot match chapters since chapter information is unavailable')
for regex in chapters or []:
for i, chapter in enumerate(info_dict.get('chapters') or []):
if re.search(regex, chapter['title']):
warning = None
yield {**chapter, 'index': i}
- if warning:
+ if chapters and warning:
ydl.to_screen(f'[info] {info_dict["id"]}: {warning}')
yield from ({'start_time': start, 'end_time': end} for start, end in ranges or [])
@@ -4903,9 +4903,9 @@ def to_high_limit_path(path):
return path
-def format_field(obj, field=None, template='%s', ignore=(None, ''), default='', func=None):
+def format_field(obj, field=None, template='%s', ignore=NO_DEFAULT, default='', func=None):
val = traverse_obj(obj, *variadic(field))
- if val in ignore:
+ if (not val and val != 0) if ignore is NO_DEFAULT else val in ignore:
return default
return template % (func(val) if func else val)