From ce2c37623a511a492238201a9b6e3afad812c523 Mon Sep 17 00:00:00 2001 From: albertosottile Date: Fri, 15 Jun 2018 11:17:35 +0200 Subject: [PATCH] Detect portable versions of MPC-HC, MPC-BE and VLC --- syncplay/players/mpc.py | 8 +++++++- syncplay/players/mpcbe.py | 8 +++++++- syncplay/players/vlc.py | 6 ++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/syncplay/players/mpc.py b/syncplay/players/mpc.py index a407147..32eda91 100755 --- a/syncplay/players/mpc.py +++ b/syncplay/players/mpc.py @@ -496,7 +496,7 @@ class MPCHCAPIPlayer(BasePlayer): @staticmethod def getExpandedPath(path): if os.path.isfile(path): - if path.lower().endswith('mpc-hc.exe'.lower()) or path.lower().endswith('mpc-hc64.exe'.lower()) or path.lower().endswith('mpc-hc64_nvo.exe'.lower()) or path.lower().endswith('mpc-hc_nvo.exe'.lower()): + if path.lower().endswith('mpc-hc.exe'.lower()) or path.lower().endswith('mpc-hcportable.exe'.lower()) or path.lower().endswith('mpc-hc64.exe'.lower()) or path.lower().endswith('mpc-hc64_nvo.exe'.lower()) or path.lower().endswith('mpc-hc_nvo.exe'.lower()): return path if os.path.isfile(path + "mpc-hc.exe"): path += "mpc-hc.exe" @@ -504,6 +504,12 @@ class MPCHCAPIPlayer(BasePlayer): if os.path.isfile(path + "\\mpc-hc.exe"): path += "\\mpc-hc.exe" return path + if os.path.isfile(path + "mpc-hcportable.exe"): + path += "mpc-hcportable.exe" + return path + if os.path.isfile(path + "\\mpc-hcportable.exe"): + path += "\\mpc-hcportable.exe" + return path if os.path.isfile(path + "mpc-hc_nvo.exe"): path += "mpc-hc_nvo.exe" return path diff --git a/syncplay/players/mpcbe.py b/syncplay/players/mpcbe.py index fcda770..1c244b3 100755 --- a/syncplay/players/mpcbe.py +++ b/syncplay/players/mpcbe.py @@ -30,7 +30,7 @@ class MpcBePlayer(MPCHCAPIPlayer): @staticmethod def getExpandedPath(path): if os.path.isfile(path): - if path.lower().endswith('mpc-be.exe'.lower()) or path.lower().endswith('mpc-be64.exe'.lower()): + if path.lower().endswith('mpc-be.exe'.lower()) or path.lower().endswith('mpc-be64.exe'.lower() or path.lower().endswith('mpc-beportable.exe'.lower())): return path if os.path.isfile(path + "mpc-be.exe"): path += "mpc-be.exe" @@ -38,6 +38,12 @@ class MpcBePlayer(MPCHCAPIPlayer): if os.path.isfile(path + "\\mpc-be.exe"): path += "\\mpc-be.exe" return path + if os.path.isfile(path + "mpc-beportable.exe"): + path += "mpc-beportable.exe" + return path + if os.path.isfile(path + "\\mpc-beportable.exe"): + path += "\\mpc-beportable.exe" + return path if os.path.isfile(path + "mpc-be64.exe"): path += "mpc-be64.exe" return path diff --git a/syncplay/players/vlc.py b/syncplay/players/vlc.py index 7651267..7908ddf 100755 --- a/syncplay/players/vlc.py +++ b/syncplay/players/vlc.py @@ -285,6 +285,12 @@ class VlcPlayer(BasePlayer): elif os.path.isfile(playerPath + "\\vlc.exe"): playerPath += "\\vlc.exe" return playerPath + elif os.path.isfile(playerPath + "VLCPortable.exe"): + playerPath += "VLCPortable.exe" + return playerPath + elif os.path.isfile(playerPath + "\\VLCPortable.exe"): + playerPath += "\\VLCPortable.exe" + return playerPath if os.access(playerPath, os.X_OK): return playerPath for path in os.environ['PATH'].split(':'):