mirror of
https://github.com/FAUSheppy/homelab_gamevault
synced 2025-12-06 06:51:36 +01:00
wip: details & backend
This commit is contained in:
39
software.py
39
software.py
@@ -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 =
|
||||
|
||||
Reference in New Issue
Block a user