2026-04-10 08:08:47 +00:00
|
|
|
import os
|
2026-09-29 00:59:21 +00:00
|
|
|
import json
|
2026-04-10 08:08:47 +00:00
|
|
|
from data.career_db import build_career_database
|
|
|
|
|
import sqlite3
|
|
|
|
|
from data.db_access import DB_PATH
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
conn = sqlite3.connect(DB_PATH)
|
|
|
|
|
cur = conn.cursor()
|
|
|
|
|
cur.execute("SELECT name FROM sqlite_master WHERE type='table';")
|
|
|
|
|
print("TABLES:", cur.fetchall())
|
|
|
|
|
conn.close()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
|
OUTPUT = os.path.join(BASE_DIR, "career_stats.json")
|
|
|
|
|
|
2026-09-29 00:59:21 +00:00
|
|
|
# Keep the identity registry's season tracking on the same scale the
|
|
|
|
|
# GUI uses (config.json's current_season), not the raw API CycleID
|
|
|
|
|
# scale, so recency checks elsewhere in the app stay reliable
|
|
|
|
|
# regardless of whether the DB was rebuilt from the GUI or this script.
|
|
|
|
|
CONFIG_PATH = os.path.join(BASE_DIR, "config.json")
|
|
|
|
|
current_season = None
|
|
|
|
|
if os.path.exists(CONFIG_PATH):
|
|
|
|
|
with open(CONFIG_PATH, "r", encoding="utf-8") as f:
|
|
|
|
|
current_season = json.load(f).get("current_season")
|
|
|
|
|
|
2026-04-10 08:08:47 +00:00
|
|
|
print("Rebuilding career database...")
|
2026-09-29 00:59:21 +00:00
|
|
|
ok = build_career_database(OUTPUT, current_season=current_season)
|
2026-04-10 08:08:47 +00:00
|
|
|
|
|
|
|
|
if ok:
|
|
|
|
|
print("Career DB rebuilt successfully:", OUTPUT)
|
|
|
|
|
else:
|
|
|
|
|
print("Career DB rebuild failed.")
|