Introducing a new way to review your PRs.

Read the announcement

rommapp / romm

A beautiful, powerful, self-hosted ROM manager and player.

View on GitHub

22 documents · Updated Nov 23, 2026

docs / metadata-enrichment

Metadata enrichment

Metadata enrichment connects a library item to game information from external sources. It uses titles, platform identity, file hashes, provider IDs, and special file identifiers to find a record, then adds shared catalog fields, artwork, and provider-specific facts to the local item. The local file remains the catalog anchor while outside data improves how the item is named, displayed, searched, and understood.

Enrichment model

An enrichment run turns match clues into a provider result and then into catalog fields. The system keeps a common record shape for shared fields while preserving source-specific data with its provider identity.

This diagram shows the main enrichment path from a local item to a catalog record.

flowchart LR
    A[Library item] --> B[Match clues]
    B --> C[Selected providers]
    C --> D[Provider result]
    D --> E[Normalized fields and media]
    E --> F[Enriched catalog record]
    G[Scheduled reference index] --> B
    H[Region and language preference] --> E

Provider roles

Providers serve different parts of the match and enrichment process. Catalog providers identify the game and supply broad facts. Focused providers add one kind of data, while hash and artwork providers help the main lookup without replacing it.

RolePurpose
Catalog providerSupplies the main game identity and shared fields such as name, date, summary, platform data, and artwork.
Focused providerAdds a narrow feature such as achievements, completion data, or alternate cover art.
Hash providerUses file identity to return IDs for later catalog lookups.
Artwork providerSupplies media without becoming the catalog identity source.
Local catalog providerReads game facts and media from files already available in the library environment.
Title resolverTurns a special identifier such as a barcode into a title for normal matching.

Hash and title providers support later lookups. They do not replace the catalog match. Artwork providers can improve presentation, but they cannot set the game name or provider identity.

References: backend/…/base_handler.py• L191-298 backend/…/sgdb_handler.py• L12-30 backend/…/ra_handler.py• L65-79

Catalog record effects

A successful provider match stores the provider ID and the fields that the provider can supply. Shared fields can come from different sources, so one item can use one provider for identity, another for artwork, and a focused source for achievements.

The enriched record can include:

  • Name, sort name, summary, release date, genres, companies, ratings, and player information.
  • Cover art, screenshots, manuals, videos, and other media links.
  • Provider-specific IDs and data such as achievement records, completion measures, scene credits, or exact-file tags.
  • Localized names and descriptions selected with region and language preferences.

The catalog API exposes these results through the local record. See catalog data and API for the record contract.

References: backend/…/ss_handler.py• L363-386 backend/…/ra_handler.py• L65-79 backend/…/demozoo_handler.py• L50-76 backend/…/sgdb_handler.py• L12-14

Provider integrations

Each integration adapts one external source to the shared enrichment flow. A source must be enabled and reachable, and its platform mapping must support the current item before it can contribute normal metadata.

Catalog providers

Catalog providers supply the broad record that gives an item its external game identity. They usually search with a platform and a cleaned title, but a known provider ID or a file hash can provide a stronger path.

The shared handler normalizes titles by removing file-name noise, punctuation, article placement, and accent differences. Provider handlers can then apply source-specific rules. Special indexes can turn console serials, Switch IDs, arcade names, or ScummVM names into better search terms before a provider query.

ScreenScraper can identify a dump from hashes or from a platform and file name. It selects names, descriptions, dates, taxonomy, and media with the configured region and language order. Its dump fields remain separate from game-level metadata because they describe the exact file that matched.

Demozoo adds a scene-production record for supported platforms. It can match a tagged production ID or rank title results. Its normalized result can include production type, groups, party placement, credits, tags, links, screenshots, and related scene identifiers.

References: backend/…/base_handler.py• L139-162 backend/…/base_handler.py• L348-406 backend/…/ss_handler.py• L631-733 backend/…/ss_handler.py• L989-1120 backend/…/demozoo_handler.py• L329-491 backend/…/demozoo_handler.py• L546-607

Focused providers

Focused providers enrich an existing identity rather than define the main catalog record. Their data remains useful when the broad catalog provider does not offer the same feature.

