Mod: read name, description and authors from json if available
This commit is contained in:
parent
4d22e68a9b
commit
902227a8bd
1 changed files with 11 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue