-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
46 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
from fastapi import APIRouter | ||
|
||
from . import akatsuki | ||
from . import osu_api_v1 | ||
from . import osu_api_v2 | ||
|
||
v1_router = APIRouter() | ||
|
||
v1_router.include_router(akatsuki.router) | ||
v1_router.include_router(osu_api_v2.router) | ||
v1_router.include_router(osu_api_v1.router) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from fastapi import APIRouter | ||
from fastapi import Response | ||
|
||
from app.adapters import osu_api_v1 | ||
|
||
router = APIRouter(tags=["osu Files"]) | ||
|
||
|
||
@router.get("/api/osu-api/v1/osu-files/{beatmap_id}") | ||
async def download_beatmap_osu_file(beatmap_id: int) -> Response: | ||
beatmap_osu_file_data = await osu_api_v1.fetch_beatmap_osu_file_data(beatmap_id) | ||
# TODO: consider at which points in beatmaps-service we should update | ||
# the .osu file that is currently saved in wasabi s3 storage. | ||
if beatmap_osu_file_data is not None: | ||
return Response( | ||
beatmap_osu_file_data, | ||
media_type="application/octet-stream", | ||
headers={ | ||
"Content-Disposition": f"attachment; filename={beatmap_id}.osu", | ||
}, | ||
) | ||
|
||
return Response(status_code=404) |