diff options
author | Philipp Hagemeister <[email protected]> | 2013-12-16 04:15:10 +0100 |
---|---|---|
committer | Philipp Hagemeister <[email protected]> | 2013-12-16 04:15:10 +0100 |
commit | 525ef9227f178a965a2010971256a1929af8cdd3 (patch) | |
tree | 8ef81a9bfead0ee225bfde1b2a93691edafe7206 /youtube_dl/__init__.py | |
parent | c0ba0f485914330d5b4d7b175fb1da3724d4bda0 (diff) | |
download | youtube-dl-525ef9227f178a965a2010971256a1929af8cdd3.tar.gz youtube-dl-525ef9227f178a965a2010971256a1929af8cdd3.zip |
Add --get-duration (Fixes #859)
Diffstat (limited to 'youtube_dl/__init__.py')
-rw-r--r-- | youtube_dl/__init__.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py index 437c37541..d5c0a3643 100644 --- a/youtube_dl/__init__.py +++ b/youtube_dl/__init__.py @@ -298,6 +298,9 @@ def parseOpts(overrideArguments=None): verbosity.add_option('--get-description', action='store_true', dest='getdescription', help='simulate, quiet but print video description', default=False) + verbosity.add_option('--get-duration', + action='store_true', dest='getduration', + help='simulate, quiet but print video length', default=False) verbosity.add_option('--get-filename', action='store_true', dest='getfilename', help='simulate, quiet but print output filename', default=False) @@ -617,22 +620,25 @@ def _real_main(argv=None): u' file! Use "{0}.%(ext)s" instead of "{0}" as the output' u' 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 + ydl_opts = { 'usenetrc': opts.usenetrc, 'username': opts.username, 'password': opts.password, 'videopassword': opts.videopassword, - 'quiet': (opts.quiet or opts.geturl or opts.gettitle or opts.getid or opts.getthumbnail or opts.getdescription or opts.getfilename or opts.getformat or opts.dumpjson), + 'quiet': (opts.quiet or any_printing), 'forceurl': opts.geturl, 'forcetitle': opts.gettitle, 'forceid': opts.getid, 'forcethumbnail': opts.getthumbnail, 'forcedescription': opts.getdescription, + 'forceduration': opts.getduration, 'forcefilename': opts.getfilename, 'forceformat': opts.getformat, 'forcejson': opts.dumpjson, 'simulate': opts.simulate, - 'skip_download': (opts.skip_download or opts.simulate or opts.geturl or opts.gettitle or opts.getid or opts.getthumbnail or opts.getdescription or opts.getfilename or opts.getformat or opts.dumpjson), + 'skip_download': (opts.skip_download or opts.simulate or any_printing), 'format': opts.format, 'format_limit': opts.format_limit, 'listformats': opts.listformats, |