skips downloading files which already exist
parent
8375051085
commit
793b615278
|
@ -9,10 +9,13 @@ from pathlib import Path
|
|||
def download_audio(link, destdir):
|
||||
parts = link.split('/')
|
||||
ptarget = Path(destdir) / Path(parts[-1])
|
||||
target = str(ptarget.resolve())
|
||||
args = [ "wget", link, "-o", target ]
|
||||
print(f"downloading {link} to {target}")
|
||||
subprocess.run(args)
|
||||
target = ptarget.resolve()
|
||||
if target.exists():
|
||||
print("File already exists, skipping")
|
||||
else:
|
||||
args = [ "wget", link, "-o", str(target) ]
|
||||
print(f"downloading {link}")
|
||||
subprocess.run(args)
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue