Browse Source

[comedycentral] Duration can now be a float (Fixes #2647)

totalwebcasting
Philipp Hagemeister 11 years ago
parent
commit
43f775e4ca
2 changed files with 6 additions and 2 deletions
  1. +2
    -2
      youtube_dl/extractor/comedycentral.py
  2. +4
    -0
      youtube_dl/utils.py

+ 2
- 2
youtube_dl/extractor/comedycentral.py View File

@ -8,7 +8,7 @@ from ..utils import (
compat_str, compat_str,
compat_urllib_parse, compat_urllib_parse,
ExtractorError, ExtractorError,
int_or_none,
float_or_none,
unified_strdate, unified_strdate,
) )
@ -159,7 +159,7 @@ class ComedyCentralShowsIE(InfoExtractor):
thumbnail = itemEl.find('.//{http://search.yahoo.com/mrss/}thumbnail').attrib.get('url') thumbnail = itemEl.find('.//{http://search.yahoo.com/mrss/}thumbnail').attrib.get('url')
content = itemEl.find('.//{http://search.yahoo.com/mrss/}content') 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'] mediagen_url = content.attrib['url']
guid = itemEl.find('.//guid').text.rpartition(':')[-1] guid = itemEl.find('.//guid').text.rpartition(':')[-1]


+ 4
- 0
youtube_dl/utils.py View File

@ -1181,6 +1181,10 @@ def int_or_none(v, scale=1):
return v if v is None else (int(v) // scale) 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): def parse_duration(s):
if s is None: if s is None:
return None return None


Loading…
Cancel
Save