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