[Feature] Download a ROM by file category

Open
#5,487 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
53/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
api

Research direction

Start by tracing GET /api/roms/{id}/content/{file_name} and its HEAD counterpart, then inspect how file_ids selects files and how the response builds single-file downloads, zip archives, and generated .m3u files. Add category inclusion and exclusion that combine with file_ids; done means both methods return only the selected files in the described formats.

Written by the indexing model from the issue text.

Description

Is your feature request related to a problem? Please describe.
A client that installs games on a device fetches a game through GET /api/roms/{id}/content/{file_name} and often wants only the game's own files, not the manuals, soundtracks, screenshots, patches or other files RomM files under a category folder. The only selector today is file_ids, a list of individual file ids, so leaving one manual/ folder out of a folder game (a PS3 or Wii U dump) means listing thousands of ids. The request line then outgrows the 16 KiB the nginx in the image accepts, or less behind a reverse proxy, and the client has to download the whole game and delete what it did not want.

Describe the solution you'd like
A query parameter on the content endpoint (and its HEAD) that selects files by category, for example include_categories=game, with exclude_categories=manual,soundtrack as its counterpart. The response would be built exactly as for the selected files: a single file served as itself, several as a zip whose generated .m3u is built from those files. It combines with file_ids.

Describe alternatives you've considered

  • file_ids with every file to keep: works, but breaks on large folder games because of the URL length.
  • A POST variant of the content endpoint taking the id list in the body: avoids the limit, but every client still computes the list.
  • Downloading everything and deleting the extras afterwards: a fallback, at the cost of the extra download.

Additional context
Since 5.4.0 (#4581, #4854) a file's category comes only from the folder directly below the game's folder, which makes it reliable enough to filter on. Grout, Argosy and Ludo each filter by category on their own side today, with different lists.

Related: #2707 asks for this choice in the UI (option 2); this is the API side of it, which clients need regardless.

Dominant language
Python
Stars
13.3k
Forks
747
Avg merge
20h 58m
Merged PRs (30d)
207

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rommapp/romm

All issues in rommapp/romm

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.