Wait for STDOUT in VLC for non-Windows systems (to resolve#125 reported by blaenk)

This commit is contained in:
Et0h 2016-12-30 13:41:09 +00:00
parent 8f3c855d44
commit fde8c05117
2 changed files with 7 additions and 2 deletions

View File

@ -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
# Options for the File Switch feature:
FOLDER_SEARCH_FIRST_FILE_TIMEOUT = 15.0 # Secs - How long to wait to find the first file in folder search (to take account of HDD spin up)

View File

@ -362,7 +362,7 @@ class VlcPlayer(BasePlayer):
else:
self.__process = subprocess.Popen(call, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
if constants.VLC_LISTEN_FOR_STDOUT:
if self._shouldListenForSTDOUT():
for line in iter(self.__process.stderr.readline, ''):
self.vlcHasResponded = True
if "[syncplay]" in line:
@ -386,6 +386,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)