aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArslaan Pathan <[email protected]>2026-10-06 13:51:24 +1300
committerArslaan Pathan <[email protected]>2026-10-06 13:51:24 +1300
commit9935b1c6a0e0845f724a9c495caf01977ee81fbb (patch)
treef419bc30316d698b703e81ca0b032b4e171510b2
parent36e061f9db1a7b99c19bcebd960e47c42616e6c3 (diff)
downloadremote-automation-9935b1c6a0e0845f724a9c495caf01977ee81fbb.tar.xz
remote-automation-9935b1c6a0e0845f724a9c495caf01977ee81fbb.zip
website deploy button
-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 2def49c..79dde40 100644
--- a/backend.py
+++ b/backend.py
@@ -183,5 +183,32 @@ def fav_song():
"artist": "Oxlo"
}
[email protected]("/automate/zola")
+def zola():
+ result = subprocess.run(
+ [
+ "sh", "-c",
+ "cd /srv/www/_src-v3 && "
+ "git pull && "
+ "~/.cargo/bin/zola build -o /srv/www/_site-v3 -f"
+ ],
+ capture_output=True,
+ text=True,
+ )
+
+ if result.returncode != 0:
+ print(result.stdout)
+ print(result.stderr)
+ return "deployment 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 50a83e2..846e9fc 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"}
+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"}
device = None
last = 0x00
@@ -39,6 +39,8 @@ def do_action(action: str):
homelab_request("volup")
elif action == "vol-":
homelab_request("voldown")
+ elif action == "web":
+ homelab_request("zola")
for path in list_devices():
candidate = InputDevice(path)