beatmap hash fix

This commit is contained in:
2019-03-13 11:13:55 +01:00
parent 3847689257
commit d1e868c183
3 changed files with 7 additions and 3 deletions

View File

@@ -74,6 +74,7 @@ class Replay:
"mode": self.set_mode,
"mods": self.set_mods,
"osu_version": self.set_osu_version,
"beatmap_hash": self.set_beatmap_hash,
"player_name": self.set_player_name,
"replay_data": self.write
}
@@ -95,9 +96,12 @@ class Replay:
self._osu_version.value = osu_version
def set_beatmap_hash(self, md5_hash):
if type(md5_hash) is bytes:
md5_hash = md5_hash.decode()
if len(md5_hash) != 32 or len([x for x in md5_hash if x in string.hexdigits]) != 32:
raise Exception("Invalid beatmap hash")
self._beatmap_hash.value = md5_hash
self._beatmap_hash.value = md5_hash.encode()
def set_beatmap_file(self, filepath):
if not isfile(filepath):