commit
9466196ea3
1 changed files with 22 additions and 15 deletions
35
src/main.py
35
src/main.py
|
|
@ -2,7 +2,7 @@
|
||||||
import json
|
import json
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from time import sleep
|
from time import sleep, time
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
import dateutil.parser
|
import dateutil.parser
|
||||||
|
|
@ -98,20 +98,27 @@ def main():
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
windows = list(
|
start_time = time()
|
||||||
filter(lambda x: x, [w.window_text() for w in desktop.windows()])
|
windows = []
|
||||||
)
|
for window in desktop.windows():
|
||||||
|
try:
|
||||||
|
txt = window.window_text()
|
||||||
|
if txt:
|
||||||
|
windows.append(txt)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
huddle_windows = list(filter(lambda x: "Huddle with" in x, windows))
|
proc_time = time() - start_time
|
||||||
|
huddle_windows = list(filter(lambda x: "Huddle" in x, windows))
|
||||||
|
|
||||||
if "Zoom Meeting" in windows:
|
if "Zoom Meeting" in windows:
|
||||||
showing_sploon = False
|
showing_sploon = False
|
||||||
pixlet.display(rel_to_abspath("../zoom/meeting.webp"))
|
pixlet.display(rel_to_abspath("../zoom/meeting.webp"), installation_id="status")
|
||||||
sleep(rotation_time)
|
sleep(max(0, rotation_time-proc_time))
|
||||||
if huddle_windows:
|
if huddle_windows:
|
||||||
showing_sploon = False
|
showing_sploon = False
|
||||||
pixlet.display(rel_to_abspath("../slack/huddle.webp"))
|
pixlet.display(rel_to_abspath("../slack/huddle.webp"), installation_id="status")
|
||||||
sleep(rotation_time)
|
sleep(max(0, rotation_time-proc_time))
|
||||||
elif "obs64" in windows:
|
elif "obs64" in windows:
|
||||||
showing_sploon = False
|
showing_sploon = False
|
||||||
with open(
|
with open(
|
||||||
|
|
@ -119,12 +126,12 @@ def main():
|
||||||
) as file_handle:
|
) as file_handle:
|
||||||
data = json.loads(file_handle.read())
|
data = json.loads(file_handle.read())
|
||||||
if data["STREAMING"]:
|
if data["STREAMING"]:
|
||||||
pixlet.display(rel_to_abspath("../streaming/active.webp"))
|
pixlet.display(rel_to_abspath("../streaming/active.webp"), installation_id="status")
|
||||||
elif data["RECORDING"]:
|
elif data["RECORDING"]:
|
||||||
pixlet.display(rel_to_abspath("../recording/active.webp"))
|
pixlet.display(rel_to_abspath("../recording/active.webp"), installation_id="status")
|
||||||
else:
|
else:
|
||||||
pixlet.display(rel_to_abspath("../recording/paused.webp"))
|
pixlet.display(rel_to_abspath("../recording/paused.webp"), installation_id="status")
|
||||||
sleep(rotation_time)
|
sleep(max(0, rotation_time-proc_time))
|
||||||
else:
|
else:
|
||||||
# Only re-render a .star file if the cache should have expired or we hadn't rendered one yet
|
# Only re-render a .star file if the cache should have expired or we hadn't rendered one yet
|
||||||
if not showing_sploon or (
|
if not showing_sploon or (
|
||||||
|
|
@ -146,7 +153,7 @@ def main():
|
||||||
pixlet.render(render_file)
|
pixlet.render(render_file)
|
||||||
pixlet.display(
|
pixlet.display(
|
||||||
render_file.replace(".star", ".webp"),
|
render_file.replace(".star", ".webp"),
|
||||||
installation_id="SalmonRun",
|
installation_id="status",
|
||||||
)
|
)
|
||||||
showing_sploon = True
|
showing_sploon = True
|
||||||
sleep(5)
|
sleep(5)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue