mirror of
https://github.com/Syncplay/syncplay
synced 2025-02-03 04:31:36 +00:00
Refactor MPC-HC player path code (#453)
This commit is contained in:
parent
3b16b3762f
commit
d71b7fca78
@ -158,6 +158,10 @@ MPC_PATHS = [
|
|||||||
r"c:\program files (x86)\lav filters\x86\mpc-hc\shoukaku.exe",
|
r"c:\program files (x86)\lav filters\x86\mpc-hc\shoukaku.exe",
|
||||||
r"c:\program files (x86)\lav filters\x64\mpc-hc\shoukaku.exe"
|
r"c:\program files (x86)\lav filters\x64\mpc-hc\shoukaku.exe"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
MPC_EXECUTABLES = ["mpc-hc.exe", "mpc-hc64.exe", "mpc-hcportable.exe", "mpc-hc_nvo.exe", "mpc-hc64_nvo.exe", "shoukaku.exe"]
|
||||||
|
MPC64_EXECUTABLES = ["mpc-hc64.exe", "mpc-hc64_nvo.exe", "x64\mpc-hc\shoukaku.exe"]
|
||||||
|
|
||||||
MPC_BE_PATHS = [
|
MPC_BE_PATHS = [
|
||||||
r"c:\program files\mpc-be x64\mpc-be64.exe",
|
r"c:\program files\mpc-be x64\mpc-be64.exe",
|
||||||
r"c:\program files\mpc-be x64\mpc-be.exe",
|
r"c:\program files\mpc-be x64\mpc-be.exe",
|
||||||
|
@ -495,14 +495,11 @@ class MPCHCAPIPlayer(BasePlayer):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def getIconPath(path):
|
def getIconPath(path):
|
||||||
if (
|
lower_path = MPCHCAPIPlayer.getExpandedPath(path).lower()
|
||||||
MPCHCAPIPlayer.getExpandedPath(path).lower().endswith('mpc-hc64.exe'.lower()) or
|
for mpc_64_filename in constants.MPC64_EXECUTABLES:
|
||||||
MPCHCAPIPlayer.getExpandedPath(path).lower().endswith('mpc-hc64_nvo.exe'.lower()) or
|
if lower_path.endswith(mpc_64_filename):
|
||||||
MPCHCAPIPlayer.getExpandedPath(path).lower().endswith(r'x64\mpc-hc\shoukaku.exe'.lower())
|
return constants.MPC64_ICONPATH
|
||||||
):
|
return constants.MPC_ICONPATH
|
||||||
return constants.MPC64_ICONPATH
|
|
||||||
else:
|
|
||||||
return constants.MPC_ICONPATH
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def isValidPlayerPath(path):
|
def isValidPlayerPath(path):
|
||||||
@ -512,46 +509,15 @@ class MPCHCAPIPlayer(BasePlayer):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def getExpandedPath(path):
|
def getExpandedPath(path):
|
||||||
|
lower_path = path.lower()
|
||||||
if os.path.isfile(path):
|
if os.path.isfile(path):
|
||||||
if (
|
for mpc_executable_filename in constants.MPC_EXECUTABLES:
|
||||||
path.lower().endswith('mpc-hc.exe'.lower()) or path.lower().endswith('mpc-hcportable.exe'.lower()) or
|
if lower_path.endswith(mpc_executable_filename):
|
||||||
path.lower().endswith('mpc-hc64.exe'.lower()) or path.lower().endswith('mpc-hc64_nvo.exe'.lower()) or
|
return path
|
||||||
path.lower().endswith('mpc-hc_nvo.exe'.lower()) or path.lower().endswith('shoukaku.exe'.lower())
|
for mpc_executable_filename in constants.MPC_EXECUTABLES:
|
||||||
):
|
if os.path.isfile(path + mpc_executable_filename):
|
||||||
|
path += mpc_executable_filename
|
||||||
return path
|
return path
|
||||||
if os.path.isfile(path + "mpc-hc.exe"):
|
elif os.path.isfile(path + "\\" + mpc_executable_filename):
|
||||||
path += "mpc-hc.exe"
|
path += "\\" + mpc_executable_filename
|
||||||
return path
|
return path
|
||||||
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
|
|
||||||
if os.path.isfile(path + "\\mpc-hc_nvo.exe"):
|
|
||||||
path += "\\mpc-hc_nvo.exe"
|
|
||||||
return path
|
|
||||||
if os.path.isfile(path + "mpc-hc64.exe"):
|
|
||||||
path += "mpc-hc64.exe"
|
|
||||||
return path
|
|
||||||
if os.path.isfile(path + "\\mpc-hc64.exe"):
|
|
||||||
path += "\\mpc-hc64.exe"
|
|
||||||
return path
|
|
||||||
if os.path.isfile(path + "mpc-hc64_nvo.exe"):
|
|
||||||
path += "mpc-hc64_nvo.exe"
|
|
||||||
return path
|
|
||||||
if os.path.isfile(path + "\\mpc-hc64_nvo.exe"):
|
|
||||||
path += "\\mpc-hc64_nvo.exe"
|
|
||||||
return path
|
|
||||||
if os.path.isfile(path + "shoukaku.exe"):
|
|
||||||
path += "shoukaku.exe"
|
|
||||||
return path
|
|
||||||
if os.path.isfile(path + "\\shoukaku.exe"):
|
|
||||||
path += "\\shoukaku.exe"
|
|
||||||
return path
|
|
Loading…
Reference in New Issue
Block a user