RetroAchievements links a ROM to achievement data through a filename ID or a platform-specific hash index. Its result adds release data, genres, companies, artwork, achievements, and a flag that says whether the ROM hash matched a known game hash.

SteamGridDB supplies alternate cover resources. It searches candidate game names with a high match threshold and returns cover choices with content flags such as animated, NSFW, humor, or epilepsy. It does not supply the catalog name or general game facts.

References: backend/…/ra_handler.py• L193-239 backend/…/ra_handler.py• L268-361 backend/…/sgdb_handler.py• L32-59 backend/…/sgdb_handler.py• L64-147

Provider normalization

Normalization turns different provider responses into fields that the catalog can use in the same way. It converts dates, names, summaries, lists, scores, links, and media into shared forms while keeping provider-specific values under their source.

The system applies a field-level priority after normalization. The highest-ranked non-empty source supplies each shared field, but artwork fields use separate selection rules. A source can therefore win the cover without winning the summary. User-selected covers remain protected during normal updates.

Provider links are stored without sensitive query values when the URL contains credentials. The credentials are restored only when the application requests media from the provider. Response size limits also prevent an external response from expanding without bound.

References: backend/…/base_handler.py• L165-188 backend/…/base_handler.py• L216-298 backend/…/ss_handler.py• L173-191 backend/…/ss_handler.py• L414-628

Region and language preferences

Region and language settings guide which external values become visible in the local record. The system combines the file's region tags with the configured order, then uses that order for names, dates, descriptions, taxonomy, and media.

ScreenScraper applies one region order across its localized fields and media. It uses the preferred language order for descriptions and taxonomy. Exact-file regions, languages, and dump tags remain distinct from values that describe every release of the game.

References: backend/…/ss_handler.py• L194-245 backend/…/ss_handler.py• L631-733 backend/…/ss_handler.py• L765-815

Provider selection

The scan selects enabled providers that support the item's platform. It keeps separate groups for broad metadata, focused data, hashes, and artwork so each group can contribute without changing the role of another group.

Source availability

A provider is available only when its settings or credentials are valid and a health probe succeeds. Platform mapping is part of availability because a provider cannot make a platform-scoped match without its external platform identity.

The scan can continue when one provider is unavailable. A failed source leaves its fields empty and allows other sources or later scans to provide the missing data.

References: backend/…/base_handler.py• L191-265 backend/…/ss_handler.py• L908-928 backend/…/ra_handler.py• L151-166 backend/…/demozoo_handler.py• L494-524 backend/…/sgdb_handler.py• L17-30

Match inputs

Matching combines the universal platform identity with the strongest available clue. A provider ID in a file name or stored record is a direct lookup. A file hash can identify an exact dump, while a normalized title provides the normal fallback.

The shared title normalizer removes common naming differences. Provider-specific rules then handle source needs such as punctuation, localized names, platform aliases, serial indexes, Switch title IDs, and arcade set names. A provider accepts a result only when its match threshold or identity check is strong enough.

References: backend/…/base_handler.py• L73-80 backend/…/base_handler.py• L139-162 backend/…/base_handler.py• L300-346 backend/…/ss_handler.py• L935-970 backend/…/demozoo_handler.py• L563-607

Field selection

Provider results are merged at field level. General metadata follows one priority order, while covers, screenshots, manuals, and preferred media follow their own rules. This lets a specialized artwork source improve a record without changing its game identity.

Media selection also follows the scan's enabled media types. ScreenScraper can keep remote URLs and create local resource targets for selected media, while sensitive account values stay out of stored URLs.

References: backend/…/ss_handler.py• L414-628 backend/…/ss_handler.py• L837-905 backend/…/sgdb_handler.py• L149-199

Metadata update flows

Metadata enters the catalog during a library scan, a manual refresh, or a background update. A normal update uses stored provider IDs to fetch current records. A complete scan rebuilds selected metadata from the available match inputs.

Scan refreshes

The refresh flow uses the same scan path as library ingestion. See library scanning and filesystem for the surrounding file and scan lifecycle.

Scan typeMain purpose
New or completeFind matches and rebuild selected metadata.
UpdateRe-fetch known provider records and fill current fields.
UnmatchedSearch for missing IDs or missing provider data.
HashesRecalculate file identity and refresh hash-based matches.

