forked from Hay1tsme/artemis
let black do it's magic
This commit is contained in:
@ -8,13 +8,23 @@ from core.config import CoreConfig
|
||||
from titles.cxb.database import CxbData
|
||||
from titles.cxb.const import CxbConstants
|
||||
|
||||
|
||||
class CxbReader(BaseReader):
|
||||
def __init__(self, config: CoreConfig, version: int, bin_arg: Optional[str], opt_arg: Optional[str], extra: Optional[str]) -> None:
|
||||
def __init__(
|
||||
self,
|
||||
config: CoreConfig,
|
||||
version: int,
|
||||
bin_arg: Optional[str],
|
||||
opt_arg: Optional[str],
|
||||
extra: Optional[str],
|
||||
) -> None:
|
||||
super().__init__(config, version, bin_arg, opt_arg, extra)
|
||||
self.data = CxbData(config)
|
||||
|
||||
try:
|
||||
self.logger.info(f"Start importer for {CxbConstants.game_ver_to_string(version)}")
|
||||
self.logger.info(
|
||||
f"Start importer for {CxbConstants.game_ver_to_string(version)}"
|
||||
)
|
||||
except IndexError:
|
||||
self.logger.error(f"Invalid project cxb version {version}")
|
||||
exit(1)
|
||||
@ -28,7 +38,7 @@ class CxbReader(BaseReader):
|
||||
|
||||
if pull_bin_ram:
|
||||
self.read_csv(f"{self.bin_dir}")
|
||||
|
||||
|
||||
def read_csv(self, bin_dir: str) -> None:
|
||||
self.logger.info(f"Read csv from {bin_dir}")
|
||||
|
||||
@ -45,18 +55,73 @@ class CxbReader(BaseReader):
|
||||
|
||||
if not "N/A" in row["standard"]:
|
||||
self.logger.info(f"Added song {song_id} chart 0")
|
||||
self.data.static.put_music(self.version, song_id, index, 0, title, artist, genre, int(row["standard"].replace("Standard ","").replace("N/A","0")))
|
||||
self.data.static.put_music(
|
||||
self.version,
|
||||
song_id,
|
||||
index,
|
||||
0,
|
||||
title,
|
||||
artist,
|
||||
genre,
|
||||
int(
|
||||
row["standard"]
|
||||
.replace("Standard ", "")
|
||||
.replace("N/A", "0")
|
||||
),
|
||||
)
|
||||
if not "N/A" in row["hard"]:
|
||||
self.logger.info(f"Added song {song_id} chart 1")
|
||||
self.data.static.put_music(self.version, song_id, index, 1, title, artist, genre, int(row["hard"].replace("Hard ","").replace("N/A","0")))
|
||||
self.data.static.put_music(
|
||||
self.version,
|
||||
song_id,
|
||||
index,
|
||||
1,
|
||||
title,
|
||||
artist,
|
||||
genre,
|
||||
int(row["hard"].replace("Hard ", "").replace("N/A", "0")),
|
||||
)
|
||||
if not "N/A" in row["master"]:
|
||||
self.logger.info(f"Added song {song_id} chart 2")
|
||||
self.data.static.put_music(self.version, song_id, index, 2, title, artist, genre, int(row["master"].replace("Master ","").replace("N/A","0")))
|
||||
self.data.static.put_music(
|
||||
self.version,
|
||||
song_id,
|
||||
index,
|
||||
2,
|
||||
title,
|
||||
artist,
|
||||
genre,
|
||||
int(
|
||||
row["master"].replace("Master ", "").replace("N/A", "0")
|
||||
),
|
||||
)
|
||||
if not "N/A" in row["unlimited"]:
|
||||
self.logger.info(f"Added song {song_id} chart 3")
|
||||
self.data.static.put_music(self.version, song_id, index, 3, title, artist, genre, int(row["unlimited"].replace("Unlimited ","").replace("N/A","0")))
|
||||
self.data.static.put_music(
|
||||
self.version,
|
||||
song_id,
|
||||
index,
|
||||
3,
|
||||
title,
|
||||
artist,
|
||||
genre,
|
||||
int(
|
||||
row["unlimited"]
|
||||
.replace("Unlimited ", "")
|
||||
.replace("N/A", "0")
|
||||
),
|
||||
)
|
||||
if not "N/A" in row["easy"]:
|
||||
self.logger.info(f"Added song {song_id} chart 4")
|
||||
self.data.static.put_music(self.version, song_id, index, 4, title, artist, genre, int(row["easy"].replace("Easy ","").replace("N/A","0")))
|
||||
self.data.static.put_music(
|
||||
self.version,
|
||||
song_id,
|
||||
index,
|
||||
4,
|
||||
title,
|
||||
artist,
|
||||
genre,
|
||||
int(row["easy"].replace("Easy ", "").replace("N/A", "0")),
|
||||
)
|
||||
except:
|
||||
self.logger.warn(f"Couldn't read csv file in {self.bin_dir}, skipping")
|
||||
|
Reference in New Issue
Block a user