fix: mai2 photos cant be merged
This commit is contained in:
parent
8a6250bebd
commit
f4dff9b4c1
@ -106,7 +106,7 @@ class Mai2Frontend(FE_Base):
|
||||
index = int(path_index) - 1 # 0 and 1 are 1st page
|
||||
user_id = usr_sesh.user_id
|
||||
playlog_count = await self.data.score.get_user_playlogs_count(user_id)
|
||||
if playlog_count < index * 20 :
|
||||
if playlog_count < index * 20:
|
||||
return Response(template.render(
|
||||
title=f"{self.core_config.server.name} | {self.nav_name}",
|
||||
game_list=self.environment.globals["game_list"],
|
||||
@ -118,15 +118,15 @@ class Mai2Frontend(FE_Base):
|
||||
for record in playlog:
|
||||
music_chart = await self.data.static.get_music_chart(usr_sesh.maimai_version, record.musicId, record.level)
|
||||
if music_chart:
|
||||
difficultyNum=music_chart.chartId
|
||||
difficulty=music_chart.difficulty
|
||||
artist=music_chart.artist
|
||||
title=music_chart.title
|
||||
difficultyNum = music_chart.chartId
|
||||
difficulty = music_chart.difficulty
|
||||
artist = music_chart.artist
|
||||
title = music_chart.title
|
||||
else:
|
||||
difficultyNum=0
|
||||
difficulty=0
|
||||
artist="unknown"
|
||||
title="musicid: " + str(record.musicId)
|
||||
difficultyNum = 0
|
||||
difficulty = 0
|
||||
artist = "unknown"
|
||||
title = "musicid: " + str(record.musicId)
|
||||
playlog_with_title.append({
|
||||
"raw": record,
|
||||
"title": title,
|
||||
@ -240,8 +240,8 @@ class Mai2Frontend(FE_Base):
|
||||
form_data = await request.form()
|
||||
maimai_version = form_data.get("version")
|
||||
self.logger.info(f"version change to: {maimai_version}")
|
||||
if(maimai_version.isdigit()):
|
||||
usr_sesh.maimai_version=int(maimai_version)
|
||||
if (maimai_version.isdigit()):
|
||||
usr_sesh.maimai_version = int(maimai_version)
|
||||
encoded_sesh = self.encode_session(usr_sesh)
|
||||
self.logger.debug(f"Created session with JWT {encoded_sesh}")
|
||||
resp.set_cookie("ARTEMIS_SESH", encoded_sesh)
|
||||
@ -386,11 +386,11 @@ class Mai2Frontend(FE_Base):
|
||||
self.logger.info(f"Photo Path Exist.")
|
||||
max_idx = 0
|
||||
p = ImageFile.Parser()
|
||||
for _, _, files in walk("out_folder"):
|
||||
for _, _, files in walk(f"{out_folder}"):
|
||||
if not files:
|
||||
break
|
||||
|
||||
matcher = re.match("^(\d+)_(\d+)$", files[0])
|
||||
matcher = re.match(r"^(\d+)_(\d+)\.bin$", files[0])
|
||||
if not matcher:
|
||||
break
|
||||
|
||||
@ -405,7 +405,7 @@ class Mai2Frontend(FE_Base):
|
||||
return Response(status_code=500)
|
||||
|
||||
for i in range(max_idx + 1):
|
||||
with open(f"{out_folder}/{i}_{max_idx}", "rb") as f:
|
||||
with open(f"{out_folder}/{i}_{max_idx}.bin", "rb") as f:
|
||||
p.feed(f.read())
|
||||
try:
|
||||
im = p.close()
|
||||
|
Loading…
x
Reference in New Issue
Block a user