aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/utils.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2013-05-04 12:02:18 +0200
committerPhilipp Hagemeister <phihag@phihag.de>2013-05-04 12:02:18 +0200
commit4539dd30e6c00a50760094e7a41744843d659cb1 (patch)
tree7bd5d78b89be688b7e7338eecbadf1c0dc9bb61a /youtube_dl/utils.py
parentc43e57242e10eae327d4348390cfb9e574fad5dd (diff)
twitch.tv chapters (#810): print out start and end time
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r--youtube_dl/utils.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index 6c5b5df4c..4ec0ebfe1 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -430,6 +430,14 @@ def decodeOption(optval):
assert isinstance(optval, compat_str)
return optval
+def formatSeconds(secs):
+ if secs > 3600:
+ return '%d:%02d:%02d' % (secs // 3600, (secs % 3600) // 60, secs % 60)
+ elif secs > 60:
+ return '%d:%02d' % (secs // 60, secs % 60)
+ else:
+ return '%d' % secs
+
class ExtractorError(Exception):
"""Error during info extraction."""
def __init__(self, msg, tb=None):