diff options
author | Devaev Maxim <[email protected]> | 2018-11-06 01:55:13 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2018-11-06 01:55:13 +0300 |
commit | f0ae427d8e4bbd82653abdb8e2aef8ffe32fc732 (patch) | |
tree | 44192d6bce4cc80db95532df2888e0764f63d58d /kvmd/__init__.py | |
parent | 1ac968e92411409413ed4555eed6c2944b38de0d (diff) |
refactoring
Diffstat (limited to 'kvmd/__init__.py')
-rw-r--r-- | kvmd/__init__.py | 86 |
1 files changed, 1 insertions, 85 deletions
diff --git a/kvmd/__init__.py b/kvmd/__init__.py index 5f308bba..84885136 100644 --- a/kvmd/__init__.py +++ b/kvmd/__init__.py @@ -1,85 +1 @@ -import asyncio - -from .application import init -from .logging import get_logger -from .logging import Log - -from .hid import Hid -from .atx import Atx -from .msd import MassStorageDevice -from .streamer import Streamer -from .server import Server - -from . import gpio - - -# ===== -from .server import __version__ # noqa: F401 - - -# ===== -def main() -> None: - config = init() - with gpio.bcm(): - loop = asyncio.get_event_loop() - - log = Log( - services=list(config["log"]["services"]), - loop=loop, - ) - - hid = Hid( - reset=int(config["hid"]["pinout"]["reset"]), - device_path=str(config["hid"]["device"]), - speed=int(config["hid"]["speed"]), - reset_delay=float(config["hid"]["reset_delay"]), - ) - - atx = Atx( - power_led=int(config["atx"]["pinout"]["power_led"]), - hdd_led=int(config["atx"]["pinout"]["hdd_led"]), - power_switch=int(config["atx"]["pinout"]["power_switch"]), - reset_switch=int(config["atx"]["pinout"]["reset_switch"]), - click_delay=float(config["atx"]["click_delay"]), - long_click_delay=float(config["atx"]["long_click_delay"]), - ) - - msd = MassStorageDevice( - target=int(config["msd"]["pinout"]["target"]), - reset=int(config["msd"]["pinout"]["reset"]), - device_path=str(config["msd"]["device"]), - init_delay=float(config["msd"]["init_delay"]), - reset_delay=float(config["msd"]["reset_delay"]), - write_meta=bool(config["msd"]["write_meta"]), - loop=loop, - ) - - streamer = Streamer( - cap_power=int(config["streamer"]["pinout"]["cap"]), - conv_power=int(config["streamer"]["pinout"]["conv"]), - sync_delay=float(config["streamer"]["sync_delay"]), - init_delay=float(config["streamer"]["init_delay"]), - init_restart_after=float(config["streamer"]["init_restart_after"]), - quality=int(config["streamer"]["quality"]), - soft_fps=int(config["streamer"]["soft_fps"]), - cmd=list(map(str, config["streamer"]["cmd"])), - loop=loop, - ) - - Server( - log=log, - hid=hid, - atx=atx, - msd=msd, - streamer=streamer, - heartbeat=float(config["server"]["heartbeat"]), - atx_state_poll=float(config["atx"]["state_poll"]), - streamer_shutdown_delay=float(config["streamer"]["shutdown_delay"]), - msd_chunk_size=int(config["msd"]["chunk_size"]), - loop=loop, - ).run( - host=str(config["server"]["host"]), - port=int(config["server"]["port"]), - ) - - get_logger().info("Bye-bye") +__version__ = "0.86" |