allow formated time for clip extraction too

This commit is contained in:
j 2012-09-23 10:32:35 +02:00
parent 20d1119b75
commit f39b2ddf3f

View file

@ -796,7 +796,11 @@ def video(request, id, resolution, format, index=None):
#FIXME: this needs to join segments if needed #FIXME: this needs to join segments if needed
t = request.GET.get('t') t = request.GET.get('t')
if t: if t:
t = map(float, t.split(',')) def parse_timestamp(s):
if ':' in s:
s = ox.time2ms(s) / 1000
return float(s)
t = map(parse_timestamp, t.split(','))
ext = '.%s' % format ext = '.%s' % format
content_type = mimetypes.guess_type(path)[0] content_type = mimetypes.guess_type(path)[0]
if len(t) == 2 and t[1] > t[0] and stream.info['duration']>=t[1]: if len(t) == 2 and t[1] > t[0] and stream.info['duration']>=t[1]: