Skip to content

feat(scraper): support custom gamelist bundles#927

Merged
wizzomafizzo merged 2 commits into
mainfrom
toml-gamelists-path
Jul 16, 2026
Merged

feat(scraper): support custom gamelist bundles#927
wizzomafizzo merged 2 commits into
mainfrom
toml-gamelists-path

Conversation

@BossRighteous

@BossRighteous BossRighteous commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add optional per-system gamelist bundles stored independently from ROM directories
  • resolve bundle ROM paths against the system's first ROM root and asset paths against the bundle directory
  • treat missing bundle image references as optional and fall back through bundle and ROM-root media folders
  • preserve regular gamelist precedence and existing cross-root artwork behavior
  • add configuration, scraper, companion-entry, and multi-root coverage

Configuration

[scraper.gamelist_xml]
custom_path = "/path/to/gamelists"

Core checks <custom_path>/<system ID>/gamelist.xml for each indexed system. Custom gamelists enrich existing MediaDB records; they do not create systems, titles, or media rows.

Summary by CodeRabbit

  • New Features
    • Added support for configuring a custom gamelist.xml bundle via scraper.gamelist_xml.custom_path.
    • Custom gamelists now resolve artwork/media paths relative to a dedicated custom asset directory.
    • Standard (regular) gamelists continue to take precedence over custom sources, while custom data enriches existing entries.
  • Documentation
    • Updated gamelist.xml loading behavior, precedence, and artwork fallback rules for custom bundles.
  • Bug Fixes
    • Improved missing artwork handling for custom vs regular sources, including companion-driven mappings and path normalization.
  • Tests
    • Added coverage for custom bundle parsing, precedence, malformed file skipping, and companion asset behavior.

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7bd0dc9b-394e-4c72-9536-ecdf5d944638

📥 Commits

Reviewing files that changed from the base of the PR and between ffc533f and 51b46b7.

📒 Files selected for processing (2)
  • pkg/config/configscraper_test.go
  • pkg/database/scraper/gamelistxml/scraper_test.go
💤 Files with no reviewable changes (1)
  • pkg/config/configscraper_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • pkg/database/scraper/gamelistxml/scraper_test.go

📝 Walkthrough

Walkthrough

This PR adds TOML configuration for custom EmulationStation gamelists, loads per-system custom files, and tracks separate asset roots from ROM roots. Media mapping, companion metadata, tests, and scraper documentation now reflect custom asset resolution and precedence behavior.

Changes

Custom Gamelists and Asset Path Resolution

Layer / File(s) Summary
Scraper configuration and persistence
pkg/config/config.go, pkg/config/configscraper.go, pkg/config/configscraper_test.go
Adds scraper.gamelist_xml.custom_path configuration and a nil-safe accessor, with load and save/load round-trip tests.
Custom gamelist loading and record propagation
pkg/database/scraper/gamelistxml/scraper.go, pkg/database/scraper/gamelistxml/scraper_test.go
Custom per-system gamelists use the system ROM root for game paths and a separate custom directory for assets; records carry the asset root and image-existence policy. Tests cover precedence, malformed files, and custom bundles.
Asset mapping and companion propagation
pkg/database/scraper/gamelistxml/scraper.go, pkg/database/scraper/gamelistxml/scraper_test.go
MapToDB resolves media from the asset root, optionally checks image existence, normalizes paths, and propagates asset roots through companion records.
Scraper behavior documentation
docs/scraper.md
Documents ROM-root loading, custom bundle lookup, path resolution, fallback behavior, precedence, and matching constraints.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Config as Config Instance
  participant Scraper as Gamelist Scraper
  participant Filesystem as Custom Asset Filesystem
  participant Database as Database Mapper
  Config->>Scraper: Read scraper.gamelist_xml.custom_path
  Scraper->>Filesystem: Load custom system gamelist.xml
  Filesystem-->>Scraper: Return entries and custom asset root
  Scraper->>Database: Map records with asset root
  Database->>Filesystem: Resolve and check referenced images
  Filesystem-->>Database: Return resolved media properties
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 15.38% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding support for custom gamelist bundles in the scraper.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch toml-gamelists-path

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@BossRighteous

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 33.78378% with 49 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/database/scraper/gamelistxml/scraper.go 43.10% 30 Missing and 3 partials ⚠️
pkg/config/configscraper.go 0.00% 16 Missing ⚠️

📢 Thoughts on this report? Let us know!

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pkg/database/scraper/gamelistxml/scraper_test.go (1)

