From 8750fd2a6cf222c34650947be39c100d9d0371b7 Mon Sep 17 00:00:00 2001 From: Uriziel Date: Fri, 25 Jan 2013 22:36:31 +0100 Subject: [PATCH] Few fixes for VLC playback --- syncplay/constants.py | 1 + syncplay/players/vlc.py | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/syncplay/constants.py b/syncplay/constants.py index d647c37..2b4b0a2 100644 --- a/syncplay/constants.py +++ b/syncplay/constants.py @@ -54,6 +54,7 @@ MPC_RETRY_WAIT_TIME = 0.01 MPC_MAX_RETRIES = 30 MPC_PAUSE_TOGGLE_DELAY = 0.05 VLC_OPEN_MAX_WAIT_TIME = 10 +VLC_SOCKET_OPEN_WAIT_TIME = 0.5 #These are not changes you're looking for MPLAYER_SLAVE_ARGS = [ '-slave', '-nomsgcolor', '-msglevel', 'all=1:global=4'] diff --git a/syncplay/players/vlc.py b/syncplay/players/vlc.py index 559f42e..b0ec261 100644 --- a/syncplay/players/vlc.py +++ b/syncplay/players/vlc.py @@ -8,6 +8,7 @@ import random import socket import asynchat, asyncore from syncplay.messages import getMessage +import time class VlcPlayer(BasePlayer): speedSupported = True @@ -106,13 +107,13 @@ class VlcPlayer(BasePlayer): self._filepath = value self._pathAsk.set() elif(name == "duration" and (value != "no-input")): - self._duration = float(value) + self._duration = float(value.replace(",", ".")) self._durationAsk.set() elif(name == "playstate"): self._paused = bool(value != 'playing') if(value != "no-input") else self._client.getGlobalPaused() self._pausedAsk.set() elif(name == "position"): - self._position = float(value) if (value != "no-input") else self._client.getGlobalPosition() + self._position = float(value.replace(",", ".")) if (value != "no-input") else self._client.getGlobalPosition() self._positionAsk.set() elif(name == "filename"): self._filename = value @@ -185,6 +186,7 @@ class VlcPlayer(BasePlayer): def run(self): self._vlcready.clear() + time.sleep(constants.VLC_SOCKET_OPEN_WAIT_TIME) self.connect(('localhost', self.__playerController.vlcport)) asyncore.loop()