From 902227a8bd36a783675c8a84fcc2708621b02668 Mon Sep 17 00:00:00 2001 From: Toast Date: Thu, 29 May 2025 18:50:01 +0200 Subject: [PATCH] Mod: read name, description and authors from json if available --- src/leek/mod.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/leek/mod.py b/src/leek/mod.py index 84d0ddc..bbe2cab 100644 --- a/src/leek/mod.py +++ b/src/leek/mod.py @@ -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)