Improve robustness in case of bad packets.

This commit is contained in:
Frédéric Tronel
2024-06-02 15:13:28 +02:00
parent 3e8f868d87
commit f5393cda3b

View File

@@ -277,11 +277,12 @@ def downloadMovie(url, outputFileName):
output.write(chunk)
if nbiters == 1000:
lastTS = getLastTSFromFD(outputFD)
delta = lastTS-initialTS
ratio = delta/total
length = fstat(outputFD).st_size
estimatedLength = ceil(length/ratio)
pb.total = estimatedLength
if lastTS != None:
delta = lastTS-initialTS
ratio = delta/total
length = fstat(outputFD).st_size
estimatedLength = ceil(length/ratio)
pb.total = estimatedLength
lseek(outputFD, 0, SEEK_END)
nbiters = 0
pb.update(len(chunk))