From feff5026b15e911153dc595f10ea34f6cf23ad96 Mon Sep 17 00:00:00 2001 From: soredake <5204968+soredake@users.noreply.github.com> Date: Mon, 29 Apr 2024 21:13:54 +0300 Subject: [PATCH] Add support for mpv installed from microsoft store (#662) Co-authored-by: Etoh --- syncplay/constants.py | 1 + syncplay/players/mpv.py | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/syncplay/constants.py b/syncplay/constants.py index a6f198f..03a03f0 100755 --- a/syncplay/constants.py +++ b/syncplay/constants.py @@ -180,6 +180,7 @@ try: import os MPVNET_PATHS.append(os.path.expandvars(r'%LOCALAPPDATA%\Microsoft\WindowsApps\mpvnet.exe')) MPVNET_PATHS.append(os.path.expandvars(r'%LOCALAPPDATA%\Programs\mpv.net\mpvnet.exe')) + MPV_PATHS.append(os.path.expandvars(r'%LOCALAPPDATA%\Microsoft\WindowsApps\mpv.exe')) except: pass VLC_PATHS = [ diff --git a/syncplay/players/mpv.py b/syncplay/players/mpv.py index cf9e745..0453a12 100755 --- a/syncplay/players/mpv.py +++ b/syncplay/players/mpv.py @@ -13,6 +13,7 @@ from syncplay.messages import getMessage from syncplay.players.basePlayer import BasePlayer from syncplay.utils import getRuntimeDir, isURL, findResourcePath from syncplay.utils import isMacOS, isWindows, isASCII +from syncplay.utils import playerPathExists from syncplay.vendor.python_mpv_jsonipc.python_mpv_jsonipc import MPV class MpvPlayer(BasePlayer): @@ -91,11 +92,11 @@ class MpvPlayer(BasePlayer): @staticmethod def getExpandedPath(playerPath): - if not os.path.isfile(playerPath): - if os.path.isfile(playerPath + "mpv.exe"): + if not playerPathExists(playerPath): + if playerPathExists(playerPath + "mpv.exe"): playerPath += "mpv.exe" return playerPath - elif os.path.isfile(playerPath + "\\mpv.exe"): + elif playerPathExists(playerPath + "\\mpv.exe"): playerPath += "\\mpv.exe" return playerPath if os.access(playerPath, os.X_OK):