Skip to content

Commit

Permalink
Merge branch 'master' into platform-fetch-perf-improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
zurdi15 committed May 23, 2024
2 parents 9991922 + 00f1c1b commit eff0967
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions backend/endpoints/rom.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from handler.metadata import meta_igdb_handler, meta_moby_handler
from logger.logger import log
from stream_zip import ZIP_AUTO, stream_zip # type: ignore[import]

from urllib.parse import quote
router = APIRouter()


Expand Down Expand Up @@ -236,7 +236,7 @@ def contents(f):
return CustomStreamingResponse(
zipped_chunks,
media_type="application/zip",
headers={"Content-Disposition": f'attachment; filename="{file_name}.zip"'},
headers={"Content-Disposition": f'attachment; filename="{quote(file_name)}.zip"'},
emit_body={"id": rom.id},
)

Expand Down
3 changes: 2 additions & 1 deletion backend/handler/metadata/igdb_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,8 @@ def get_matched_roms_by_id(self, igdb_id: int) -> list[IGDBRom]:
if not IGDB_API_ENABLED:
return []

return [self.get_rom_by_id(igdb_id)]
rom = self.get_rom_by_id(igdb_id)
return [rom] if rom["igdb_id"] else []

@check_twitch_token
def get_matched_roms_by_name(
Expand Down
7 changes: 4 additions & 3 deletions backend/handler/metadata/moby_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,14 +253,14 @@ async def get_rom(self, file_name: str, platform_moby_id: int) -> MobyGamesRom:

def get_rom_by_id(self, moby_id: int) -> MobyGamesRom:
if not MOBY_API_ENABLED:
return MobyGamesRom(moby_id=moby_id)
return MobyGamesRom(moby_id=None)

url = yarl.URL(self.games_url).with_query(id=moby_id)
roms = self._request(str(url)).get("games", [])
res = pydash.get(roms, "[0]", None)

if not res:
return MobyGamesRom(moby_id=moby_id)
return MobyGamesRom(moby_id=None)

rom = {
"moby_id": res["game_id"],
Expand All @@ -278,7 +278,8 @@ def get_matched_roms_by_id(self, moby_id: int) -> list[MobyGamesRom]:
if not MOBY_API_ENABLED:
return []

return [self.get_rom_by_id(moby_id)]
rom = self.get_rom_by_id(moby_id)
return [rom] if rom["moby_id"] else []

def get_matched_roms_by_name(
self, search_term: str, platform_moby_id: int
Expand Down
Binary file added frontend/assets/platforms/amiibo.ico
Binary file not shown.

0 comments on commit eff0967

Please sign in to comment.