q6 commited on
Commit
020cf0e
·
1 Parent(s): 1b420ad

clear db and order

Browse files
Files changed (2) hide show
  1. Client/Scripts/clear_db.py +3 -1
  2. Client/main.py +9 -9
Client/Scripts/clear_db.py CHANGED
@@ -6,7 +6,9 @@ DB_PATH = os.path.join(ROOT_DIR, "db.sqlite")
6
 
7
 
8
  def main() -> int:
9
- input("Are you sure?")
 
 
10
  if not os.path.exists(DB_PATH):
11
  print("db.sqlite not found.")
12
  return 1
 
6
 
7
 
8
  def main() -> int:
9
+ response = input("Are you sure? [y/N]: ").strip().lower()
10
+ if response not in {"y", "yes"}:
11
+ return 0
12
  if not os.path.exists(DB_PATH):
13
  print("db.sqlite not found.")
14
  return 1
Client/main.py CHANGED
@@ -20,11 +20,12 @@ EXIT_KEYS = {"q", "quit", "exit"}
20
 
21
  MENU_SECTIONS: Sequence[Tuple[str, Sequence[Tuple[str, str, str]]]] = (
22
  (
23
- "Maintenance",
24
  (
25
- ("1", "Clear text logs", os.path.join(SCRIPTS_DIR, "clear_texts.py")),
26
- ("2", "Clear DB empty rows", os.path.join(SCRIPTS_DIR, "clear_db.py")),
27
- ("3", "Clear images (except Stash)", os.path.join(SCRIPTS_DIR, "clear_images.py")),
 
28
  ),
29
  ),
30
  (
@@ -34,12 +35,11 @@ MENU_SECTIONS: Sequence[Tuple[str, Sequence[Tuple[str, str, str]]]] = (
34
  ),
35
  ),
36
  (
37
- "Extract Pixiv",
38
  (
39
- ("5", "Search (all tags)", os.path.join(EXTRACT_DIR, "search.py")),
40
- ("6", "Search (AI only)", os.path.join(EXTRACT_DIR, "ai_search.py")),
41
- ("7", "Search (real only)", os.path.join(EXTRACT_DIR, "real_search.py")),
42
- ("8", "Users", os.path.join(EXTRACT_DIR, "user.py")),
43
  ),
44
  ),
45
  )
 
20
 
21
  MENU_SECTIONS: Sequence[Tuple[str, Sequence[Tuple[str, str, str]]]] = (
22
  (
23
+ "Extract Pixiv",
24
  (
25
+ ("5", "Search (all tags)", os.path.join(EXTRACT_DIR, "search.py")),
26
+ ("6", "Search (AI only)", os.path.join(EXTRACT_DIR, "ai_search.py")),
27
+ ("7", "Search (real only)", os.path.join(EXTRACT_DIR, "real_search.py")),
28
+ ("8", "Users", os.path.join(EXTRACT_DIR, "user.py")),
29
  ),
30
  ),
31
  (
 
35
  ),
36
  ),
37
  (
38
+ "Maintenance",
39
  (
40
+ ("1", "Clear text logs", os.path.join(SCRIPTS_DIR, "clear_texts.py")),
41
+ ("2", "Clear DB empty rows", os.path.join(SCRIPTS_DIR, "clear_db.py")),
42
+ ("3", "Clear images (except Stash)", os.path.join(SCRIPTS_DIR, "clear_images.py")),
 
43
  ),
44
  ),
45
  )