Jannchie commited on
Commit
a95048d
·
1 Parent(s): f66a537

feat(download): use argparse

Browse files
Files changed (1) hide show
  1. download_images.py +12 -5
download_images.py CHANGED
@@ -4,12 +4,19 @@ import threading
4
  import queue
5
  import requests
6
 
7
- # Database and output directory setup
8
- DB_PATH = "danbooru_metadata.db"
9
- OUT_DIR = "./image"
10
 
11
- # Number of download threads
12
- NUM_THREADS = 16
 
 
 
 
 
 
 
 
 
 
13
 
14
  # Task queue to hold file URLs and IDs
15
  task_queue = queue.Queue()
 
4
  import queue
5
  import requests
6
 
 
 
 
7
 
8
+ import argparse
9
+
10
+ parser = argparse.ArgumentParser()
11
+ parser.add_argument("--db_path", type=str, default="danbooru_metadata.db")
12
+ parser.add_argument("--out_dir", type=str, default="./image")
13
+ parser.add_argument("--num_threads", type=int, default=16)
14
+
15
+ args = parser.parse_args()
16
+
17
+ DB_PATH = args.db_path
18
+ OUT_DIR = args.out_dir
19
+ NUM_THREADS = args.num_threads
20
 
21
  # Task queue to hold file URLs and IDs
22
  task_queue = queue.Queue()