don't crash just skip adjustment if player is still loading
This commit is contained in:
parent
10b6c1a2d0
commit
eea27c5f8c
1 changed files with 5 additions and 2 deletions
|
@ -142,7 +142,10 @@ class Sync(Thread):
|
||||||
|
|
||||||
def adjust_position(self):
|
def adjust_position(self):
|
||||||
if self.mpv.time_pos is not None:
|
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)
|
self.deviations.append(deviation)
|
||||||
median_deviation = self.median(list(self.deviations))
|
median_deviation = self.median(list(self.deviations))
|
||||||
frames = deviation / 0.04
|
frames = deviation / 0.04
|
||||||
|
@ -163,7 +166,7 @@ class Sync(Thread):
|
||||||
if self.main.playlist_current_pos != self.mpv.playlist_current_pos:
|
if self.main.playlist_current_pos != self.mpv.playlist_current_pos:
|
||||||
self.mpv.playlist_play_index(self.main.playlist_current_pos)
|
self.mpv.playlist_play_index(self.main.playlist_current_pos)
|
||||||
self.mpv.pause = False
|
self.mpv.pause = False
|
||||||
time.sleep(0.1)
|
self.mpv.wait_until_playing()
|
||||||
self.mpv.pause = True
|
self.mpv.pause = True
|
||||||
pos = self.main.time_pos + SYNC_JUMP_AHEAD
|
pos = self.main.time_pos + SYNC_JUMP_AHEAD
|
||||||
#print(pos, self.mpv.playlist_current_pos, self.mpv.time_pos)
|
#print(pos, self.mpv.playlist_current_pos, self.mpv.time_pos)
|
||||||
|
|
Loading…
Reference in a new issue