feat(pp-calculator): support other pp calculators (#57)

New configurations:

- CALCULATOR="rosu": specific pp calculator
- CALCULATOR_CONFIG='{}': argument passed through into calculator
This commit is contained in:
MingxuanGame
2025-10-18 19:10:53 +08:00
committed by GitHub
parent 563a30d28f
commit 8790ccad64
16 changed files with 496 additions and 189 deletions

View File

@@ -10,6 +10,7 @@ from app.dependencies.database import Database, Redis
from app.dependencies.fetcher import Fetcher
from app.models.beatmap import BeatmapRankStatus, Genre, Language
from app.models.mods import int_to_mods
from app.models.performance import OsuBeatmapAttributes
from app.models.score import GameMode
from .router import AllStrModel, router
@@ -193,7 +194,12 @@ async def get_beatmaps(
redis,
fetcher,
)
results.append(await V1Beatmap.from_db(session, beatmap, attrs.aim_difficulty, attrs.speed_difficulty))
aim_diff = None
speed_diff = None
if isinstance(attrs, OsuBeatmapAttributes):
aim_diff = attrs.aim_difficulty
speed_diff = attrs.speed_difficulty
results.append(await V1Beatmap.from_db(session, beatmap, aim_diff, speed_diff))
continue
except Exception:
...