wip: various details

This commit is contained in:
Yannik Schmidt
2024-02-24 19:06:56 +01:00
parent 281c253476
commit d9d63bfe01
5 changed files with 61 additions and 22 deletions

View File

@@ -1,22 +1,24 @@
import yaml
import os
import localaction
class Software:
def __init__(self, directory):
def __init__(self, directory, backend):
if os.path.isfile(directory) and directory.endswith("meta.yaml"):
directory = os.path.dirname(directory)
self.directory = directory
self._load_from_yaml()
self.backend = backend
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)
meta = yaml.safe_load(f)
self.title = meta.get("title")
self.genre = meta.get("genre")
@@ -32,5 +34,23 @@ class Software:
def get_thumbnail(self):
return self.pictures[0]
def _extract_to_target(self, cache_src, target):
'''Extract a cached, downloaded zip to the target location'''
def install(self):
'''Install this software from the backend'''
local_file = self.backend.get_exe_or_data():
if local_file.endswith(".exe"):
localaction.run_exe(local_file)
elif local_file.endswith(".zip"):
_extract_to_target(INSTALL_DIR)
# download registry
# install registry
# TODO dependencies #
# download gamefiles
# install gamefiles