aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2011-05-20 08:59:53 +0200
committerPhilipp Hagemeister <phihag@phihag.de>2011-09-15 19:07:53 +0200
commit10e7194db16c769cd8da98a8d541f7f5452afe84 (patch)
treed774bb0ba2f902bebe2f76d9431850204060358f
parentef357c4bf29277d939d122710051459afad26a5d (diff)
downloadyoutube-dl-10e7194db16c769cd8da98a8d541f7f5452afe84.tar.xz
If --continue is not enabled, set resume_len to zero.
This corrects the reporting of download progress (which previously started at a value greater than zero).
-rwxr-xr-xyoutube-dl14
1 files changed, 8 insertions, 6 deletions
diff --git a/youtube-dl b/youtube-dl
index 685bd2b8c..e304df557 100755
--- a/youtube-dl
+++ b/youtube-dl
@@ -877,7 +877,6 @@ class FileDownloader(object):
tmpfilename = self.temp_name(filename)
stream = None
- open_mode = 'wb'
# Do not include the Accept-Encoding header
headers = {'Youtubedl-no-compression': 'True'}
@@ -890,11 +889,14 @@ class FileDownloader(object):
else:
resume_len = 0
- # Request parameters in case of being able to resume
- if self.params.get('continuedl', False) and resume_len != 0:
- self.report_resuming_byte(resume_len)
- request.add_header('Range', 'bytes=%d-' % resume_len)
- open_mode = 'ab'
+ open_mode = 'wb'
+ if resume_len != 0:
+ if self.params.get('continuedl', False):
+ self.report_resuming_byte(resume_len)
+ request.add_header('Range','bytes=%d-' % resume_len)
+ open_mode = 'ab'
+ else:
+ resume_len = 0
count = 0
retries = self.params.get('retries', 0)