def on_message(_: Gst.Bus, message: Gst.Message, loop: GObject.MainLoop): message_type = message.type if message_type == Gst.MessageType.EOS: print("End of stream") loop.quit() elif message_type == Gst.MessageType.ERROR: err, debug = message.parse_error() print(err, debug) loop.quit() return True
def on_message(bus: Gst.Bus, message: Gst.Message, loop: GObject.MainLoop): mtype = message.type """ Gstreamer Message Types and how to parse https://lazka.github.io/pgi-docs/Gst-1.0/flags.html#Gst.MessageType """ if mtype == Gst.MessageType.EOS: print("End of stream") loop.quit() elif mtype == Gst.MessageType.ERROR: err, debug = message.parse_error() print(err, debug) loop.quit() elif mtype == Gst.MessageType.WARNING: err, debug = message.parse_warning() print(err, debug) return True
except dbus.exceptions.NameExistsException: # print("service is already running") logging.info("service is already running") sys.exit(1) # Run the loop try: loop.run() except KeyboardInterrupt: # print("keyboard interrupt received") logging.info("keyboard interrupt received") except Exception as e: # print("Unexpected exception occurred: '{}'".format(str(e))) logging.info("Unexpected exception occurred: %s", str(e)) finally: loop.quit() # dbus.set_default_main_loop(dbus.mainloop.NativeMainLoop()) # from dbus.mainloop import NativeMainLoop # n = notify2.Notification("Heading","Body with all the details") # def click_callback(a,b,c): # print(a) # print(b) # print(c) # n = notify2.Notification('None','None') # n.show() # # print("asd") # n.add_action("p", "Send anyways",click_callback,"User clicked ") # # n.add_action("", "Send anyways",click_callback,"User clicked ") # # n.connect("closed",print_callback)