From 9b0b5024908220c4d408ebc117ae62c5ba11270d Mon Sep 17 00:00:00 2001 From: soredake <5204968+soredake@users.noreply.github.com> Date: Fri, 5 Jan 2024 19:43:55 +0200 Subject: [PATCH] Add support for mpv installed from microsoft store --- 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 8bb0f1b..d1ed791 100755 --- a/syncplay/constants.py +++ b/syncplay/constants.py @@ -178,6 +178,7 @@ MPVNET_PATHS = [r"c:\program files\mpv.net\mpvnet.exe", r"c:\program Files (x86) try: import os MPVNET_PATHS.append(os.path.expandvars(r'%LOCALAPPDATA%\Microsoft\WindowsApps\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 641a1c0..cc29444 100755 --- a/syncplay/players/mpv.py +++ b/syncplay/players/mpv.py @@ -12,6 +12,7 @@ from syncplay.messages import getMessage from syncplay.players.basePlayer import BasePlayer from syncplay.utils import 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): @@ -90,11 +91,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):