Improve robustness in case of bad packets.
This commit is contained in:
11
panasonic.py
11
panasonic.py
@@ -277,11 +277,12 @@ def downloadMovie(url, outputFileName):
|
|||||||
output.write(chunk)
|
output.write(chunk)
|
||||||
if nbiters == 1000:
|
if nbiters == 1000:
|
||||||
lastTS = getLastTSFromFD(outputFD)
|
lastTS = getLastTSFromFD(outputFD)
|
||||||
delta = lastTS-initialTS
|
if lastTS != None:
|
||||||
ratio = delta/total
|
delta = lastTS-initialTS
|
||||||
length = fstat(outputFD).st_size
|
ratio = delta/total
|
||||||
estimatedLength = ceil(length/ratio)
|
length = fstat(outputFD).st_size
|
||||||
pb.total = estimatedLength
|
estimatedLength = ceil(length/ratio)
|
||||||
|
pb.total = estimatedLength
|
||||||
lseek(outputFD, 0, SEEK_END)
|
lseek(outputFD, 0, SEEK_END)
|
||||||
nbiters = 0
|
nbiters = 0
|
||||||
pb.update(len(chunk))
|
pb.update(len(chunk))
|
||||||
|
|||||||
Reference in New Issue
Block a user