wip: details & backend

This commit is contained in:
2024-02-23 13:11:04 +01:00
parent 13287a224b
commit 281c253476
5 changed files with 159 additions and 30 deletions

View File

@@ -1,13 +1,36 @@
import yaml
import os
class Software:
def __init__(self, directory):
self.directory = directory
self.info_file =
if os.path.isfile(directory) and directory.endswith("meta.yaml"):
directory = os.path.dirname(directory)
self.directory = directory
self._load_from_yaml()
def _load_from_yaml(self):
fullpath = os.path.join(self.directory, "meta.yaml")
self.info_file = fullpath
with open(fullpath) as f:
meta = yaml.load(f)
self.title = meta.get("title")
self.genre = meta.get("genre")
self.description = meta.get("description")
self.dependencies = meta.get("dependencies")
self.link_only = meta.get("link_only")
self.link = meta.get("link")
self.extra_files = meta.get("extra_files")
self.pictures = [os.path.join(self.directory, "pictures", p) for p in
os.listdir(os.path.join(self.directory, "pictures"))]
def get_thumbnail(self):
return self.pictures[0]
self.genre =
self.title =
self.description =
self.dependencies =
self.link_only =
self.extra_files =