INNER CODE UNIT · Python

get_config_ids

ImranR98/apps.obtainium.imranr.dev · scripts/generate_from_url.py:100

def get_config_ids(existing_app_data):
    """Collect the ids already present in a config file."""
    if "configs" in existing_app_data:
        return [config.get("id") for config in existing_app_data["configs"]]
    return [existing_app_data.get("config", {}).get("id")]


def find_existing_config_files(app_id):
    """Find existing config files for an app id in either folder."""
    return [
        os.path.join(APPS_PATH, folder, f"{app_id}.json")
        for folder in ("complex", "simple")
        if os.path.exists(os.path.join(APPS_PATH, folder, f"{app_id}.json"))
    ]


def find_config_file(name):
    """Locate a config file by file name or path relative to the apps folder."""

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…