feat(beatmap,beatmapset): get beatmap & beatmapset information by id

This commit is contained in:
MingxuanGame
2025-07-25 17:01:01 +08:00
parent f8abc7067f
commit 376d98ad5a
12 changed files with 452 additions and 9 deletions

47
app/models/beatmap.py Normal file
View File

@@ -0,0 +1,47 @@
from __future__ import annotations
from enum import IntEnum
class BeatmapRankStatus(IntEnum):
GRAVEYARD = -2
WIP = -1
PENDING = 0
RANKED = 1
APPROVED = 2
QUALIFIED = 3
LOVED = 4
class Genre(IntEnum):
ANY = 0
UNSPECIFIED = 1
VIDEO_GAME = 2
ANIME = 3
ROCK = 4
POP = 5
OTHER = 6
NOVELTY = 7
HIP_HOP = 9
ELECTRONIC = 10
METAL = 11
CLASSICAL = 12
FOLK = 13
JAZZ = 14
class Language(IntEnum):
ANY = 0
UNSPECIFIED = 1
ENGLISH = 2
JAPANESE = 3
CHINESE = 4
INSTRUMENTAL = 5
KOREAN = 6
FRENCH = 7
GERMAN = 8
ITALIAN = 9
SPANISH = 10
RUSSIAN = 11
POLISH = 12
OTHER = 13

View File

@@ -1,17 +1,31 @@
from __future__ import annotations
from enum import Enum, IntEnum
from typing import Any
from pydantic import BaseModel
class GameMode(str, Enum):
OSU = "osu"
TAIKO = "taiko"
FRUITS = "fruits"
MANIA = "mania"
MODE_TO_INT = {
GameMode.OSU: 0,
GameMode.TAIKO: 1,
GameMode.FRUITS: 2,
GameMode.MANIA: 3,
}
class APIMod(BaseModel):
acronym: str
settings: dict[str, Any] = {}
# https://github.com/ppy/osu/blob/master/osu.Game/Rulesets/Scoring/HitResult.cs
class HitResult(IntEnum):
PERFECT = 0 # [Order(0)]