Mod: read name, description and authors from json if available

This commit is contained in:
Toast 2025-05-29 18:50:01 +02:00 committed by Toast
parent bfefcd757e
commit da8749e1a7

View file

@ -24,12 +24,18 @@ class Mod:
# Mod metadata
@property
def name(self) -> str | None:
if self.__has_meta_json:
if "name" in self.__meta:
return self.__meta.get("name", str)
if "name" not in self.__config:
return None
return self.__config.get("name", str)
@property
def description(self) -> str | None:
if self.__has_meta_json:
if "description" in self.__meta:
return self.__meta.get("description", str)
if "description" not in self.__config.keys():
return None
else:
@ -37,6 +43,11 @@ class Mod:
@property
def author(self) -> str | None:
# TODO: return list with authors
if self.__has_meta_json:
if "authors" in self.__meta:
authors: list[str] = self.__meta.get("authors", list[str])
return ", ".join(authors)
if "author" not in self.__config:
return None
return self.__config.get("author", str)