[bar] update bar display at the beginning

or it may not show up itself promptly, leaving the user wondering why it
doesn't start.

I met this problem with http://www.letv.com/ptv/vplay/1709438.html,
which downloads really fast, but I have to wait a few seconds before the
bar shows up.
This commit is contained in:
lilydjwg 2016-01-23 13:07:18 +08:00
parent 28d04b0ad4
commit af588b2f9f

View File

@ -691,11 +691,13 @@ def download_urls(urls, title, ext, total_size, output_dir='.', refer=None, merg
if len(urls) == 1:
url = urls[0]
print('Downloading %s ...' % tr(output_filename))
bar.update()
url_save(url, output_filepath, bar, refer = refer, faker = faker, headers = headers)
bar.done()
else:
parts = []
print('Downloading %s.%s ...' % (tr(title), ext))
bar.update()
for i, url in enumerate(urls):
filename = '%s[%02d].%s' % (title, i, ext)
filepath = os.path.join(output_dir, filename)