adjust bars

This commit is contained in:
Cyberes 2023-11-05 20:23:29 -07:00
parent f67d5b903f
commit 62b8a17fe7
1 changed files with 3 additions and 2 deletions

View File

@ -57,7 +57,7 @@ if __name__ == '__main__':
row_bar = tqdm(total=len(row_iter), desc=f'Row {row_i}', postfix={'new_files': total_downloaded, 'failures': len(retries)})
for row in row_iter:
row_i = row
col_bar = tqdm(total=len(range(min_col, max_col + 1)), leave=False)
col_bar = tqdm(total=len(range(min_col, max_col + 1)), leave=False, disable=True)
with ThreadPoolExecutor(args.threads) as executor:
futures = [executor.submit(download_tile, (row, col, args.base_url, r_headers, tiles_output, args.proxy)) for col in range(min_col, max_col + 1)]
for future in as_completed(futures):
@ -65,6 +65,7 @@ if __name__ == '__main__':
if result:
result_row, result_col, new_image = result
if new_image == 'success':
col_bar.disable = False # Only show the col_bar if we've downloaded new tiles. This prevents updating at the speed of light when checking existing files.
total_downloaded += 1
tiles.append((result_row, result_col))
elif new_image == 'exist':
@ -92,7 +93,7 @@ if __name__ == '__main__':
elif new_image == 'failure':
col_bar.write(f'{(result_row, result_col)} failed!')
col_bar.update()
col_bar.close()
col_bar.close()
print(f'Downloaded {total_downloaded} images.')