@ -55,16 +55,17 @@ def parse_segment_path(path):
if len ( parts ) != 4 :
if len ( parts ) != 4 :
raise ValueError ( " Not enough dashes in filename " )
raise ValueError ( " Not enough dashes in filename " )
time , duration , type , hash = parts
time , duration , type , hash = parts
if type not in ( ' full ' , ' partial ' ):
if type not in ( ' full ' , ' partial ' , ' temp ' ):
raise ValueError ( " Unknown type {!r} " . format ( type ) )
raise ValueError ( " Unknown type {!r} " . format ( type ) )
hash = None if type == ' temp ' else unpadded_b64_decode ( hash )
return SegmentInfo (
return SegmentInfo (
path = path ,
path = path ,
stream = stream ,
stream = stream ,
variant = variant ,
variant = variant ,
start = datetime . datetime . strptime ( " {} : {} " . format ( hour , time ) , " % Y- % m- %d T % H: % M: % S. %f " ) ,
start = datetime . datetime . strptime ( " {} : {} " . format ( hour , time ) , " % Y- % m- %d T % H: % M: % S. %f " ) ,
duration = datetime . timedelta ( seconds = float ( duration ) ) ,
duration = datetime . timedelta ( seconds = float ( duration ) ) ,
is_partial = type == " partia l" ,
is_partial = type != " ful l" ,
hash = unpadded_b64_decode ( hash ) ,
hash = hash ,
)
)
except ValueError as e :
except ValueError as e :
# wrap error but preserve original traceback
# wrap error but preserve original traceback