Skip to content

Commit 928c48f

Browse files
committed
Improve database functions, add new assets
1 parent 845a9be commit 928c48f

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

database/main.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,24 @@ def main():
88
args = sys.argv[1:]
99

1010
if len(args) == 0: # default no args
11+
print("Initializing database...")
1112
dd.init_sql()
1213
dd.update_db(dd.fetch_new_data())
13-
con = sqlite3.connect("sv_db.db")
14-
cur = con.cursor()
15-
dd.update_db(dd.fetch_new_data())
16-
sql_data = cur.execute('SELECT * FROM servants').fetchall()
14+
15+
# Query and download
16+
print("Downloading assets")
1717
dd.download_sv_faces()
18-
con.close()
1918

2019

2120
con = sqlite3.connect("sv_db.db")
2221
cur = con.cursor()
2322

24-
if len(args) == 1 and args[0] == "update":
25-
dd.update_db(dd.fetch_new_data())
26-
sql_data = cur.execute('SELECT * FROM servants').fetchall()
27-
dd.download_sv_faces()
28-
29-
if len(args) == 1 and args[0] == "full-update":
23+
if len(args) == 2 and args[0] == "download" and args[1] == "--new":
3024
dd.update_db(dd.fetch_new_data())
3125
sql_data = cur.execute('SELECT * FROM servants').fetchall()
3226
dd.fetch_and_store_sv_faces(sql_data) # This queries the API, should not be used
3327

34-
if len(args) == 1 and args[0] == "download-faces":
28+
if len(args) == 1 and args[0] == "download":
3529
dd.download_sv_faces()
3630

3731
if len(args) == 1 and args[0] == "zip":

0 commit comments

Comments
 (0)