ROMParser

ROMParser will parse out useful information from both filenames and parsed .dat files. These are things like regions, languages, and various flags for things like Demos or BIOS that then can be used to choose the best ROM.

If explicit languages are not found, then ROMParser will generally assign a language based on the region. This is not true for regions like Scandinavia, where it could be any of multiple languages.

For more details on the ROMParser arguments, see the config file documentation.

API

class romsearch.ROMParser(platform, game, config_file=None, config=None, platform_config=None, default_config=None, regex_config=None, logger=None)[source]

ROM parser tool

This works per-game, per-platform, so must be specified here

Parameters:
  • platform (str) – Platform name

  • game (str) – Game name

  • config_file (str, optional) – path to config file. Defaults to None.

  • config (dict, optional) – configuration dictionary. Defaults to None.

  • platform_config (dict, optional) – platform configuration dictionary. Defaults to None.

  • default_config (dict, optional) – default configuration dictionary. Defaults to None.

  • regex_config (dict, optional) – regex configuration dictionary. Defaults to None.

  • logger (logging.Logger, optional) – logger instance. Defaults to None.

finalise_file_dict(file_dict)[source]

Do any last minute finalisation to the file dict

parse_dat(f, file_dict=None)[source]

Parse info out of the dat file

parse_file(f)[source]

Parse useful info out of a specific file

parse_filename(f, file_dict=None)[source]

Parse info out of filename

parse_retool(f, file_dict=None)[source]

Parse info out of the retool file

run(files)[source]

Run the ROM parser

set_game_category(file_dict)[source]

If a dat category hasn’t been set, set it to game

set_implicit_languages(file_dict)[source]

Set implicit language from region, if we don’t already have languages