aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend.py27
-rw-r--r--main.py4
2 files changed, 30 insertions, 1 deletions
diff --git a/backend.py b/backend.py
index 79dde40..b0d9588 100644
--- a/backend.py
+++ b/backend.py
@@ -210,5 +210,32 @@ def zola():
return "ok"
[email protected]("/automate/cgit")
+def cgit():
+ result = subprocess.run(
+ [
+ "sh", "-c",
+ "cd /srv/docker/cgit && "
+ "docker compose down && "
+ "docker compose up -d"
+ ],
+ capture_output=True,
+ text=True,
+ )
+
+ if result.returncode != 0:
+ print(result.stdout)
+ print(result.stderr)
+ return "cgit restart failed", 500
+
+ subprocess.Popen([
+ "mpv",
+ "--no-video",
+ "--audio-device=pipewire",
+ "/srv/shares/public/Media/done.mp3",
+ ])
+
+ return "ok"
+
if __name__ == "__main__":
app.run(host="0.0.0.0", port=6732)
diff --git a/main.py b/main.py
index 846e9fc..c84115f 100644
--- a/main.py
+++ b/main.py
@@ -2,7 +2,7 @@ from evdev import InputDevice, list_devices, ecodes
from urllib.request import urlopen
from urllib.error import HTTPError, URLError
-SCANCODES = {0x11A: "up", 0x148: "down", 0x147: "left", 0x107: "right", 0x106: "ok", 0x141: "play/pause", 0x11c: "power", 0x103: "vol+", 0x142: "vol-", 0x101: "app", 0x154: "1", 0x110: "stop", 0x14b: "skip", 0x155: "epg", 0x119: "web"}
+SCANCODES = {0x11A: "up", 0x148: "down", 0x147: "left", 0x107: "right", 0x106: "ok", 0x141: "play/pause", 0x11c: "power", 0x103: "vol+", 0x142: "vol-", 0x101: "app", 0x154: "1", 0x110: "stop", 0x14b: "skip", 0x155: "epg", 0x119: "web", 0x15f: "setting"}
device = None
last = 0x00
@@ -41,6 +41,8 @@ def do_action(action: str):
homelab_request("voldown")
elif action == "web":
homelab_request("zola")
+ elif action = "setting":
+ homelab_request("cgit")
for path in list_devices():
candidate = InputDevice(path)