commit
52067c497f
@ -1,4 +1,4 @@
|
||||
version = '1.5.0'
|
||||
milestone = 'Yoitsu'
|
||||
release_number = '37'
|
||||
release_number = '39'
|
||||
projectURL = 'http://syncplay.pl/'
|
||||
|
||||
@ -54,7 +54,6 @@ DO_NOT_RESET_POSITION_THRESHOLD = 1.0
|
||||
SYNC_ON_PAUSE = True # Client seek to global position - subtitles may disappear on some media players
|
||||
PLAYLIST_MAX_CHARACTERS = 10000
|
||||
PLAYLIST_MAX_ITEMS = 250
|
||||
VLC_LISTEN_FOR_STDOUT = False # Changing to True this could break VLC 3 on Windows
|
||||
|
||||
# Maximum character lengths (for client and server)
|
||||
MAX_CHAT_MESSAGE_LENGTH = 50 # Number of displayed characters
|
||||
@ -139,7 +138,7 @@ MPV_SENDMESSAGE_COOLDOWN_TIME = 0.05
|
||||
MPV_MAX_NEWFILE_COOLDOWN_TIME = 3
|
||||
STREAM_ADDITIONAL_IGNORE_TIME = 10
|
||||
MPV_LOCK_WAIT_TIME = 0.05
|
||||
VLC_OPEN_MAX_WAIT_TIME = 15
|
||||
VLC_OPEN_MAX_WAIT_TIME = 20
|
||||
VLC_MIN_PORT = 10000
|
||||
VLC_MAX_PORT = 55000
|
||||
|
||||
|
||||
@ -302,6 +302,7 @@ class VlcPlayer(BasePlayer):
|
||||
self.requestedVLCVersion = False
|
||||
self.vlcHasResponded = False
|
||||
self.oldIntfVersion = None
|
||||
self.timeVLCLaunched = None
|
||||
call = [playerPath]
|
||||
if filePath:
|
||||
if utils.isASCII(filePath):
|
||||
@ -362,9 +363,11 @@ class VlcPlayer(BasePlayer):
|
||||
|
||||
else:
|
||||
self.__process = subprocess.Popen(call, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||
if constants.VLC_LISTEN_FOR_STDOUT:
|
||||
self.timeVLCLaunched = time.time()
|
||||
if self._shouldListenForSTDOUT():
|
||||
for line in iter(self.__process.stderr.readline, ''):
|
||||
self.vlcHasResponded = True
|
||||
self.timeVLCLaunched = None
|
||||
if "[syncplay]" in line:
|
||||
if "Listening on host" in line:
|
||||
break
|
||||
@ -386,6 +389,12 @@ class VlcPlayer(BasePlayer):
|
||||
self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
self._sendingData = threading.Lock()
|
||||
|
||||
def _shouldListenForSTDOUT(self):
|
||||
if sys.platform.startswith('win'):
|
||||
return False # Due to VLC3 not using STDOUT/STDERR
|
||||
else:
|
||||
return True
|
||||
|
||||
def initiate_send(self):
|
||||
with self._sendingData:
|
||||
asynchat.async_chat.initiate_send(self)
|
||||
@ -398,15 +407,24 @@ class VlcPlayer(BasePlayer):
|
||||
def handle_connect(self):
|
||||
asynchat.async_chat.handle_connect(self)
|
||||
self._vlcready.set()
|
||||
self.timeVLCLaunched = None
|
||||
|
||||
def collect_incoming_data(self, data):
|
||||
self._ibuffer.append(data)
|
||||
|
||||
def handle_close(self):
|
||||
asynchat.async_chat.handle_close(self)
|
||||
if self.vlcHasResponded:
|
||||
if self.timeVLCLaunched and time.time() - self.timeVLCLaunched < constants.VLC_OPEN_MAX_WAIT_TIME:
|
||||
try:
|
||||
self.__playerController._client.ui.showDebugMessage("Failed to connect to VLC, but reconnecting as within max wait time")
|
||||
except:
|
||||
pass
|
||||
self.run()
|
||||
elif self.vlcHasResponded:
|
||||
asynchat.async_chat.handle_close(self)
|
||||
self.__playerController.drop()
|
||||
else:
|
||||
self.vlcHasResponded = True
|
||||
asynchat.async_chat.handle_close(self)
|
||||
self.__playerController.drop(getMessage("vlc-failed-connection").format(constants.VLC_MIN_VERSION))
|
||||
|
||||
def found_terminator(self):
|
||||
@ -421,8 +439,15 @@ class VlcPlayer(BasePlayer):
|
||||
self.sendLine("get-vlc-version")
|
||||
try:
|
||||
self.push(line + "\n")
|
||||
self.__playerController._client.ui.showDebugMessage("player >> {}".format(line))
|
||||
if self.__playerController._client and self.__playerController._client.ui:
|
||||
self.__playerController._client.ui.showDebugMessage("player >> {}".format(line))
|
||||
except:
|
||||
pass
|
||||
if line == "close-vlc":
|
||||
self._vlcclosed.set()
|
||||
if not self.connected and not self.timeVLCLaunched:
|
||||
# For circumstances where Syncplay is not connected to VLC and is not reconnecting
|
||||
try:
|
||||
self.__process.terminate()
|
||||
except: # When VLC is already closed
|
||||
pass
|
||||
Loading…
x
Reference in New Issue
Block a user