wget: delete url file

This commit is contained in:
ed 2021-09-15 00:18:58 +02:00
parent fe323f59af
commit 12b7317831

View file

@ -25,7 +25,7 @@ from urllib.parse import unquote_to_bytes as unquote
def main(): def main():
fp = sys.argv[1] fp = os.path.abspath(sys.argv[1])
fdir = os.path.dirname(fp) fdir = os.path.dirname(fp)
fname = os.path.basename(fp) fname = os.path.basename(fp)
if not fname.startswith("put-") or not fname.endswith(".bin"): if not fname.startswith("put-") or not fname.endswith(".bin"):
@ -65,6 +65,10 @@ def main():
try: try:
sp.check_call(cmd) sp.check_call(cmd)
# OPTIONAL:
# on success, delete the .bin file which contains the URL
os.unlink(fp)
except: except:
open("-- FAILED TO DONWLOAD " + name, "wb").close() open("-- FAILED TO DONWLOAD " + name, "wb").close()