Refactor examples; Start to load examples into benchmark; vlc initialization

This commit is contained in:
Timothyxxx
2023-12-25 00:24:13 +08:00
parent 4782b687b9
commit 236fcb0938
16 changed files with 56 additions and 52 deletions

View File

@@ -4,6 +4,7 @@ import json
from typing import Dict, List
from typing import Any
class SetupController:
def __init__(self, http_server: str):
self.http_server = http_server + "/setup"
@@ -31,10 +32,10 @@ class SetupController:
assert hasattr(self, setup_function)
getattr(self, setup_function)(**parameters)
#self._download_setup(config)
#self._change_wallpaper(config)
# self._download_setup(config)
# self._change_wallpaper(config)
# self._tidy_desktop(config) todo: implement this
#self._open_setup(config)
# self._open_setup(config)
# can add other setup steps
def _download_setup(self, files: List[Dict[str, str]]):
@@ -47,11 +48,11 @@ class SetupController:
}
"""
#if not config:
#return
#if not 'download' in config:
#return
#for url, path in config['download']:
# if not config:
# return
# if not 'download' in config:
# return
# for url, path in config['download']:
for f in files:
url: str = f["url"]
path: str = f["path"]
@@ -75,12 +76,12 @@ class SetupController:
print("An error occurred while trying to send the request:", e)
def _change_wallpaper_setup(self, path: str):
#if not config:
#return
#if not 'wallpaper' in config:
#return
# if not config:
# return
# if not 'wallpaper' in config:
# return
#path = config['wallpaper']
# path = config['wallpaper']
if not path:
raise Exception(f"Setup Wallpaper - Invalid path ({path}).")
@@ -103,11 +104,11 @@ class SetupController:
raise NotImplementedError
def _open_setup(self, path: str):
#if not config:
#return
#if not 'open' in config:
#return
#for path in config['open']:
# if not config:
# return
# if not 'open' in config:
# return
# for path in config['open']:
if not path:
raise Exception(f"Setup Open - Invalid path ({path}).")