set timeout
This commit is contained in:
parent
67b67d87fa
commit
7e4c062a13
1 changed files with 13 additions and 9 deletions
|
@ -95,7 +95,6 @@ class Sync(Thread):
|
|||
self.adjust_position()
|
||||
if self._pos != self.mpv.playlist_current_pos:
|
||||
self._pos = self.mpv.playlist_current_pos
|
||||
if self._pos != -1:
|
||||
try:
|
||||
track = self.mpv.playlist[self._pos]
|
||||
logger.error("%s %s", datetime.now(), track["filename"])
|
||||
|
@ -146,7 +145,12 @@ class Sync(Thread):
|
|||
#
|
||||
|
||||
def read_position_main(self):
|
||||
self.sock.settimeout(5)
|
||||
try:
|
||||
data = self.sock.recvfrom(1024)[0].decode().split(" ", 1)
|
||||
except socket.timeout:
|
||||
logger.error("failed to receive data from main")
|
||||
else:
|
||||
self.main.time_pos = float(data[0])
|
||||
self.main.playlist_current_pos = int(data[1])
|
||||
|
||||
|
|
Loading…
Reference in a new issue