From 9d28822731f019c95c24791cdb28e673e12a022b Mon Sep 17 00:00:00 2001 From: Et0h Date: Sat, 24 Oct 2015 00:04:04 +0100 Subject: [PATCH] Hopefully fix VLC playlist file loading issues --- resources/lua/intf/syncplay.lua | 8 +++++--- syncplay/constants.py | 2 +- syncplay/players/vlc.py | 4 ++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/resources/lua/intf/syncplay.lua b/resources/lua/intf/syncplay.lua index 2cbeee0..6725cb1 100644 --- a/resources/lua/intf/syncplay.lua +++ b/resources/lua/intf/syncplay.lua @@ -5,7 +5,7 @@ Principal author: Etoh Other contributors: DerGenaue, jb Project: http://syncplay.pl/ - Version: 0.2.8 + Version: 0.2.9 Note: * This interface module is intended to be used in conjunction with Syncplay. @@ -84,7 +84,7 @@ You may also need to re-copy the syncplay.lua file when you update VLC. --]==========================================================================] -local connectorversion = "0.2.8" +local connectorversion = "0.2.9" local vlcversion = vlc.misc.version() local durationdelay = 500000 -- Pause for get_duration command etc for increased reliability (uses microseconds) local loopsleepduration = 2500 -- Pause for every event loop (uses microseconds) @@ -463,7 +463,9 @@ function load_file (filepath) -- [Used by load-file command] local uri = vlc.strings.make_uri(filepath) - vlc.playlist.add({{path=uri}}) + vlc.playlist.clear() + vlc.playlist.enqueue({{path=uri}}) + vlc.playlist.next() return "load-file-attempted\n" end diff --git a/syncplay/constants.py b/syncplay/constants.py index 8a403c5..c6c2414 100644 --- a/syncplay/constants.py +++ b/syncplay/constants.py @@ -69,7 +69,7 @@ COMMANDS_AUTH = ['a','auth'] COMMANDS_TOGGLE = ['t','toggle'] MPC_MIN_VER = "1.6.4" VLC_MIN_VERSION = "2.2.1" -VLC_INTERFACE_MIN_VERSION = "0.2.8" +VLC_INTERFACE_MIN_VERSION = "0.2.9" VLC_LATENCY_ERROR_THRESHOLD = 2.0 MPV_UNRESPONSIVE_THRESHOLD = 60.0 CONTROLLED_ROOMS_MIN_VERSION = "1.3.0" diff --git a/syncplay/players/vlc.py b/syncplay/players/vlc.py index 331fcbf..fb62b33 100644 --- a/syncplay/players/vlc.py +++ b/syncplay/players/vlc.py @@ -141,6 +141,10 @@ class VlcPlayer(BasePlayer): return fileURL def openFile(self, filePath, resetPosition=False): + if not utils.isURL(filePath): + normedPath = os.path.normpath(filePath) + if os.path.isfile(normedPath): + filePath = normedPath if utils.isASCII(filePath): self._listener.sendLine('load-file: {}'.format(filePath.encode('ascii', 'ignore'))) else: