don't reset player if its paused

This commit is contained in:
j 2024-04-04 23:24:56 +01:00
parent 569c72ee8b
commit 3c9f200fdd

View file

@ -51,6 +51,7 @@ class Main:
class Sync(Thread):
active = True
is_main = True
is_paused = False
ready = False
destination = "255.255.255.255"
reload_check = None
@ -158,7 +159,7 @@ class Sync(Thread):
else:
self.read_position_main()
self.reload_playlist()
if self._tick and abs(time.time() - self._tick) > 60:
if not self.is_paused and self._tick and abs(time.time() - self._tick) > 60:
logger.error("player is stuck")
self._tick = 0
self.stop()
@ -181,6 +182,7 @@ class Sync(Thread):
def s_binding(self, *args):
if args[0] != 'd-':
return
self.is_paused = True
self.mpv.pause = True
if self.sax:
self.sax.pause = True
@ -189,6 +191,7 @@ class Sync(Thread):
def p_binding(self, *args):
if args[0] != 'd-':
return
self.is_paused = False
self.mpv.pause = False
if self.sax:
self.sax.pause = False
@ -305,8 +308,10 @@ class Sync(Thread):
else:
self._last_ping = data[0]
if data[0] == "pause":
self.is_paused = True
self.mpv.pause = True
elif data[0] == "play":
self.is_paused = False
self.mpv.pause = False
else:
self.main.time_pos = float(data[0])