1205-1213: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add targeted tests for the newly introduced custom-gamelist and stat-gated asset flows.

This change only updates the pathProp call signature; it does not add coverage for the new branches introduced in this PR (loadCustomGamelistFile, AssetRootPath propagation, and ScraperStatGamelistImages true/false behavior in MapToDB). Please add tests for those paths before merge.

As per coding guidelines, “Write tests for all new code — see TESTING.md and pkg/testing/README.md”.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/database/scraper/gamelistxml/scraper_test.go` around lines 1205 - 1213,
The test suite only updated the pathProp call signature and lacks coverage for
the new branches; add targeted unit tests that exercise loadCustomGamelistFile
behavior, propagation of AssetRootPath through pathProp/MapToDB, and both
true/false cases of ScraperStatGamelistImages in MapToDB: create tests that (1)
simulate a custom-gamelist file and assert loadCustomGamelistFile is invoked and
parsed correctly, (2) set AssetRootPath and verify generated property paths from
pathProp/MapToDB use that root (including mixed separators normalization), and
(3) toggle ScraperStatGamelistImages and assert MapToDB includes or excludes
stat-gated image entries accordingly; reference functions:
loadCustomGamelistFile, AssetRootPath, pathProp, MapToDB,
ScraperStatGamelistImages to locate and extend tests.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@pkg/database/scraper/gamelistxml/scraper_test.go`:
- Around line 1205-1213: The test suite only updated the pathProp call signature
and lacks coverage for the new branches; add targeted unit tests that exercise
loadCustomGamelistFile behavior, propagation of AssetRootPath through
pathProp/MapToDB, and both true/false cases of ScraperStatGamelistImages in
MapToDB: create tests that (1) simulate a custom-gamelist file and assert
loadCustomGamelistFile is invoked and parsed correctly, (2) set AssetRootPath
and verify generated property paths from pathProp/MapToDB use that root
(including mixed separators normalization), and (3) toggle
ScraperStatGamelistImages and assert MapToDB includes or excludes stat-gated
image entries accordingly; reference functions: loadCustomGamelistFile,
AssetRootPath, pathProp, MapToDB, ScraperStatGamelistImages to locate and extend
tests.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fcfcb64a-5e6f-42c0-b11f-b8add912504f

📥 Commits

Reviewing files that changed from the base of the PR and between 4bbf127 and d0637b3.

📒 Files selected for processing (4)
  • pkg/config/config.go
  • pkg/config/configscraper.go
  • pkg/database/scraper/gamelistxml/scraper.go
  • pkg/database/scraper/gamelistxml/scraper_test.go

@wizzomafizzo

Copy link
Copy Markdown
Member

they sound like good changes to me! i'm just getting a patch release ready but happy to to merge it after that

@wizzomafizzo
wizzomafizzo force-pushed the toml-gamelists-path branch from d0637b3 to ffc533f Compare July 16, 2026 00:28
@wizzomafizzo wizzomafizzo changed the title feat(mediadb): toml settings for scraper bundle path and asset stat checks feat(scraper): support custom gamelist bundles Jul 16, 2026
@wizzomafizzo
wizzomafizzo marked this pull request as ready for review July 16, 2026 00:31

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/config/configscraper_test.go`:
- Around line 64-67: Remove the assert.Contains check that searches for raw
customPath in the serialized contents within the config scraper test. Keep the
assertions verifying the section and custom_path key, along with the existing
reloaded configuration check that validates round-trip correctness.

In `@pkg/database/scraper/gamelistxml/scraper_test.go`:
- Around line 384-388: Update the image path assertion in the scraper test to
wrap the filepath.Join result with filepath.ToSlash, matching the scraper’s
forward-slash normalization and the screenshot assertion below.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e1a96b58-b731-46d9-a000-ad56028c5844

📥 Commits

Reviewing files that changed from the base of the PR and between d0637b3 and ffc533f.

📒 Files selected for processing (6)
  • docs/scraper.md
  • pkg/config/config.go
  • pkg/config/configscraper.go
  • pkg/config/configscraper_test.go
  • pkg/database/scraper/gamelistxml/scraper.go
  • pkg/database/scraper/gamelistxml/scraper_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • pkg/config/config.go

Comment thread pkg/config/configscraper_test.go
Comment thread pkg/database/scraper/gamelistxml/scraper_test.go
@wizzomafizzo
wizzomafizzo merged commit 6f7f86f into main Jul 16, 2026
14 checks passed
@wizzomafizzo
wizzomafizzo deleted the toml-gamelists-path branch July 16, 2026 00:46
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.

2 participants