Separated gen3 and shinuchi scores into their own DBs

This commit is contained in:
Valerio
2025-12-19 19:14:15 -05:00
parent 252c3c3e0b
commit c3553c5b95
9 changed files with 18 additions and 14 deletions

View File

@@ -165,7 +165,7 @@ class SongBox(BaseBox):
self.text_loaded = True
def get_scores(self):
with sqlite3.connect('scores.db') as con:
with sqlite3.connect(global_data.score_db) as con:
cursor = con.cursor()
# Batch database query for all diffs at once
if self.tja.metadata.course_data:

View File

@@ -14,6 +14,9 @@ class PlayerNum(IntEnum):
TWO_PLAYER = 3
DAN = 4
class ScoreMethod():
GEN3 = "gen3"
SHINUCHI = "shinuchi"
class Difficulty(IntEnum):
EASY = 0
@@ -154,6 +157,7 @@ class GlobalData:
config: Config = field(default_factory=dict)
song_hashes: dict[str, list[dict]] = field(default_factory=lambda: dict()) #Hash to path
song_paths: dict[Path, str] = field(default_factory=lambda: dict()) #path to hash
score_db: str = ""
song_progress: float = 0.0
total_songs: int = 0
hit_sound: list[int] = field(default_factory=lambda: [0, 0, 0])

View File

@@ -27,14 +27,14 @@ class DiffHashesDecoder(json.JSONDecoder):
super().__init__(object_hook=diff_hashes_object_hook, *args, **kwargs)
def get_db_version():
with sqlite3.connect('scores.db') as con:
with sqlite3.connect(global_data.score_db) as con:
cursor = con.cursor()
cursor.execute('PRAGMA user_version')
version = cursor.fetchone()[0]
return version
def update_db_version():
with sqlite3.connect('scores.db') as con:
with sqlite3.connect(global_data.score_db) as con:
cursor = con.cursor()
cursor.execute(f'PRAGMA user_version = {DB_VERSION}')