aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/YoutubeDL.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2013-12-16 04:15:10 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2013-12-16 04:15:10 +0100
commit525ef9227f178a965a2010971256a1929af8cdd3 (patch)
tree8ef81a9bfead0ee225bfde1b2a93691edafe7206 /youtube_dl/YoutubeDL.py
parentc0ba0f485914330d5b4d7b175fb1da3724d4bda0 (diff)
downloadyoutube-dl-525ef9227f178a965a2010971256a1929af8cdd3.tar.xz
Add --get-duration (Fixes #859)
Diffstat (limited to 'youtube_dl/YoutubeDL.py')
-rw-r--r--youtube_dl/YoutubeDL.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py
index ab68d013c..52bd8e0e3 100644
--- a/youtube_dl/YoutubeDL.py
+++ b/youtube_dl/YoutubeDL.py
@@ -34,6 +34,7 @@ from .utils import (
encodeFilename,
ExtractorError,
format_bytes,
+ formatSeconds,
get_term_width,
locked_file,
make_HTTPS_handler,
@@ -94,6 +95,7 @@ class YoutubeDL(object):
forcethumbnail: Force printing thumbnail URL.
forcedescription: Force printing description.
forcefilename: Force printing final filename.
+ forceduration: Force printing duration.
forcejson: Force printing info_dict as JSON.
simulate: Do not download the video files.
format: Video format code.
@@ -765,6 +767,8 @@ class YoutubeDL(object):
self.to_stdout(info_dict['description'])
if self.params.get('forcefilename', False) and filename is not None:
self.to_stdout(filename)
+ if self.params.get('forceduration', False) and info_dict.get('duration') is not None:
+ self.to_stdout(formatSeconds(info_dict['duration']))
if self.params.get('forceformat', False):
self.to_stdout(info_dict['format'])
if self.params.get('forcejson', False):