aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/utils.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2014-08-25 12:59:53 +0200
committerPhilipp Hagemeister <phihag@phihag.de>2014-08-25 12:59:53 +0200
commit7adcbe759419320bf6224247640e2cc9f058fa8a (patch)
tree7ab9cf0b2076dcf1e15b4819e0e17f13e7a03cd0 /youtube_dl/utils.py
parent8d31fa3cce47a7c9d932b872e277cf89eb3441a2 (diff)
[rtlnl] Extract duration
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r--youtube_dl/utils.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index 2b05fd7b7..53977cd2a 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -1338,7 +1338,7 @@ def parse_duration(s):
return None
m = re.match(
- r'(?:(?:(?P<hours>[0-9]+)[:h])?(?P<mins>[0-9]+)[:m])?(?P<secs>[0-9]+)s?(?::[0-9]+)?$', s)
+ r'(?:(?:(?P<hours>[0-9]+)[:h])?(?P<mins>[0-9]+)[:m])?(?P<secs>[0-9]+)s?(?::[0-9]+)?(?P<ms>\.[0-9]+)?$', s)
if not m:
return None
res = int(m.group('secs'))
@@ -1346,6 +1346,8 @@ def parse_duration(s):
res += int(m.group('mins')) * 60
if m.group('hours'):
res += int(m.group('hours')) * 60 * 60
+ if m.group('ms'):
+ res += float(m.group('ms'))
return res