An update does not replace a user-supplied cover with provider artwork. A complete scan can clear data from sources that are no longer selected. A hash result is cleared only after the provider gives a conclusive no-match answer.

References: backend/…/ss_handler.py• L1122-1158 backend/…/ra_handler.py• L327-361 backend/…/sgdb_handler.py• L32-59

Scheduled reference indexes

Some providers use local reference indexes instead of a live query for every item. Scheduled jobs download and prepare these indexes. Later scans use them to resolve special file identifiers into titles or provider IDs.

The shared handler uses indexes for Switch title and product IDs and for platform-specific identifiers such as console serials, arcade names, and ScummVM names. RetroAchievements refreshes a per-platform hash index after its configured age. A failed refresh is not saved as an empty index, so a temporary outage does not become a broad no-match result.

These indexes support enrichment but do not create catalog records by themselves. A scan must consume an index result and save the resulting provider match on the local item. See background jobs and scheduling for the job model.

References: backend/…/base_handler.py• L348-406 backend/…/base_handler.py• L446-508 backend/…/ra_handler.py• L173-239

Provider maintenance

External services can impose rate limits, quotas, credential checks, or changing response formats. Integrations treat these conditions as provider health or request-state signals so one source does not silently erase useful existing data.

ScreenScraper tracks quota state and skipped items during a scan. It can stop asking the service after a daily quota or credential failure, while a later scan can try again. Its repeated rate-limit skips are reported rather than hidden.

Demozoo spaces repeated requests and requires an API key. RetroAchievements keeps an existing hash match usable when a hash-index check fails. SteamGridDB requires a valid API key and a strong title match before it returns artwork.

References: backend/…/ss_handler.py• L62-170 backend/…/ss_handler.py• L277-295 backend/…/demozoo_handler.py• L39-42 backend/…/demozoo_handler.py• L502-524 backend/…/ra_handler.py• L241-254 backend/…/sgdb_handler.py• L17-30

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep provider IDs, normalized fields, source metadata, manual matching, and update lookups aligned.
  • When changing shared title matching, check provider-specific punctuation, platform aliases, special identifiers, and confidence thresholds.
  • When changing ScreenScraper media, preserve region order, language fallback, media-type gates, dump fields, and credential stripping.
  • When changing a hash index, keep refresh age, failed-request handling, platform mapping, and exact-file match state aligned.
  • When changing a new provider, update its enable check, health probe, platform map, result shape, and provider group.
  • When changing artwork selection, keep general field priority separate from cover-resource selection and user-selected media.
  • When changing Demozoo data, keep production IDs, title search, scene links, summary notes, and external URLs aligned.
  • When changing SteamGridDB data, keep the high-confidence game match separate from the cover-resource filters.

Important failure modes

TriggerConsequenceGuard
A provider is disabled, unauthenticated, unhealthy, or unmapped for the platformThe provider contributes no new fieldsEnable checks, health probes, and platform mappings gate use
A title is ambiguous or below the match thresholdNo provider identity is attachedHandlers require a strong ID or ranked title match
A hash index refresh failsA temporary outage could look like no known hashesFailed responses are not cached as empty indexes
Hash data describes a different dump than the local fileExact-file regions, languages, or tags could be wrongDump fields are read only from the local file's matching hashes
ScreenScraper quota or credentials fail during a scanSome items receive no ScreenScraper metadataScan state records skipped items and allows later retry
Provider credentials remain in stored media URLsSecrets can leak through catalog dataSensitive query values are removed and restored only at download time
A Demozoo request is repeated too quicklyThe provider may reject or throttle the integrationRequests use a one-second rate limit
SteamGridDB returns no strong game match or only filtered gridsNo alternate cover is addedThe integration requires a high similarity score and usable cover resource

Key files

FileWhy to read it
backend/…/base_handler.pyDefines shared title normalization, special identifier resolution, provider request limits, and safe URL handling.
backend/…/ss_handler.pyShows hash-first matching, locale selection, media selection, quota handling, and exact-dump fields.
backend/…/ra_handler.pyShows achievement matching through a scheduled hash index and safe index refresh behavior.
backend/…/demozoo_handler.pyShows scene-production matching and normalization of credits, parties, links, notes, and artwork.
backend/…/sgdb_handler.pyShows artwork-only enrichment and high-confidence cover selection.