aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/__init__.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2022-01-24 03:04:19 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2022-01-24 03:24:15 +0530
commitbb66c24797edd8740a27efb8d77669dbb0e859b7 (patch)
tree651177ab2d75883775606133644884ac0a4900af /yt_dlp/__init__.py
parent2edb38e8caa8cadd3a2effd75d8bf47e31f94f9c (diff)
downloadhypervideo-pre-bb66c24797edd8740a27efb8d77669dbb0e859b7.tar.lz
hypervideo-pre-bb66c24797edd8740a27efb8d77669dbb0e859b7.tar.xz
hypervideo-pre-bb66c24797edd8740a27efb8d77669dbb0e859b7.zip
Add option `--print-to-file`
Closes #2372
Diffstat (limited to 'yt_dlp/__init__.py')
-rw-r--r--yt_dlp/__init__.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/yt_dlp/__init__.py b/yt_dlp/__init__.py
index c5e647c23..f9ebfa053 100644
--- a/yt_dlp/__init__.py
+++ b/yt_dlp/__init__.py
@@ -356,6 +356,10 @@ def _real_main(argv=None):
for type_, tmpl_list in opts.forceprint.items():
for tmpl in tmpl_list:
validate_outtmpl(tmpl, f'{type_} print template')
+ for type_, tmpl_list in opts.print_to_file.items():
+ for tmpl, file in tmpl_list:
+ validate_outtmpl(tmpl, f'{type_} print-to-file template')
+ validate_outtmpl(file, f'{type_} print-to-file filename')
validate_outtmpl(opts.sponsorblock_chapter_title, 'SponsorBlock chapter title')
for k, tmpl in opts.progress_template.items():
k = f'{k[:-6]} console title' if '-title' in k else f'{k} progress'
@@ -663,6 +667,7 @@ def _real_main(argv=None):
'forcefilename': opts.getfilename,
'forceformat': opts.getformat,
'forceprint': opts.forceprint,
+ 'print_to_file': opts.print_to_file,
'forcejson': opts.dumpjson or opts.print_json,
'dump_single_json': opts.dump_single_json,
'force_write_download_archive': opts.force_write_download_archive,