jellyfin-mpv-shim/jellyfin_mpv_shim/action_thread.py
2023-02-17 17:23:26 -05:00

31 lines
660 B
Python

import threading
from .player import playerManager
class ActionThread(threading.Thread):
def __init__(self):
self.trigger = threading.Event()
self.halt = False
threading.Thread.__init__(self)
def stop(self):
self.halt = True
self.trigger.set()
self.join()
def run(self):
force_next = False
while not self.halt:
if playerManager.is_active() or force_next:
playerManager.update()
force_next = False
if self.trigger.wait(1):
force_next = True
self.trigger.clear()
actionThread = ActionThread()