Skip to content

Commit

Permalink
render_chart_official now support int as difficulty
Browse files Browse the repository at this point in the history
  • Loading branch information
zhanbao2000 committed Apr 13, 2023
1 parent 54ac880 commit 3fc6250
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion __init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import Union

from .model import DifficultyInt
from .render import Render
from .resource import (
Expand All @@ -11,7 +13,7 @@
)


async def render_chart_official(song_id: int, difficulty: DifficultyInt) -> Render:
async def render_chart_official(song_id: int, difficulty: Union[DifficultyInt, int]) -> Render:
chart = await get_chart_official(song_id, difficulty)
song = await get_song_official(song_id)
jacket = await get_song_jacket(get_song_jacket_url_official(song_id, song.jacketImage[0]))
Expand Down
2 changes: 1 addition & 1 deletion resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class FontResourceMangaer(object):
font_a_otf_shingopro_medium_2 = assets / 'A-OTF-ShinGoPro-Medium-2.otf'


async def get_chart_official(song_id: int, difficulty: int) -> Chart:
async def get_chart_official(song_id: int, difficulty: DifficultyInt) -> Chart:
async with get_client() as client:
response = await client.get(f'https://bestdori.com/api/charts/{song_id}/{difficulty_literal[difficulty]}.json')
response.raise_for_status()
Expand Down

0 comments on commit 3fc6250

Please sign in to comment.