forked from openwpm/OpenWPM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprepare_for_run.py
31 lines (21 loc) · 900 Bytes
/
prepare_for_run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from custom.File_Helper import (check_create_dir, check_remove_dir, check_remove_file,
ROOT, DATADIR, D_EXTRACT, LEVELDB, OWPM_LOG, SQLITE, DCFP_LOG)
resp = input("This step will clean all existing crawl data. Do you really wish to continue? [y/n]\n")
if resp.casefold() == "y":
print("Preparing envirnment for a new crawl...")
# datadir
if check_create_dir(DATADIR):
print(f"{DATADIR} already exists")
check_remove_dir(LEVELDB)
check_remove_dir(D_EXTRACT)
check_remove_file(OWPM_LOG)
check_remove_file(DCFP_LOG)
check_remove_file(SQLITE)
check_remove_file(DATADIR / "crawl-data.sqlite-journal")
else:
print(f"{DATADIR} created")
# datadir/extract
check_create_dir(D_EXTRACT)
check_remove_file(ROOT / "geckodriver.log")
else:
print("Preparation process aborted")