8000 Add playmatch hash-based integration by DevYukine · Pull Request #1931 · rommapp/romm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add playmatch hash-based integration #1931

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

Merged
merged 16 commits into from
Jun 15, 2025

Conversation

DevYukine
Copy link
@DevYukine DevYukine commented Jun 5, 2025

Description
This adds basic support for matching roms via hashes (and filename + filesize) with playmatch

This works by adding a new metadata handler for Playmatch and then when scanning roms and before searching on IGDB we send a request with filename, filesize and the hashes to playmatch and check if there is anything in the database

My idea here is to make this fully optional, i've added a flag to disable this via env for this

also this code can probably be refactored and improved as im not a great python developer myself and from first looks i can already tell that it should only be run once hashes are calculated as in the current way is run before hashes are calculated and only matches by filename + filesize (which is also unique but just not as good as hashes when it comes to potential false positives)

i've tested this succesfully locally in a develop environment after i got this to work (only took me a few hours... we love setting up an dev env)

I've recently released a tool which basically does this as script (https://github.com/DevYukine/romm-hash-matcher) and with that also improved Playmatch performance and caching to ensure that it will survive all the traffic from RomM instances (Playmatch has Cloudflare caching + an own caching layer and the average response time for hash identify calls is ~50ms for non cached ones)

I'm interested in feedback of all kinds here 👍

Some important information:

Playmatch currently only supports IGDB (more are planned) and Redump and No-Intro Dat files (which are the most popular) so we can right now probably just implement it for IGDB matching

Checklist
Please check all that apply.

  • I've tested the changes locally
  • I've updated relevant comments
  • I've assigned reviewers for this PR
  • I've added unit tests that cover the changes

Screenshots

as this is only in the backend i can't show any nice UI but this is how the console log output looks right now
image

@DevYukine DevYukine marked this pull request as draft June 5, 2025 00:40
@zurdi15
Copy link
Member
zurdi15 commented Jun 5, 2025

Pretty solid PR so far 👌

@DevYukine
Copy link
Author

I've now added an env variable which allows playmatch to be disabled (like i suggested in the PR itself)

I've also changed request exceptions so that they get logged but then identify just silently fails instead throwing an error as Playmatch errors should not stop a Scan in my opinion

@DevYukine
Copy link
Author

I'm also still not happy where i call playmatch identify right now as this will not work great for new instances

right now if you start a new instance it will do the matching before the hash calculation and always call playmatch with only filename and filesize, in the long run this should probably be changed to run hash calculation before doing metadata matching (hasheous would have the same issues as playmatch here)

but right now this will work fine for older instances which already have run a scan before which triggered hash calculation but on new instances it will always use playmatch without hashes

I'm not sure if this is the scope of such a change but i'm interested if you think its worth changing here

@DevYukine
Copy link
Author

This PR requires #1981 to be merged

@gantoine gantoine changed the title feat(hash): add playmatch hash integration Add playmatch hash-based integration Jun 15, 2025
@gantoine gantoine marked this pull request as ready for review June 15, 2025 21:02
@gantoine gantoine requested review from gantoine and Copilot June 15, 2025 21:02
Copy link
@Copilot Copilot AI left a 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 adds support for integrating Playmatch hash-based ROM matching into the system. The key changes include:

  • Adding a new Playmatch metadata handler and integrating it into the scan process.
  • Updating the heartbeat and environment configuration to include the PLAYMATCH_API_ENABLED flag.
  • Modifying front-end metadata options to display and enable Playmatch when configured.

Reviewed Changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
frontend/src/views/Scan.vue Adds Playmatch as a metadata source option
frontend/src/stores/heartbeat.ts Updates heartbeat configuration with PLAYMATCH_API_ENABLED
env.template Adds the PLAYMATCH_API_ENABLED environment variable
backend/handler/scan_handler.py Integrates Playmatch lookup into the ROM scanning process
backend/handler/metadata/pm_handler.py Implements Playmatch API lookup functionality
backend/handler/metadata/init.py Exports the Playmatch handler
backend/endpoints/sockets/scan.py Minor reordering in ROM file attributes
backend/endpoints/responses/heartbeat.py Updates heartbeat response to include Playmatch flag
backend/endpoints/heartbeat.py Incorporates PLAYMATCH_API_ENABLED in heartbeat endpoint
backend/config/init.py Config updates for PLAYMATCH_API_ENABLED
DEVELOPER_SETUP.md Updates poetry commands for comprehensive dependency sync
Files not reviewed (1)
  • frontend/src/generated/models/MetadataSourcesDict.ts: Language not supported
Comments suppressed due to low confidence (2)

env.template:28

  • [nitpick] Consider setting a default value (e.g. 'true') for PLAYMATCH_API_ENABLED in the env.template file to promote clarity and prevent misconfiguration.
PLAYMATCH_API_ENABLED=

backend/handler/scan_handler.py:446

  • Using dictionary spread on playmatch_handler_rom assumes the returned IGDBRom object supports dict expansion. Please ensure that IGDBRom is a dict-like structure or explicitly convert it before merging to avoid potential runtime errors.
**playmatch_handler_rom,

@gantoine gantoine merged commit a7ba717 into rommapp:master Jun 15, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0