]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
[comedycentral] Duration can now be a float (Fixes #2647)
authorPhilipp Hagemeister <phihag@phihag.de>
Fri, 28 Mar 2014 22:06:34 +0000 (23:06 +0100)
committerPhilipp Hagemeister <phihag@phihag.de>
Fri, 28 Mar 2014 22:06:34 +0000 (23:06 +0100)
youtube_dl/extractor/comedycentral.py
youtube_dl/utils.py

index ea1675cf6f82a50d33d9b3996254ccf9ab737613..60c0a4f5dbc3c98468a184195e03dd39da299e95 100644 (file)
@@ -8,7 +8,7 @@ from ..utils import (
     compat_str,
     compat_urllib_parse,
     ExtractorError,
-    int_or_none,
+    float_or_none,
     unified_strdate,
 )
 
@@ -159,7 +159,7 @@ class ComedyCentralShowsIE(InfoExtractor):
             thumbnail = itemEl.find('.//{http://search.yahoo.com/mrss/}thumbnail').attrib.get('url')
 
             content = itemEl.find('.//{http://search.yahoo.com/mrss/}content')
-            duration = int_or_none(content.attrib.get('duration'))
+            duration = float_or_none(content.attrib.get('duration'))
             mediagen_url = content.attrib['url']
             guid = itemEl.find('.//guid').text.rpartition(':')[-1]
 
index 29c9b1a4cb6fdef970617fd6b556454cb7eff07d..b5326c0cba027e1f33ecb636a9de9c3c98919782 100644 (file)
@@ -1181,6 +1181,10 @@ def int_or_none(v, scale=1):
     return v if v is None else (int(v) // scale)
 
 
+def float_or_none(v, scale=1):
+    return v if v is None else (float(v) / scale)
+
+
 def parse_duration(s):
     if s is None:
         return None