Skip to main content

A library and CLI utility for ROM metadata inspection and search

Project description

romq

Python License Status

romq is a library and CLI utility for ROM metadata inspection and search.

Table of contents

Features

  • Inspect: Extract metadata from ROM files.
  • Search: Scan a directory tree for ROMs by metadata (mapper, format, mirroring, etc.).
  • Supported systems:
    • NES: iNES 1.0, iNES 2.0 (partial — bytes 13–15 not parsed yet).
    • Support for other consoles is planned.

Installation

Requirements

  • Python 3.14+

Install

TODO

Usage

CLI

Inspect a ROM:

romq nes inspect roms/rom.nes

Output:

ROM: roms/rom.nes
  Format           iNES 2.0
  Console          NES
  TV System        RP2C02 (NTSC NES)
  Mapper           4
  Submapper        0
  Mirroring        Horizontal
  Trainer          False
  Alternate NT     False
  Battery-backed   False
  PRG ROM          131072
  CHR ROM          131072
  PRG RAM          0
  PRG NVRAM        0
  CHR RAM          0
  CHR NVRAM        0

See romq nes inspect --help for all available options.

Search a directory tree with filters:

romq nes search --mapper-id 4 ./roms

Output:

roms/rom.zip
  [iNES 2.0 | RP2C02 (NTSC NES) | Mapper 4 | Horizontal | PRG 131072 | CHR 131072]
roms/rom2.7z
  [iNES 2.0 | RP2C02 (NTSC NES) | Mapper 4 | Horizontal | PRG 262144 | CHR 262144]
ROM matches: 2, Errors: 0

See romq nes search --help for all available options.

Library

romq is also available as a Python module.

Inspect a ROM

import romq

try:
    rom_info = romq.nes.inspect_rom("roms/rom.nes")
    # Or from a archive (ZIP, 7z)
    # romq.nes.inspect_rom("roms/rom.zip")

    print(rom_info.mapper_id)       # 4
    print(rom_info.rom_format)      # RomFormat.INES_20
    print(rom_info.console_type)    # ConsoleType.NES
    # See `romq.nes.RomInfo` for all available fields
except romq.errors.RomqError as error:
    print(f"ROM inspection error: {error}")
except OSError:
    print("System error")

Search ROMs

import romq

# Find all ROMs in a directory
result = romq.nes.search_roms("/roms")

# Apply any combination of filters to narrow results
result = romq.nes.search_roms(
    "/roms/nes",
    query=romq.nes.SearchQuery(
        mapper_id=4,
        submapper_id=0,
        rom_format=romq.nes.RomFormat.INES_20,
        mirroring=romq.nes.Mirroring.HORIZONTAL,
        console_type=romq.nes.ConsoleType.NES,
        tv_system=romq.nes.TvSystem.NTSC,
        has_battery=True,
        has_trainer=False,
        has_alternate_nt=False,
    )
)

# Use a predicate for complex logic (field filters are ignored if predicate is given)
def custom_filter(metadata: romq.nes.RomMetadata) -> bool:
    return (
        metadata.prg_rom_size > 16384
        and metadata.mapper_id in (1, 4)
        and metadata.tv_system == romq.nes.TvSystem.NTSC
        # See `romq.nes.RomMetadata` for all available fields
    )

result = romq.nes.search_roms("/roms", predicate=custom_filter)

# results.matches contains successful matches
for match in result.matches:
    print(f"{match.filepath}: mapper_id={match.metadata.mapper_id}")

# results.failures contains details about files that couldn't be parsed
for failure in result.failures:
    print(f"Error: {failure.filepath}:{failure.error}")

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

romq-0.1.0.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

romq-0.1.0-py3-none-any.whl (21.7 kB view details)

Uploaded Python 3

File details

Details for the file romq-0.1.0.tar.gz.

File metadata

  • Download URL: romq-0.1.0.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for romq-0.1.0.tar.gz
Algorithm Hash digest
SHA256 486470e44e4b568449728130a06c40116e5cfda07f8b49269eb687666dec0de5
MD5 6a017787e8e4e81a04448639f2071113
BLAKE2b-256 3b87c6983672bf146ef3f58d9513f7297d57b0790b6de7d2ce38e10d610fad8d

See more details on using hashes here.

Provenance

The following attestation bundles were made for romq-0.1.0.tar.gz:

Publisher: release.yml on artcom-net/romq

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file romq-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: romq-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 21.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for romq-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2efe6505cadb1cbad1c1df2dd354664fb80d707e4fb8ff043c355be099000220
MD5 c620dbc94d20234a9b861ccada039c05
BLAKE2b-256 2766539646d9517e70d1ce3f15a0a46f33431852510155da4aeec02764c60ada

See more details on using hashes here.

Provenance

The following attestation bundles were made for romq-0.1.0-py3-none-any.whl:

Publisher: release.yml on artcom-net/romq

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page