aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorPhilipp Hagemeister <[email protected]>2011-09-15 20:24:21 +0200
committerPhilipp Hagemeister <[email protected]>2011-09-15 20:24:21 +0200
commit67035ede49520a3cab088315976d20d5dcbf2b26 (patch)
tree4d0992e99ed7e3495c292b0278eb6d57301cbf13
parenteb6c37da432a8281675fd9740488ac967f83c782 (diff)
downloadyoutube-dl-67035ede49520a3cab088315976d20d5dcbf2b26.tar.gz
youtube-dl-67035ede49520a3cab088315976d20d5dcbf2b26.zip
Fix progress message when Content-Length is not set
-rwxr-xr-xyoutube-dl9
1 files changed, 6 insertions, 3 deletions
diff --git a/youtube-dl b/youtube-dl
index 8cfbf3cb3..1d7087a34 100755
--- a/youtube-dl
+++ b/youtube-dl
@@ -982,10 +982,13 @@ class FileDownloader(object):
block_size = self.best_block_size(after - before, len(data_block))
# Progress message
- percent_str = self.calc_percent(byte_counter, data_len)
- eta_str = self.calc_eta(start, time.time(), data_len - resume_len, byte_counter - resume_len)
speed_str = self.calc_speed(start, time.time(), byte_counter - resume_len)
- self.report_progress(percent_str, data_len_str, speed_str, eta_str)
+ if data_len is None:
+ self.report_progress('Unknown %', data_len_str, speed_str, 'Unknown ETA')
+ else:
+ percent_str = self.calc_percent(byte_counter, data_len)
+ eta_str = self.calc_eta(start, time.time(), data_len - resume_len, byte_counter - resume_len)
+ self.report_progress(percent_str, data_len_str, speed_str, eta_str)
# Apply rate limit
self.slow_down(start, byte_counter - resume_len)