diff options
| author | Terry Truong <terry06890@gmail.com> | 2022-08-20 13:16:21 +1000 |
|---|---|---|
| committer | Terry Truong <terry06890@gmail.com> | 2022-08-20 13:16:21 +1000 |
| commit | 930c12d33e1093f874a4beb4d6376621e464e8c0 (patch) | |
| tree | 381722fc3ab9ebda482cb18d29e1091458aa93da /backend/tolData/eol/downloadImgs.py | |
| parent | 8144003565797f0d18645a416b95d4365bba5fdd (diff) | |
Use argparse in python scripts
Diffstat (limited to 'backend/tolData/eol/downloadImgs.py')
| -rwxr-xr-x | backend/tolData/eol/downloadImgs.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/backend/tolData/eol/downloadImgs.py b/backend/tolData/eol/downloadImgs.py index 96bc085..7ca4e79 100755 --- a/backend/tolData/eol/downloadImgs.py +++ b/backend/tolData/eol/downloadImgs.py @@ -7,9 +7,8 @@ import time from threading import Thread import signal -usageInfo = f""" -Usage: {sys.argv[0]} - +import argparse +parser = argparse.ArgumentParser(description=""" For some set of EOL IDs, downloads associated images from URLs in an image-list database. Uses multiple downloading threads. @@ -20,11 +19,10 @@ SIGINT causes the program to finish ongoing downloads and exit. The program can be re-run to continue downloading. It looks for already-downloaded files, and continues after the one with highest EOL ID. -""" -if len(sys.argv) > 1: - print(usageInfo, file=sys.stderr) - sys.exit(1) -# In testing, this downloaded about 70k images, over a few days +""", formatter_class=argparse.RawDescriptionHelpFormatter) +parser.parse_args() + +# In testing, this script downloaded about 70k images, over a few days imagesListDb = "imagesList.db" def getInputEolIds(): |
