From c55e668c0d068de10489d451b230fed2277e5cec Mon Sep 17 00:00:00 2001 From: Etoh Date: Thu, 14 Jun 2018 22:04:52 +0100 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 | 5 +++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/syncplay/players/mpc.py b/syncplay/players/mpc.py index 3d40308..313fbf4 100644 --- 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(u'mpc-hc.exe'.lower()) or path.lower().endswith(u'mpc-hc64.exe'.lower()) or path.lower().endswith(u'mpc-hc64_nvo.exe'.lower()) or path.lower().endswith(u'mpc-hc_nvo.exe'.lower()): + if path.lower().endswith(u'mpc-hc.exe'.lower()) or path.lower().endswith(u'mpc-hcportable.exe'.lower()) or path.lower().endswith(u'mpc-hc64.exe'.lower()) or path.lower().endswith(u'mpc-hc64_nvo.exe'.lower()) or path.lower().endswith(u'mpc-hc_nvo.exe'.lower()): return path if os.path.isfile(path + u"mpc-hc.exe"): path += u"mpc-hc.exe" @@ -504,6 +504,12 @@ class MPCHCAPIPlayer(BasePlayer): if os.path.isfile(path + u"\\mpc-hc.exe"): path += u"\\mpc-hc.exe" return path + if os.path.isfile(path + u"mpc-hcportable.exe"): + path += u"mpc-hcportable.exe" + return path + if os.path.isfile(path + u"\\mpc-hcportable.exe"): + path += u"\\mpc-hcportable.exe" + return path if os.path.isfile(path + u"mpc-hc_nvo.exe"): path += u"mpc-hc_nvo.exe" return path diff --git a/syncplay/players/mpcbe.py b/syncplay/players/mpcbe.py index 68b2074..900ace4 100644 --- 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(u'mpc-be.exe'.lower()) or path.lower().endswith(u'mpc-be64.exe'.lower()): + if path.lower().endswith(u'mpc-be.exe'.lower()) or path.lower().endswith(u'mpc-be64.exe'.lower() or path.lower().endswith(u'mpc-beportable.exe'.lower())): return path if os.path.isfile(path + u"mpc-be.exe"): path += u"mpc-be.exe" @@ -38,6 +38,12 @@ class MpcBePlayer(MPCHCAPIPlayer): if os.path.isfile(path + u"\\mpc-be.exe"): path += u"\\mpc-be.exe" return path + if os.path.isfile(path + u"mpc-beportable.exe"): + path += u"mpc-beportable.exe" + return path + if os.path.isfile(path + u"\\mpc-beportable.exe"): + path += u"\\mpc-beportable.exe" + return path if os.path.isfile(path + u"mpc-be64.exe"): path += u"mpc-be64.exe" return path diff --git a/syncplay/players/vlc.py b/syncplay/players/vlc.py index f7392ec..9a0ebbb 100755 --- a/syncplay/players/vlc.py +++ b/syncplay/players/vlc.py @@ -285,6 +285,11 @@ class VlcPlayer(BasePlayer): elif os.path.isfile(playerPath + u"\\vlc.exe"): playerPath += u"\\vlc.exe" return playerPath + elif os.path.isfile(playerPath + u"VLCPortable.exe"): + playerPath += u"VLCPortable.exe" + elif os.path.isfile(playerPath + u"\\VLCPortable.exe"): + playerPath += u"\\VLCPortable.exe" + return playerPath if os.access(playerPath, os.X_OK): return playerPath for path in os.environ['PATH'].split(':'):