Skip to content

Commit

Permalink
Improve database functions, add new assets
Browse files Browse the repository at this point in the history
  • Loading branch information
aaanh committed Jan 17, 2024
1 parent 845a9be commit 928c48f
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions database/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,24 @@ def main():
args = sys.argv[1:]

if len(args) == 0: # default no args
print("Initializing database...")
dd.init_sql()
dd.update_db(dd.fetch_new_data())
con = sqlite3.connect("sv_db.db")
cur = con.cursor()
dd.update_db(dd.fetch_new_data())
sql_data = cur.execute('SELECT * FROM servants').fetchall()

# Query and download
print("Downloading assets")
dd.download_sv_faces()
con.close()


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

if len(args) == 1 and args[0] == "update":
dd.update_db(dd.fetch_new_data())
sql_data = cur.execute('SELECT * FROM servants').fetchall()
dd.download_sv_faces()

if len(args) == 1 and args[0] == "full-update":
if len(args) == 2 and args[0] == "download" and args[1] == "--new":
dd.update_db(dd.fetch_new_data())
sql_data = cur.execute('SELECT * FROM servants').fetchall()
dd.fetch_and_store_sv_faces(sql_data) # This queries the API, should not be used

if len(args) == 1 and args[0] == "download-faces":
if len(args) == 1 and args[0] == "download":
dd.download_sv_faces()

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

0 comments on commit 928c48f

Please sign in to comment.