blah
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import gi
|
import gi
|
||||||
import signal
|
import signal # for signal.SIGUSR1 constant
|
||||||
import struct
|
import struct
|
||||||
import os
|
import os
|
||||||
|
|
||||||
@@ -131,7 +131,8 @@ def play_kiosk():
|
|||||||
pipeline.set_property("uri", manager.videos[0])
|
pipeline.set_property("uri", manager.videos[0])
|
||||||
|
|
||||||
# SIGUSR1 → switch video (used by device_server PUT /display {"state":"on"})
|
# SIGUSR1 → switch video (used by device_server PUT /display {"state":"on"})
|
||||||
signal.signal(signal.SIGUSR1, lambda sig, frame: manager.switch_video())
|
GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGUSR1,
|
||||||
|
lambda: manager.switch_video() or True)
|
||||||
|
|
||||||
# --- INPUT MONITORING ---
|
# --- INPUT MONITORING ---
|
||||||
try:
|
try:
|
||||||
@@ -151,13 +152,16 @@ def play_kiosk():
|
|||||||
|
|
||||||
def on_message(bus, msg, manager_instance):
|
def on_message(bus, msg, manager_instance):
|
||||||
if msg.type == Gst.MessageType.EOS:
|
if msg.type == Gst.MessageType.EOS:
|
||||||
# Video ended. cycle LED and loop back to start
|
|
||||||
manager_instance.change_led_colour()
|
manager_instance.change_led_colour()
|
||||||
pipeline.seek_simple(Gst.Format.TIME, Gst.SeekFlags.FLUSH | Gst.SeekFlags.KEY_UNIT, 0)
|
pipeline.seek_simple(Gst.Format.TIME, Gst.SeekFlags.FLUSH | Gst.SeekFlags.KEY_UNIT, 0)
|
||||||
elif msg.type == Gst.MessageType.ERROR:
|
elif msg.type == Gst.MessageType.ERROR:
|
||||||
err, debug = msg.parse_error()
|
err, debug = msg.parse_error()
|
||||||
print(f"GStreamer Error: {err}")
|
print(f"GStreamer Error: {err}\nDebug: {debug}", flush=True)
|
||||||
loop.quit
|
loop.quit()
|
||||||
|
elif msg.type == Gst.MessageType.STATE_CHANGED:
|
||||||
|
if msg.src == pipeline:
|
||||||
|
old, new, _ = msg.parse_state_changed()
|
||||||
|
print(f"Pipeline: {old.value_nick} -> {new.value_nick}", flush=True)
|
||||||
|
|
||||||
bus.connect("message", on_message, manager)
|
bus.connect("message", on_message, manager)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user