This repository has been archived on 2025-01-10. You can view files and clone it, but cannot push or open issues or pull requests.

23 lines
672 B
Python
Raw Normal View History

2025-01-09 23:01:07 +01:00
from json import load
from os import path
from .types import Cover
def get_collection(console: str) -> list[Cover]:
covers: list[Cover] = []
with open(f"{path.dirname(__file__)}/metadata/{console}.json") as f:
games = load(f)
for ref in games:
game = games[ref]
game = game | (games[game["ref"]] if "ref" in game else {})
covers.append(
Cover(
name=game["name"],
logo=game["logo"] if "logo" in game else None,
vid=game["vid"] if "vid" in game else None,
ref=ref,
)
)
return covers