don't crash just skip adjustment if player is still loading

This commit is contained in:
j 2023-11-05 09:26:02 +01:00
parent 10b6c1a2d0
commit eea27c5f8c

View file

@ -142,7 +142,10 @@ class Sync(Thread):
def adjust_position(self):
if self.mpv.time_pos is not None:
deviation = self.main.time_pos - self.mpv.time_pos
try:
deviation = self.main.time_pos - self.mpv.time_pos
except:
return
self.deviations.append(deviation)
median_deviation = self.median(list(self.deviations))
frames = deviation / 0.04
@ -163,7 +166,7 @@ class Sync(Thread):
if self.main.playlist_current_pos != self.mpv.playlist_current_pos:
self.mpv.playlist_play_index(self.main.playlist_current_pos)
self.mpv.pause = False
time.sleep(0.1)
self.mpv.wait_until_playing()
self.mpv.pause = True
pos = self.main.time_pos + SYNC_JUMP_AHEAD
#print(pos, self.mpv.playlist_current_pos, self.mpv.time_pos)