Skip to content

Add ES-DE <sortname> import and edit support for ROM ordering#3460

Open
Copilot wants to merge 3 commits into
masterfrom
copilot/support-sortname-tag-es-de
Open

Add ES-DE <sortname> import and edit support for ROM ordering#3460
Copilot wants to merge 3 commits into
masterfrom
copilot/support-sortname-tag-es-de

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 31, 2026

ES-DE gamelist.xml imports were ignoring <sortname>, so collections with Kanji/Hanzi titles could not preserve the intended library ordering. This change imports that field, uses it for ROM name sorting without changing the displayed title, and exposes it as an editable ROM field.

  • Import ES-DE sort metadata

    • Parse <sortname> from gamelist.xml
    • Preserve it in gamelist metadata and on the ROM record as sort_name
  • Use sort_name for ordering

    • Prefer Rom.sort_name over Rom.name when ordering by name
    • Keep name as the display title; only sort behavior changes
  • Persist the new field

    • Add a migration introducing nullable roms.sort_name
  • Expose sort_name for editing

    • Include sort_name in ROM read/update API schemas
    • Add sort_name to the ROM edit dialog so it can be changed manually
    • Clear sort_name when metadata is unmatched
  • Cover the new behavior

    • Add parser coverage for <sortname>
    • Add DB-level coverage proving name ordering follows sort_name when present
    • Add endpoint coverage for editing and clearing sort_name
<game>
  <path>./akumajou-dracula.zip</path>
  <name>悪魔城ドラキュラ</name>
  <sortname>Akumajou Dracula</sortname>
</game>

With this imported, the ROM still displays as 悪魔城ドラキュラ, but name sorting uses Akumajou Dracula. The imported sort title can also be reviewed and edited later from the ROM edit form.

Co-authored-by: gantoine <3247106+gantoine@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for sortname tag in ES-DE gamelist.xml import Add ES-DE <sortname> import support for ROM ordering May 31, 2026
Copilot AI requested a review from gantoine May 31, 2026 13:48
@gantoine
Copy link
Copy Markdown
Member

gantoine commented May 31, 2026

@copilot include this issue in your work, where we expose sort_name as an editable field: #742

Co-authored-by: gantoine <3247106+gantoine@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 31, 2026

@copilot include this issue in your work, where we expose sort_name as an editable field: #742

Addressed in 3f98aa1: sort_name is now exposed through the ROM update API and edit dialog, and unmatching metadata clears it as well.

Copilot AI changed the title Add ES-DE <sortname> import support for ROM ordering Add ES-DE <sortname> import and edit support for ROM ordering May 31, 2026
@gantoine gantoine added the on-hold Pending further research or blocked by another issue label May 31, 2026
@gantoine gantoine marked this pull request as ready for review May 31, 2026 17:21
Copilot AI review requested due to automatic review settings May 31, 2026 17:21
Copy link
Copy Markdown
Contributor

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 ES-DE <sortname> support so imported ROMs can keep a display title while using a separate value for name-based ordering.

Changes:

  • Adds sort_name to the ROM model, migration, API schemas, update endpoint, and frontend edit form.
  • Parses ES-DE <sortname> from gamelist.xml and persists it during scans.
  • Updates ROM name ordering logic and backend tests for sorting/import/update behavior.

Reviewed changes

Copilot reviewed 15 out of 18 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
backend/alembic/versions/0082_add_rom_sort_name.py Adds nullable roms.sort_name column.
backend/models/rom.py Adds sort_name ORM field.
backend/handler/database/roms_handler.py Uses sort_name as the effective name-sort key when present.
backend/handler/metadata/base_handler.py Extends metadata ROM payload typing with sort_name.
backend/handler/metadata/gamelist_handler.py Parses <sortname> into gamelist metadata and ROM data.
backend/handler/scan_handler.py Initializes and preserves sort_name during scan updates.
backend/endpoints/roms/__init__.py Accepts, updates, and clears sort_name through the ROM update endpoint.
backend/endpoints/responses/rom.py Exposes sort_name in ROM response schemas.
backend/tests/handler/test_db_handler.py Adds DB-level coverage for sort_name ordering.
backend/tests/handler/metadata/test_gamelist_handler.py Adds parser coverage for <sortname>.
backend/tests/endpoints/roms/test_rom.py Adds endpoint coverage for editing and clearing sort_name.
frontend/src/services/api/rom.ts Includes sort_name in ROM update form data.
frontend/src/components/common/Game/Dialog/EditRom.vue Adds editable Sort name field to the ROM dialog.
frontend/src/locales/en_US/rom.json Adds English label for Sort name.
frontend/src/locales/en_GB/rom.json Adds British English label for Sort name.
frontend/src/__generated__/models/SimpleRomSchema.ts Regenerates frontend simple ROM schema with sort_name.
frontend/src/__generated__/models/DetailedRomSchema.ts Regenerates frontend detailed ROM schema with sort_name.
frontend/src/__generated__/models/Body_update_rom_api_roms__id__put.ts Regenerates update request schema with sort_name.
Files not reviewed (3)
  • frontend/src/generated/models/Body_update_rom_api_roms__id__put.ts: Language not supported
  • frontend/src/generated/models/DetailedRomSchema.ts: Language not supported
  • frontend/src/generated/models/SimpleRomSchema.ts: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

"status-never-playing": "Never Playing",
"status-now-playing": "Now Playing",
"status-retired": "Retired",
"sort-name": "Sort name",

const fields: FormInputField<UpdateRomInput>[] = [
["name", rom.name],
["sort_name", rom.sort_name],

class BaseRom(TypedDict):
name: NotRequired[str]
sort_name: NotRequired[str]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

on-hold Pending further research or blocked by another issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Support for <sortname> tag in ES-DE gamelist.xml import

3 participants