twitch.tv chapters (#810): print out start and end time

This commit is contained in:
Philipp Hagemeister 2013-05-04 12:02:18 +02:00
parent c43e57242e
commit 4539dd30e6
2 changed files with 14 additions and 2 deletions

View file

@ -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):