fix(screenscraper): skip name search after notgame hash lookup#3417
Merged
gantoine merged 4 commits intoMay 24, 2026
Merged
Conversation
When jeuInfos.php returned a notgame entry (BIOS files, ZZZ hacks, etc.), lookup_rom() had no notgame check, leading to two bugs: - notgame entries with a real ID were stored as valid SS matches - notgame entries with a falsy ID fell through to a jeuRecherche.php name search that always returned nothing (pointless quota usage) Adds _is_notgame() and NOTGAME_NAME_PREFIX, returns SSRom(notgame=True) from lookup_rom() on a notgame hit, and guards the get_rom() fallback in scan_handler so the name search is skipped entirely. Also adds the missing notgame filter to _search_rom() so ZZZ entries can't match by name either. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The previous commit added a notgame skip-name-search check in scan_handler
but used a different key ("notgame") than what lookup_rom returned
("not_game"), so the fallback was never actually skipped. Align both on
SSRom.not_game, pop the internal flag before returning the SSRom to the
rest of the scan pipeline, and rename the helper to _is_not_game for
consistency with the field name.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Instead of smuggling an internal control flag through the SSRom dict, lookup_rom now returns (SSRom, is_not_game: bool). scan_handler unpacks the tuple and short-circuits the name-search fallback when either an ss_id matched or the hash lookup flagged the entry as notgame. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
gantoine
approved these changes
May 24, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes ScreenScraper “notgame” handling during scans so BIOS/“ZZZ(NOTGAME)” entries do not get treated as valid matches and do not trigger the fallback fuzzy name search (saving API quota).
Changes:
- Add
_is_not_game()detection and use it to ignorenotgameresponses from both hash lookup and name search results. - Change
SSHandler.lookup_rom()to return(SSRom, is_not_game)and update scan flow to skip the filename-search fallback whenis_not_gameis true. - Add unit tests covering
lookup_rom()returning the notgame flag.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| backend/handler/metadata/ss_handler.py | Adds notgame detection, filters notgame results, and returns an explicit notgame indicator from hash lookup. |
| backend/handler/scan_handler.py | Skips ScreenScraper name-search fallback when hash lookup indicates a notgame match. |
| backend/tests/handler/metadata/test_ss_handler.py | Updates notgame helper tests and adds new async tests for lookup_rom notgame signaling. |
Comments suppressed due to low confidence (2)
backend/tests/handler/metadata/test_ss_handler.py:365
ScreenScraperService.get_game_infois an async method, but these tests patch it withpatch.object(..., return_value=...), which replaces it with a non-awaitableMagicMock. Sincelookup_rom()doesawait self.ss_service.get_game_info(...), this will raiseTypeError: object dict can't be used in 'await'. Patch withnew_callable=AsyncMock(or set the attribute to anAsyncMock(return_value=...)) so the awaited call works.
assert result == url
def test_does_not_duplicate_existing_credentials(self):
"""Pre-existing ssid/sspassword on the URL are replaced, not duplicated."""
backend/tests/handler/metadata/test_ss_handler.py:382
- Same issue as above:
get_game_infois awaited insidelookup_rom(), but it is patched with a plainMagicMockviapatch.object(..., return_value=...). UseAsyncMockso the awaited call returnsnotgame_responsewithout raising aTypeError.
def test_handles_stripped_url_from_extract_media(self):
"""A URL that's already had ssid/sspassword stripped (the storage form)
gets credentials re-attached cleanly, with dev creds and other params
left intact."""
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When
jeuInfos.phpreturns anotgameentry (BIOS files, ZZZ hacks, unlicensed dumps, etc.), RomM had two related bugs:lookup_rom()passed it straight tobuild_ss_game(), storing it as a legitimate SS match."0"),lookup_rom()returnedSSRom(ss_id=None)andscan_handlerfell through toget_rom(), issuing ajeuRecherche.phpfuzzy name search that always returned nothing useful (SS's ownnotgameflag means no valid match will ever be found by name). This wastes the user's daily API quota.Fix:
Bug #3415
NOTGAME_NAME_PREFIXconstant and_is_notgame()helper (checks both thenotgame: "true"API field andZZZ(NOTGAME)name prefix)lookup_rom()now detects notgame entries before callingbuild_ss_game()and returnsSSRom(ss_id=None, notgame=True)scan_handlerguards theget_rom()fallback: iflookup_rom()returnednotgame=True, thejeuRecherche.phpcall is skipped entirely_search_rom()now filters out notgame entries from name search results (defensive fix for the name search path)notgame: NotRequired[bool]field toSSRomChecklist