mirror of
https://github.com/283375/arcaea-offline.git
synced 2025-04-09 17:40:17 +00:00
fix: typing issues
This commit is contained in:
parent
6e8ac3dee7
commit
d143632025
@ -38,6 +38,13 @@ class ArcsongJsonExporter:
|
||||
else:
|
||||
name_jp = ""
|
||||
|
||||
if difficulty.date is not None:
|
||||
date = int(difficulty.date.timestamp())
|
||||
elif song.date is not None:
|
||||
date = int(song.date.timestamp())
|
||||
else:
|
||||
date = 0
|
||||
|
||||
return {
|
||||
"name_en": difficulty.title or song.title,
|
||||
"name_jp": name_jp,
|
||||
@ -53,7 +60,7 @@ class ArcsongJsonExporter:
|
||||
"world_unlock": False,
|
||||
"remote_download": False,
|
||||
"bg": difficulty.bg or song.bg or "",
|
||||
"date": difficulty.date or song.date or 0,
|
||||
"date": date,
|
||||
"version": difficulty.version or song.version or "",
|
||||
"difficulty": difficulty.rating * 2 + int(difficulty.rating_plus),
|
||||
"rating": chart_info.constant or 0 if chart_info else 0,
|
||||
|
@ -12,25 +12,27 @@ class ArcaeaOfflineDEFv2PlayResultExporter:
|
||||
def export(self, items: List[PlayResult]) -> ArcaeaOfflineDEFv2PlayResultRoot:
|
||||
export_items = []
|
||||
for item in items:
|
||||
export_item: ArcaeaOfflineDEFv2PlayResultItem = {}
|
||||
export_item: ArcaeaOfflineDEFv2PlayResultItem = {
|
||||
"id": item.id,
|
||||
"songId": item.song_id,
|
||||
"ratingClass": item.rating_class.value,
|
||||
"score": item.score,
|
||||
"pure": item.pure,
|
||||
"far": item.far,
|
||||
"lost": item.lost,
|
||||
"date": int(item.date.timestamp() * 1000) if item.date else 0,
|
||||
"maxRecall": item.max_recall,
|
||||
"modifier": (
|
||||
item.modifier.value if item.modifier is not None else None
|
||||
),
|
||||
"clearType": (
|
||||
item.clear_type.value if item.clear_type is not None else None
|
||||
),
|
||||
"source": "https://arcaeaoffline.sevive.xyz/python",
|
||||
"comment": item.comment,
|
||||
}
|
||||
|
||||
export_item["id"] = item.id
|
||||
export_item["songId"] = item.song_id
|
||||
export_item["ratingClass"] = item.rating_class.value
|
||||
export_item["score"] = item.score
|
||||
export_item["pure"] = item.pure
|
||||
export_item["far"] = item.far
|
||||
export_item["lost"] = item.lost
|
||||
export_item["date"] = item.date
|
||||
export_item["maxRecall"] = item.max_recall
|
||||
export_item["modifier"] = (
|
||||
item.modifier.value if item.modifier is not None else None
|
||||
)
|
||||
export_item["clearType"] = (
|
||||
item.clear_type.value if item.clear_type is not None else None
|
||||
)
|
||||
export_item["source"] = "https://arcaeaoffline.sevive.xyz/python"
|
||||
export_item["comment"] = item.comment
|
||||
export_items.append(export_item)
|
||||
|
||||
return {
|
||||
"$schema": "https://arcaeaoffline.sevive.xyz/schemas/def/v2/score.schema.json",
|
||||
|
@ -49,7 +49,7 @@ class ArcaeaPacklistParser(ArcaeaListParser):
|
||||
|
||||
if name_localized or description_localized:
|
||||
pack_localized = PackLocalized(id=pack.id)
|
||||
pack_localized.lang = key.value
|
||||
pack_localized.lang = ArcaeaLanguage(key.value)
|
||||
pack_localized.name = name_localized
|
||||
pack_localized.description = description_localized
|
||||
results.append(pack_localized)
|
||||
@ -96,7 +96,7 @@ class ArcaeaSonglistParser(ArcaeaListParser):
|
||||
|
||||
if title_localized or source_localized:
|
||||
song_localized = SongLocalized(id=song.id)
|
||||
song_localized.lang = lang.value
|
||||
song_localized.lang = ArcaeaLanguage(lang.value)
|
||||
song_localized.title = title_localized
|
||||
song_localized.source = source_localized
|
||||
results.append(song_localized)
|
||||
@ -167,7 +167,7 @@ class ArcaeaSonglistParser(ArcaeaListParser):
|
||||
song_id=difficulty.song_id,
|
||||
rating_class=difficulty.rating_class,
|
||||
)
|
||||
difficulty_localized.lang = lang.value
|
||||
difficulty_localized.lang = ArcaeaLanguage(lang.value)
|
||||
difficulty_localized.title = title_localized
|
||||
difficulty_localized.artist = artist_localized
|
||||
results.append(difficulty_localized)
|
||||
|
Loading…
x
Reference in New Issue
Block a user