Skip to content

feat(scan): per-field artwork priority overrides#3838

Merged
gantoine merged 3 commits into
masterfrom
feat/per-field-artwork-scan-priority
Jul 19, 2026
Merged

feat(scan): per-field artwork priority overrides#3838
gantoine merged 3 commits into
masterfrom
feat/per-field-artwork-scan-priority

Conversation

@gantoine

Copy link
Copy Markdown
Member

Description
Explain the changes or enhancements you are proposing with this pull request.

Closes #3812.

Adds optional per-field artwork priority so users can prioritize metadata sources differently for each artwork field, instead of one shared scan.priority.artwork list applying to covers, screenshots, and manuals alike.

New optional config.yml keys, each falling back to scan.priority.artwork when omitted:

scan:
  priority:
    artwork:        # shared fallback (unchanged)
      - igdb
      - ss
    cover:          # cover art only
      - ss
      - tgdb
    screenshot:     # screenshots only
      - igdb
    manual:         # game manuals only
      - launchbox

This resolves the issue's core case: e.g. keep original box art for covers while sourcing screenshots from a different provider.

Scope / notes

  • Fully backward compatible: absent keys leave scanning behavior unchanged.
  • Config-only for now (priority is hand-edited YAML, as today); exposed read-only via GET /api/config.
  • The SGDB cover tie-break now respects the cover-specific order.
  • Intentionally out of scope (can follow up): new titles/video media types (would need new Rom columns + migration) and region auto-matching. See discussion on the issue.

AI assistance disclosure
Per CONTRIBUTING.md.

This PR was implemented with AI assistance (Claude Code). The design, code, tests, and docs were AI-generated under human direction and reviewed before submission.

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 (if applicable)

N/A (backend + config, no UI changes).

🤖 Generated with Claude Code

Add optional scan.priority.cover / screenshot / manual keys that each
override scan.priority.artwork for a single artwork field, falling back
to the shared artwork priority when omitted. This lets users, for
example, keep original box art for covers while sourcing screenshots
from a different provider.

Backward compatible: absent keys leave behavior unchanged. Config-only
(no UI), read-only exposure via GET /api/config.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 19, 2026 22:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@greptile-apps

greptile-apps Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds independent metadata-source priorities for artwork fields. The main changes are:

  • Optional cover, screenshot, and manual priority lists with shared artwork fallback.
  • Per-field source ordering during ROM scans.
  • Cover-specific SGDB tie-breaking.
  • Backend API and frontend model support for the override map.
  • Configuration examples and focused priority tests.

Confidence Score: 4/5

Per-field overrides can crash scans when they contain an unknown provider name.

  • The new lists are validated only as lists, not as known metadata sources.
  • An invalid entry reaches an unguarded enum conversion during scanning.
  • Omitted overrides, API serialization, and valid per-field ordering otherwise remain consistent.

backend/config/config_manager.py and backend/handler/scan_handler.py

Important Files Changed

Filename Overview
backend/config/config_manager.py Parses, validates, and exports the new per-field artwork priority lists, but validation does not reject unknown provider names.
backend/handler/scan_handler.py Applies field-specific artwork ordering and SGDB cover ranking; an unknown provider in a new override can raise during a scan.
backend/endpoints/configs.py Exposes the artwork override map through the configuration endpoint.
backend/endpoints/responses/config.py Adds the artwork override map to the backend response type.
backend/tests/handler/test_scan_priority.py Covers fallback and ordering behavior but does not cover invalid provider names in per-field overrides.
frontend/src/generated/models/ConfigResponse.ts Adds the new override map to the generated frontend response model.
frontend/src/stores/config.ts Adds an empty artwork override map to the frontend configuration defaults.

Fix All in Claude Code

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
backend/handler/scan_handler.py:124-126
**Unknown Override Source Crashes Scan**

When a new per-field list contains an unknown provider name, such as a typo in `scan.priority.cover`, this override reaches `MetadataSource(source)` without element validation and raises `ValueError` during scanning. Config validation currently accepts any list, so the application starts successfully but the affected scan fails instead of rejecting the invalid setting.

Reviews (1): Last reviewed commit: "feat(scan): per-field artwork priority o..." | Re-trigger Greptile

Comment thread backend/handler/scan_handler.py
gantoine and others added 2 commits July 19, 2026 19:07
Unknown provider slugs in scan.priority.cover/screenshot/manual are
already dropped by the downstream availability filter, so they never
crash a scan, but they silently did nothing. Surface likely typos with
a load-time warning, consistent with scan.media handling. A drift-guard
test keeps VALID_SCAN_PRIORITY_SOURCES in sync with MetadataSource.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gantoine
gantoine merged commit 5074ff3 into master Jul 19, 2026
13 checks passed
@gantoine
gantoine deleted the feat/per-field-artwork-scan-priority branch July 19, 2026 23:56
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.

[Feature] More control for scan priority

2 participants