From 4723795fb63ce339310c670321ecf29cd5b00e98 Mon Sep 17 00:00:00 2001 From: Darren Thompson Date: Sat, 2 Aug 2025 09:54:30 -0400 Subject: [PATCH] Remove hacks on music.py now that app.bin can be properly parsed and imported --- bemani/data/mysql/music.py | 46 ++++---------------------------------- 1 file changed, 4 insertions(+), 42 deletions(-) diff --git a/bemani/data/mysql/music.py b/bemani/data/mysql/music.py index 250be5a..80444cc 100644 --- a/bemani/data/mysql/music.py +++ b/bemani/data/mysql/music.py @@ -4,7 +4,7 @@ from sqlalchemy.types import String, Integer, JSON from sqlalchemy.dialects.mysql import BIGINT as BigInteger from typing import Optional, Dict, List, Tuple, Any -from bemani.common import GameConstants, Time, VersionConstants +from bemani.common import GameConstants, Time from bemani.data.exceptions import ScoreSaveException from bemani.data.mysql.base import BaseData, metadata from bemani.data.types import Score, Attempt, Song, UserID @@ -81,15 +81,6 @@ music = Table( class MusicData(BaseData): - def __get_next_music_id(self) -> int: - cursor = self.execute("SELECT MAX(id) AS next_id FROM `music`") - result = cursor.fetchone() - try: - return result["next_id"] + 1 - except TypeError: - # Nothing in DB - return 1 - def __get_musicid(self, game: GameConstants, version: int, songid: int, songchart: int) -> int: """ Given a game/version/songid/chart, look up the unique music ID for this song. @@ -114,38 +105,9 @@ class MusicData(BaseData): }, ) if cursor.rowcount != 1: - if game == GameConstants.DDR and version == VersionConstants.DDR_SUPERNOVA_2: - # No currently implemented way to import supernova 2 songlist, so insert records to the DB on the fly - insertSql = "INSERT INTO music (id, songid, chart, game, version, name, artist, genre) VALUES (:id, :songid, :chart, :game, :version, :name, :artist, :genre)" - - self.execute( - insertSql, - { - "id": self.__get_next_music_id(), - "songid": songid, - "chart": songchart, - "game": game.value, - "version": version, - "name": "test", - "artist": "artist", - "genre": "genre", - }, - ) - - cursor = self.execute( - sql, - { - "songid": songid, - "chart": songchart, - "game": game.value, - "version": version, - }, - ) - else: - # music doesn't exist - raise Exception(f"Song {songid} chart {songchart} doesn't exist for game {game} version {version}") - - result = cursor.mappings().fetchone() # type: ignore + # music doesn't exist + raise Exception(f"Song {songid} chart {songchart} doesn't exist for game {game} version {version}") + result = cursor.mappings().fetchone() # type: ignore return result["id"] def put_score(