-
-
Notifications
You must be signed in to change notification settings - Fork 247
Use hasheous as igdb proxy #1997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Running Code Quality on PRs by uploading data to Trunk will soon be removed. You can still run checks on your PRs using trunk-action - see the migration guide for more information. |
Test Results91 tests 91 ✅ 29s ⏱️ Results for commit 0e5a486. ♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR integrates Hasheous as a proxy for IGDB lookups and refactors hash-based ROM identification flows.
- Refactored
scan_handler
to use single-match fetchers (fetch_playmatch_hash_match
,fetch_hasheous_hash_match
) and updated call sites accordingly. - Simplified
PlaymatchHandler.lookup_rom
to return a singlePlaymatchRomMatch
with onlyigdb_id
. - Updated
IGDBHandler
to hardcode timeouts and usepydash.get
for nested property access. - Enhanced
HasheousHandler
with proxy endpoints for IGDB and RA, a newextract_metadata_from_igdb_rom
helper, and DEV_MODE switching for the base URL.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
File | Description |
---|---|
backend/handler/scan_handler.py | Renamed fetch functions, switched to single-match returns, updated asyncio.gather calls. |
backend/handler/metadata/playmatch_handler.py | Removed multi-match logic, updated PlaymatchRomMatch TypedDict and lookup_rom signature. |
backend/handler/metadata/igdb_handler.py | Dropped timeout parameter, standardized to 120s, replaced nested .get with pydash.get . |
backend/handler/metadata/hasheous_handler.py | Added extract_metadata_from_igdb_rom , IGDB/RA proxy methods, DEV_MODE URL toggle. |
Comments suppressed due to low confidence (3)
backend/handler/scan_handler.py:484
- New hash-based and proxy lookup flows for Hasheous are introduced here but no unit tests were added. Consider adding tests for both
fetch_hasheous_hash_match
andfetch_hasheous_rom
to ensure correct behavior under various scan types.
async def fetch_hasheous_rom(hasheous_rom: HasheousRom) -> HasheousRom:
backend/handler/scan_handler.py:394
- The inner double quotes inside this f-string will cause a syntax error. Use single quotes for the dictionary key (e.g.,
playmatch_rom['igdb_id']
) or escape the inner quotes.
f"{hl(str(playmatch_rom["igdb_id"]), color=BLUE)} :alien_monster:"
backend/handler/metadata/hasheous_handler.py:306
- This f-string also contains unescaped inner double quotes. Replace with
hasheous_rom['igdb_id']
to avoid a syntax error.
f"No Hasheous game found for IGDB ID {hasheous_rom["igdb_id"]}."
@@ -610,15 +610,15 @@ async def get_matched_roms_by_name( | |||
alternative_roms_ids = [] | |||
for rom in alternative_matched_roms: | |||
alternative_roms_ids.append( | |||
rom.get("game").get("id", "") | |||
pydash.get(rom, "game.id", "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to avoid the magical pydash.get
function, as we lose typing information. In this case, Mypy won't be able to alert us if we are trying to append the wrong value type to this list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general I would agree, but I'd like to fix/refactor all these in 1 go in a future PR and remove all of them at once in igdb_handler
Description
Explain the changes or enhancements you are proposing with this pull request.
This PR uses hasheous as a metadata proxy for games with IGDB matches. This means that users won't have to setup their own IGDB API keys and account to fetch (most) metadata, as hasheous will proxy the important ones.
Checklist
Please check all that apply.