mirror of
https://gitea.tendokyu.moe/Hay1tsme/artemis.git
synced 2026-02-13 19:27:27 +08:00
database support for prism
kaleidxScope Key Condition store
This commit is contained in:
@@ -48,8 +48,12 @@ class Mai2Reader(BaseReader):
|
||||
self.logger.info(f"Read from {dir}")
|
||||
await self.get_events(f"{dir}/event")
|
||||
await self.disable_events(f"{dir}/information", f"{dir}/scoreRanking")
|
||||
await self.read_music(f"{dir}/music")
|
||||
#await self.read_music(f"{dir}/music")
|
||||
await self.read_tickets(f"{dir}/ticket")
|
||||
|
||||
if self.version >= Mai2Constants.VER_MAIMAI_DX_PRISM:
|
||||
for dir in data_dirs:
|
||||
await self.read_kaleidxscope_condition(f"{dir}/kaleidxScopeKeyCondition")
|
||||
|
||||
else:
|
||||
if not os.path.exists(f"{self.bin_dir}/tables"):
|
||||
@@ -341,3 +345,31 @@ class Mai2Reader(BaseReader):
|
||||
if scores is None or text is None:
|
||||
return
|
||||
# TODO
|
||||
|
||||
|
||||
async def read_kaleidxscope_condition(self, base_dir: str) -> None :
|
||||
self.logger.info(f"Reading KaleidxScope Key Conditions from {base_dir}...")
|
||||
|
||||
for root, dirs, files in os.walk(base_dir):
|
||||
for dir in dirs:
|
||||
if os.path.exists(f"{root}/{dir}/KaleidxScopeKeyCondition.xml"):
|
||||
with open(f"{root}/{dir}/KaleidxScopeKeyCondition.xml", encoding="utf-8") as f:
|
||||
troot = ET.fromstring(f.read())
|
||||
|
||||
condition_id = int(troot.find("name").find("id").text)
|
||||
condition_name = troot.find("name").find("str").text
|
||||
|
||||
music_list = troot.find("musicIds").find("list")
|
||||
for music in music_list.findall("StringID"):
|
||||
music_id = int(music.find("id").text)
|
||||
music_name = music.find("str").text
|
||||
|
||||
await self.data.static.put_kaleidxscope_condition(
|
||||
condition_id,
|
||||
condition_name,
|
||||
music_id,
|
||||
music_name
|
||||
)
|
||||
self.logger.info(
|
||||
f"Add music {music_id} for condition {condition_id}"
|
||||
)
|
||||
Reference in New Issue
Block a user