From 43f775e4cade8868cda32bc71e3d84ed62665c58 Mon Sep 17 00:00:00 2001 From: Philipp Hagemeister Date: Fri, 28 Mar 2014 23:06:34 +0100 Subject: [PATCH] [comedycentral] Duration can now be a float (Fixes #2647) --- youtube_dl/extractor/comedycentral.py | 4 ++-- youtube_dl/utils.py | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/youtube_dl/extractor/comedycentral.py b/youtube_dl/extractor/comedycentral.py index ea1675cf6..60c0a4f5d 100644 --- a/youtube_dl/extractor/comedycentral.py +++ b/youtube_dl/extractor/comedycentral.py @@ -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] diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 29c9b1a4c..b5326c0cb 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -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 -- 2.22.2