sync group

This commit is contained in:
j 2024-09-10 12:42:16 +01:00
parent 9021131e8d
commit e221626191

View file

@ -28,7 +28,8 @@ CONFIG = {
"sub_border_color": "0.0/0.0/0.0/0.75", "sub_border_color": "0.0/0.0/0.0/0.75",
"sub_margin": 2 * 36 + 6, "sub_margin": 2 * 36 + 6,
"sub_spacing": 0, "sub_spacing": 0,
"vf": None "vf": None,
"sync_group": None,
} }
@ -277,6 +278,8 @@ class Sync(Thread):
"%0.4f %s" "%0.4f %s"
% (self.mpv.time_pos, self.mpv.playlist_current_pos) % (self.mpv.time_pos, self.mpv.playlist_current_pos)
).encode() ).encode()
if CONFIG.get("sync_group"):
msg = (b"%s " % CONFIG["sync_group"]) + msg
except: except:
return return
try: try:
@ -307,6 +310,11 @@ class Sync(Thread):
except OSError: except OSError:
logger.error("socket closed") logger.error("socket closed")
else: else:
if CONFIG.get("sync_group"):
if data[0] != str(CONFIG["sync_group"]):
return self.read_position_main()
else:
data = data[1:]
self._last_ping = data[0] self._last_ping = data[0]
if data[0] == "pause": if data[0] == "pause":
self.is_paused = True self.is_paused = True