summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.bumpversion.cfg2
-rw-r--r--Makefile2
-rw-r--r--kvmd/__init__.py86
-rw-r--r--kvmd/apps/__init__.py (renamed from kvmd/extras/__init__.py)0
-rw-r--r--kvmd/apps/cleanup/__init__.py (renamed from kvmd/extras/cleanup/__init__.py)0
-rw-r--r--kvmd/apps/cleanup/__main__.py (renamed from kvmd/__main__.py)0
-rw-r--r--kvmd/apps/kvmd/__init__.py81
-rw-r--r--kvmd/apps/kvmd/__main__.py (renamed from kvmd/extras/cleanup/__main__.py)0
-rw-r--r--kvmd/apps/kvmd/atx.py (renamed from kvmd/atx.py)6
-rw-r--r--kvmd/apps/kvmd/hid.py (renamed from kvmd/hid.py)6
-rw-r--r--kvmd/apps/kvmd/msd.py (renamed from kvmd/msd.py)6
-rw-r--r--kvmd/apps/kvmd/server.py (renamed from kvmd/server.py)14
-rw-r--r--kvmd/apps/kvmd/streamer.py (renamed from kvmd/streamer.py)4
-rw-r--r--kvmd/apps/wscli/__init__.py (renamed from kvmd/extras/wscli/__init__.py)0
-rw-r--r--kvmd/apps/wscli/__main__.py (renamed from kvmd/extras/wscli/__main__.py)0
-rwxr-xr-xsetup.py13
-rw-r--r--web/js/session.js2
17 files changed, 109 insertions, 113 deletions
diff --git a/.bumpversion.cfg b/.bumpversion.cfg
index 9c356ede..c147b89e 100644
--- a/.bumpversion.cfg
+++ b/.bumpversion.cfg
@@ -6,7 +6,7 @@ parse = (?P<major>\d+)\.(?P<minor>\d+)(\.(?P<patch>\d+)(\-(?P<release>[a-z]+))?)
serialize =
{major}.{minor}
-[bumpversion:file:kvmd/server.py]
+[bumpversion:file:kvmd/__init__.py]
search = __version__ = "{current_version}"
replace = __version__ = "{new_version}"
diff --git a/Makefile b/Makefile
index bb5efabc..b89481cb 100644
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,7 @@ TESTENV_CMD ?= /bin/bash -c " \
&& ln -s $(TESTENV_VIDEO) /dev/kvmd-streamer \
&& (losetup -d /dev/kvmd-msd || true) \
&& losetup /dev/kvmd-msd /root/loop.img \
- && python -m kvmd -c testenv/kvmd.conf \
+ && python -m kvmd.apps.kvmd -c testenv/kvmd.conf \
"
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"
diff --git a/kvmd/extras/__init__.py b/kvmd/apps/__init__.py
index e69de29b..e69de29b 100644
--- a/kvmd/extras/__init__.py
+++ b/kvmd/apps/__init__.py
diff --git a/kvmd/extras/cleanup/__init__.py b/kvmd/apps/cleanup/__init__.py
index 60446c2b..60446c2b 100644
--- a/kvmd/extras/cleanup/__init__.py
+++ b/kvmd/apps/cleanup/__init__.py
diff --git a/kvmd/__main__.py b/kvmd/apps/cleanup/__main__.py
index 031df43e..031df43e 100644
--- a/kvmd/__main__.py
+++ b/kvmd/apps/cleanup/__main__.py
diff --git a/kvmd/apps/kvmd/__init__.py b/kvmd/apps/kvmd/__init__.py
new file mode 100644
index 00000000..b58b6df3
--- /dev/null
+++ b/kvmd/apps/kvmd/__init__.py
@@ -0,0 +1,81 @@
+import asyncio
+
+from ...application import init
+from ...logging import get_logger
+from ...logging import Log
+
+from ... import gpio
+
+from .hid import Hid
+from .atx import Atx
+from .msd import MassStorageDevice
+from .streamer import Streamer
+from .server import Server
+
+
+# =====
+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")
diff --git a/kvmd/extras/cleanup/__main__.py b/kvmd/apps/kvmd/__main__.py
index 031df43e..031df43e 100644
--- a/kvmd/extras/cleanup/__main__.py
+++ b/kvmd/apps/kvmd/__main__.py
diff --git a/kvmd/atx.py b/kvmd/apps/kvmd/atx.py
index 9ce97386..d49708e0 100644
--- a/kvmd/atx.py
+++ b/kvmd/apps/kvmd/atx.py
@@ -2,10 +2,10 @@ import asyncio
from typing import Dict
-from .logging import get_logger
+from ...logging import get_logger
-from . import aioregion
-from . import gpio
+from ... import aioregion
+from ... import gpio
# =====
diff --git a/kvmd/hid.py b/kvmd/apps/kvmd/hid.py
index 776e6f0e..d7eb47cf 100644
--- a/kvmd/hid.py
+++ b/kvmd/apps/kvmd/hid.py
@@ -14,14 +14,14 @@ import yaml
import serial
import setproctitle
-from . import gpio
+from ...logging import get_logger
-from .logging import get_logger
+from ... import gpio
# =====
def _get_keymap() -> Dict[str, int]:
- return yaml.load(pkgutil.get_data(__name__, "data/keymap.yaml").decode()) # type: ignore
+ return yaml.load(pkgutil.get_data("kvmd", "data/keymap.yaml").decode()) # type: ignore
_KEYMAP = _get_keymap()
diff --git a/kvmd/msd.py b/kvmd/apps/kvmd/msd.py
index 575f8ffb..2cdb9050 100644
--- a/kvmd/msd.py
+++ b/kvmd/apps/kvmd/msd.py
@@ -15,10 +15,10 @@ import pyudev
import aiofiles
import aiofiles.base
-from . import aioregion
-from . import gpio
+from ...logging import get_logger
-from .logging import get_logger
+from ... import aioregion
+from ... import gpio
# =====
diff --git a/kvmd/server.py b/kvmd/apps/kvmd/server.py
index 93e74fb1..8522cb16 100644
--- a/kvmd/server.py
+++ b/kvmd/apps/kvmd/server.py
@@ -13,7 +13,12 @@ from typing import Optional
import aiohttp.web
import setproctitle
-from .aioregion import RegionIsBusyError
+from ...logging import get_logger
+from ...logging import Log
+
+from ...aioregion import RegionIsBusyError
+
+from ... import __version__
from .hid import Hid
@@ -24,13 +29,6 @@ from .msd import MassStorageDevice
from .streamer import Streamer
-from .logging import get_logger
-from .logging import Log
-
-
-# =====
-__version__ = "0.86"
-
# =====
def _system_task(method: Callable) -> Callable:
diff --git a/kvmd/streamer.py b/kvmd/apps/kvmd/streamer.py
index e9cbf0e6..bfb77d28 100644
--- a/kvmd/streamer.py
+++ b/kvmd/apps/kvmd/streamer.py
@@ -6,9 +6,9 @@ from typing import List
from typing import Dict
from typing import Optional
-from .logging import get_logger
+from ...logging import get_logger
-from . import gpio
+from ... import gpio
# =====
diff --git a/kvmd/extras/wscli/__init__.py b/kvmd/apps/wscli/__init__.py
index 19d3181b..19d3181b 100644
--- a/kvmd/extras/wscli/__init__.py
+++ b/kvmd/apps/wscli/__init__.py
diff --git a/kvmd/extras/wscli/__main__.py b/kvmd/apps/wscli/__main__.py
index 031df43e..031df43e 100644
--- a/kvmd/extras/wscli/__main__.py
+++ b/kvmd/apps/wscli/__main__.py
diff --git a/setup.py b/setup.py
index f24dbaf1..52da4195 100755
--- a/setup.py
+++ b/setup.py
@@ -21,9 +21,10 @@ def main() -> None:
packages=[
"kvmd",
- "kvmd.extras",
- "kvmd.extras.cleanup",
- "kvmd.extras.wscli",
+ "kvmd.apps",
+ "kvmd.apps.kvmd",
+ "kvmd.apps.cleanup",
+ "kvmd.apps.wscli",
],
package_data={
@@ -32,9 +33,9 @@ def main() -> None:
entry_points={
"console_scripts": [
- "kvmd = kvmd:main",
- "kvmd-cleanup = kvmd.extras.cleanup:main",
- "kvmd-wscli = kvmd.extras.wscli:main",
+ "kvmd = kvmd.apps.kvmd:main",
+ "kvmd-cleanup = kvmd.apps.cleanup:main",
+ "kvmd-wscli = kvmd.apps.wscli:main",
],
},
diff --git a/web/js/session.js b/web/js/session.js
index 97352448..e6cbc21e 100644
--- a/web/js/session.js
+++ b/web/js/session.js
@@ -21,7 +21,7 @@ function Session(atx, hid, msd) {
if (http.readyState === 4) {
if (http.status === 200) {
var info = JSON.parse(http.responseText).result;
- $("kvmd-version").innerHTML = "Web-UI " + info.version.kvmd;
+ $("kvmd-version").innerHTML = "kvmd v" + info.version.kvmd;
$("about-version-kvmd").innerHTML = info.version.kvmd;
$("about-version-streamer").innerHTML = info.version.streamer + " (" + info.streamer + ")";
} else {