forked from Hay1tsme/artemis
Merge pull request '[Mai2] enhance music score path handling and improve error logging' (#226) from SoulGateKey/artemis:mai2_enhance_musicscoreapi into develop
Reviewed-on: Hay1tsme/artemis#226
This commit is contained in:
@ -283,6 +283,18 @@ crypto:
|
||||
"23_chn": ["0000000000000000000000000000000000000000000000000000000000000000", "00000000000000000000000000000000", "0000000000000000"]
|
||||
```
|
||||
|
||||
| Option | Info |
|
||||
|-----------------|------------------------------------------------------|
|
||||
| `chart_deliver` | This option is used to delivery charts to the client |
|
||||
|
||||
If you would like to use chart delivery, set this option to `True` and configure the directory to read from. Then put charts in your chart folder like this:
|
||||
```
|
||||
chart_folder/23/music001736/001736_00.ma2
|
||||
chart_folder/23/music001736/001736_01.ma2 # PRiSM
|
||||
chart_folder/24/music001901/001901_00.ma2
|
||||
chart_folder/24/music001901/001901_01.ma2 # PRiSM PLUS
|
||||
```
|
||||
|
||||
## Hatsune Miku Project Diva
|
||||
|
||||
### SBZV
|
||||
|
@ -34,6 +34,7 @@ class Mai2Prism(Mai2BuddiesPlus):
|
||||
|
||||
padded_music_id = str(data["musicId"]).zfill(6)
|
||||
padded_level_id = str(data["level"]).zfill(2)
|
||||
music_folder = f"music{padded_music_id}"
|
||||
|
||||
if data["type"] == 0:
|
||||
target_filename = f"{padded_music_id}_{padded_level_id}.ma2"
|
||||
@ -42,11 +43,11 @@ class Mai2Prism(Mai2BuddiesPlus):
|
||||
elif data["type"] == 2:
|
||||
target_filename = f"{padded_music_id}_{padded_level_id}_R.ma2"
|
||||
else:
|
||||
self.logger.error("Valid MusicScore type!")
|
||||
self.logger.error("Invalid MusicScore type!")
|
||||
return {"gameMusicScore": {"musicId": data["musicId"], "level": data["level"], "type": data["type"], "scoreData": ""}}
|
||||
|
||||
|
||||
chart_path = os.path.join(self.game_config.charts.chart_folder, target_filename)
|
||||
chart_path = os.path.join(self.game_config.charts.chart_folder, str(self.version), music_folder, target_filename)
|
||||
if os.path.isfile(chart_path):
|
||||
with open(chart_path, 'rb') as file:
|
||||
file_content = file.read()
|
||||
@ -60,7 +61,7 @@ class Mai2Prism(Mai2BuddiesPlus):
|
||||
}
|
||||
}
|
||||
else:
|
||||
self.logger.warning(f"Chart {target_filename} not found!")
|
||||
self.logger.warning(f"Version {self.version} Chart {target_filename} not found!")
|
||||
return {"gameMusicScore": {"musicId": data["musicId"], "level": data["level"], "type": data["type"], "scoreData": ""}}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user