Esempio n. 1
0
def get_system_choices():
    """Return list of systems for inclusion in dropdown"""
    xml_path = os.path.join(settings.CACHE_DIR, "mame", "mame.xml")
    if not system.path_exists(xml_path):
        logger.info("Getting full game list from MAME...")
        mame_inst = mame()
        mame_inst.write_xml_list()
    for system_id, info in sorted(
            get_supported_systems(xml_path).items(),
            key=lambda sys: (sys[1]["manufacturer"], sys[1]["description"]),
    ):
        if info["description"].startswith(info["manufacturer"]):
            yield ("%(description)s (%(year)s)" % info, system_id)
        else:
            yield ("%(manufacturer)s %(description)s (%(year)s)" % info,
                   system_id)
Esempio n. 2
0
def get_system_choices(include_year=True):
    """Return list of systems for inclusion in dropdown"""
    if not system.path_exists(MAME_XML_PATH, exclude_empty=True):
        mame_inst = mame()
        if mame_inst.is_installed():
            AsyncCall(write_mame_xml, notify_mame_xml)
        return []
    for system_id, info in sorted(
        get_supported_systems(MAME_XML_PATH).items(),
        key=lambda sys: (sys[1]["manufacturer"], sys[1]["description"]),
    ):
        if info["description"].startswith(info["manufacturer"]):
            template = ""
        else:
            template = "%(manufacturer)s "
        template += "%(description)s"
        if include_year:
            template += " %(year)s"
        system_name = template % info
        system_name = system_name.replace("<generic>", "").strip()
        yield (system_name, system_id)
Esempio n. 3
0
def get_system_choices(include_year=True):
    """Return list of systems for inclusion in dropdown"""
    if not system.path_exists(MAME_XML_PATH, exclude_empty=True):
        AsyncCall(write_mame_xml, notify_mame_xml)
        logger.warning(
            "MAME XML generation launched in the background, not returning anything this time"
        )
        return []
    for system_id, info in sorted(
            get_supported_systems(MAME_XML_PATH).items(),
            key=lambda sys: (sys[1]["manufacturer"], sys[1]["description"]),
    ):
        if info["description"].startswith(info["manufacturer"]):
            template = ""
        else:
            template = "%(manufacturer)s "
        template += "%(description)s"
        if include_year:
            template += " %(year)s"
        system_name = template % info
        system_name = system_name.replace("<generic>", "").strip()
        yield (system_name, system_id)