aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2022-02-02 06:08:40 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2022-02-02 06:09:10 +0530
commitd16df59db558cdd208e940090e5be3c0fbcd2d58 (patch)
treec55a3153bb7b4a008bf721c7530314771354caaf
parent63c3ee4f63c6f1f9e2a3fac43f2d257c1b223916 (diff)
downloadhypervideo-pre-d16df59db558cdd208e940090e5be3c0fbcd2d58.tar.lz
hypervideo-pre-d16df59db558cdd208e940090e5be3c0fbcd2d58.tar.xz
hypervideo-pre-d16df59db558cdd208e940090e5be3c0fbcd2d58.zip
Fix `--compat-options list-formats`
Closes #2481
-rw-r--r--yt_dlp/utils.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py
index 2b33e1ec9..8ba0c2d6c 100644
--- a/yt_dlp/utils.py
+++ b/yt_dlp/utils.py
@@ -3430,12 +3430,11 @@ def render_table(header_row, data, delim=False, extra_gap=0, hide_empty=False):
return [max(width(str(v)) for v in col) for col in zip(*table)]
def filter_using_list(row, filterArray):
- return [col for (take, col) in zip(filterArray, row) if take]
+ return [col for take, col in itertools.zip_longest(filterArray, row, fillvalue=True) if take]
- if hide_empty:
- max_lens = get_max_lens(data)
- header_row = filter_using_list(header_row, max_lens)
- data = [filter_using_list(row, max_lens) for row in data]
+ max_lens = get_max_lens(data) if hide_empty else []
+ header_row = filter_using_list(header_row, max_lens)
+ data = [filter_using_list(row, max_lens) for row in data]
table = [header_row] + data
max_lens = get_max_lens(table)