diff --git a/panasonic.py b/panasonic.py index ce2973d..6e235a4 100755 --- a/panasonic.py +++ b/panasonic.py @@ -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))