1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-06-02 10:29:28 +00:00

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).
This commit is contained in:
Michael Haggerty 2011-05-20 08:59:53 +02:00
parent 4b0d9eed45
commit 0dd2aea0c7

View file

@ -664,7 +664,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'}
@ -677,11 +676,15 @@ class FileDownloader(object):
else:
resume_len = 0
open_mode = 'wb'
# 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'
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)