Misc updates
This commit is contained in:
parent
68d8e292cc
commit
49d7e6d78a
2 changed files with 4 additions and 4 deletions
|
|
@ -27,10 +27,10 @@ CACHED_DIRS = {}
|
||||||
def download_file(out_path, source_url, as_new=False, overwrite=False):
|
def download_file(out_path, source_url, as_new=False, overwrite=False):
|
||||||
"""Download a file using requests, returns pathlib.Path."""
|
"""Download a file using requests, returns pathlib.Path."""
|
||||||
out_path = pathlib.Path(out_path).resolve()
|
out_path = pathlib.Path(out_path).resolve()
|
||||||
|
download_msg = f'Downloading {out_path.name}...'
|
||||||
if as_new:
|
if as_new:
|
||||||
out_path = out_path.with_suffix(f'{out_path.suffix}.new')
|
out_path = out_path.with_suffix(f'{out_path.suffix}.new')
|
||||||
cursor_left = '\u001B[14D'
|
print(download_msg, end='', flush=True)
|
||||||
print(f'Downloading...{cursor_left}', end='', flush=True)
|
|
||||||
|
|
||||||
# Avoid clobbering
|
# Avoid clobbering
|
||||||
if out_path.exists() and not overwrite:
|
if out_path.exists() and not overwrite:
|
||||||
|
|
@ -57,7 +57,7 @@ def download_file(out_path, source_url, as_new=False, overwrite=False):
|
||||||
_f.write(chunk)
|
_f.write(chunk)
|
||||||
|
|
||||||
# Done
|
# Done
|
||||||
print(f' {cursor_left}', end='', flush=True)
|
print(f'\r{" "*len(download_msg)}\r', end='', flush=True)
|
||||||
return out_path
|
return out_path
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ def build_ufd():
|
||||||
)
|
)
|
||||||
for s_label, s_path in sources.items():
|
for s_label, s_path in sources.items():
|
||||||
try_print.run(
|
try_print.run(
|
||||||
message='Copying {}...'.format(s_label),
|
message=f'Copying {s_label}...',
|
||||||
function=copy_source,
|
function=copy_source,
|
||||||
source=s_path,
|
source=s_path,
|
||||||
items=ITEMS[s_label],
|
items=ITEMS[s_label],
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue