Support custom player path
This commit is contained in:
parent
8aa05910eb
commit
bd937f51b4
@ -140,7 +140,7 @@ SHARED_PLAYLIST_MIN_VERSION = "1.4.0"
|
|||||||
CHAT_MIN_VERSION = "1.5.0"
|
CHAT_MIN_VERSION = "1.5.0"
|
||||||
FEATURE_LIST_MIN_VERSION = "1.5.0"
|
FEATURE_LIST_MIN_VERSION = "1.5.0"
|
||||||
|
|
||||||
IINA_PATHS = ['/Applications/IINA.app/Contents/MacOS/iina-cli']
|
IINA_PATHS = ['/Applications/IINA.app/Contents/MacOS/IINA']
|
||||||
MPC_PATHS = [
|
MPC_PATHS = [
|
||||||
r"c:\program files (x86)\mpc-hc\mpc-hc.exe",
|
r"c:\program files (x86)\mpc-hc\mpc-hc.exe",
|
||||||
r"c:\program files\mpc-hc\mpc-hc.exe",
|
r"c:\program files\mpc-hc\mpc-hc.exe",
|
||||||
|
|||||||
@ -43,18 +43,24 @@ class IinaPlayer(MpvPlayer):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def isValidPlayerPath(path):
|
def isValidPlayerPath(path):
|
||||||
if "iina-cli" in path and IinaPlayer.getExpandedPath(path):
|
if "iina-cli" in path or "iina-cli" in IinaPlayer.getExpandedPath(path):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def getExpandedPath(playerPath):
|
def getExpandedPath(playerPath):
|
||||||
|
if "iina-cli" in playerPath:
|
||||||
|
pass
|
||||||
|
elif "IINA.app/Contents/MacOS/IINA" in playerPath:
|
||||||
|
playerPath = os.path.join(os.path.dirname(playerPath), "iina-cli")
|
||||||
|
|
||||||
if os.access(playerPath, os.X_OK):
|
if os.access(playerPath, os.X_OK):
|
||||||
return playerPath
|
return playerPath
|
||||||
for path in os.environ['PATH'].split(':'):
|
for path in os.environ['PATH'].split(':'):
|
||||||
path = os.path.join(os.path.realpath(path), playerPath)
|
path = os.path.join(os.path.realpath(path), playerPath)
|
||||||
if os.access(path, os.X_OK):
|
if os.access(path, os.X_OK):
|
||||||
return path
|
return path
|
||||||
|
return playerPath
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def getIconPath(path):
|
def getIconPath(path):
|
||||||
@ -68,7 +74,7 @@ class IinaPlayer(MpvPlayer):
|
|||||||
|
|
||||||
self._playerIPCHandler = IINA
|
self._playerIPCHandler = IINA
|
||||||
self._create_listener(playerPath, filePath, args)
|
self._create_listener(playerPath, filePath, args)
|
||||||
|
|
||||||
def _preparePlayer(self):
|
def _preparePlayer(self):
|
||||||
for key, value in constants.IINA_PROPERTIES.items():
|
for key, value in constants.IINA_PROPERTIES.items():
|
||||||
self._setProperty(key, value)
|
self._setProperty(key, value)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user