1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-12-22 22:47:55 +01:00

Add --print-json (Closes #2845)

This commit is contained in:
Philipp Hagemeister 2015-01-08 18:01:41 +01:00
parent 92b065dc53
commit c0bdf32a3c
2 changed files with 10 additions and 4 deletions

View File

@ -197,7 +197,8 @@ def _real_main(argv=None):
' file! Use "{0}.%(ext)s" instead of "{0}" as the output' ' file! Use "{0}.%(ext)s" instead of "{0}" as the output'
' template'.format(outtmpl)) ' template'.format(outtmpl))
any_printing = opts.geturl or opts.gettitle or opts.getid or opts.getthumbnail or opts.getdescription or opts.getfilename or opts.getformat or opts.getduration or opts.dumpjson or opts.dump_single_json any_getting = opts.geturl or opts.gettitle or opts.getid or opts.getthumbnail or opts.getdescription or opts.getfilename or opts.getformat or opts.getduration or opts.dumpjson or opts.dump_single_json
any_printing = opts.print_json
download_archive_fn = compat_expanduser(opts.download_archive) if opts.download_archive is not None else opts.download_archive download_archive_fn = compat_expanduser(opts.download_archive) if opts.download_archive is not None else opts.download_archive
# PostProcessors # PostProcessors
@ -243,7 +244,7 @@ def _real_main(argv=None):
'password': opts.password, 'password': opts.password,
'twofactor': opts.twofactor, 'twofactor': opts.twofactor,
'videopassword': opts.videopassword, 'videopassword': opts.videopassword,
'quiet': (opts.quiet or any_printing), 'quiet': (opts.quiet or any_getting or any_printing),
'no_warnings': opts.no_warnings, 'no_warnings': opts.no_warnings,
'forceurl': opts.geturl, 'forceurl': opts.geturl,
'forcetitle': opts.gettitle, 'forcetitle': opts.gettitle,
@ -253,9 +254,9 @@ def _real_main(argv=None):
'forceduration': opts.getduration, 'forceduration': opts.getduration,
'forcefilename': opts.getfilename, 'forcefilename': opts.getfilename,
'forceformat': opts.getformat, 'forceformat': opts.getformat,
'forcejson': opts.dumpjson, 'forcejson': opts.dumpjson or opts.print_json,
'dump_single_json': opts.dump_single_json, 'dump_single_json': opts.dump_single_json,
'simulate': opts.simulate or any_printing, 'simulate': opts.simulate or any_getting,
'skip_download': opts.skip_download, 'skip_download': opts.skip_download,
'format': opts.format, 'format': opts.format,
'format_limit': opts.format_limit, 'format_limit': opts.format_limit,

View File

@ -445,6 +445,11 @@ def parseOpts(overrideArguments=None):
'-J', '--dump-single-json', '-J', '--dump-single-json',
action='store_true', dest='dump_single_json', default=False, action='store_true', dest='dump_single_json', default=False,
help='simulate, quiet but print JSON information for each command-line argument. If the URL refers to a playlist, dump the whole playlist information in a single line.') help='simulate, quiet but print JSON information for each command-line argument. If the URL refers to a playlist, dump the whole playlist information in a single line.')
verbosity.add_option(
'--print-json',
action='store_true', dest='print_json', default=False,
help='Be quiet and print the video information as JSON (video is still being downloaded).',
)
verbosity.add_option( verbosity.add_option(
'--newline', '--newline',
action='store_true', dest='progress_with_newline', default=False, action='store_true', dest='progress_with_newline', default=False,