mirror of https://github.com/Syncplay/syncplay
Add Windows Store mpv.net path support (#494)
This commit is contained in:
parent
b760ee662a
commit
bed4986979
|
@ -173,8 +173,12 @@ MPLAYER_PATHS = ["mplayer2", "mplayer"]
|
|||
MPV_PATHS = ["mpv", "/opt/mpv/mpv", r"c:\program files\mpv\mpv.exe", r"c:\program files\mpv-player\mpv.exe",
|
||||
r"c:\program Files (x86)\mpv\mpv.exe", r"c:\program Files (x86)\mpv-player\mpv.exe",
|
||||
"/Applications/mpv.app/Contents/MacOS/mpv"]
|
||||
MPVNET_PATHS = [r"c:\program files\mpv.net\mpvnet.exe", r"c:\program files\mpv.net\mpvnet.exe",
|
||||
r"c:\program Files (x86)\mpv.net\mpvnet.exe", r"c:\program Files (x86)\mpv.net\mpvnet.exe"]
|
||||
MPVNET_PATHS = [r"c:\program files\mpv.net\mpvnet.exe", r"c:\program Files (x86)\mpv.net\mpvnet.exe"]
|
||||
try:
|
||||
import os
|
||||
MPVNET_PATHS.append(os.path.expandvars(r'%LOCALAPPDATA%\Microsoft\WindowsApps\mpvnet.exe'))
|
||||
except:
|
||||
pass
|
||||
VLC_PATHS = [
|
||||
r"c:\program files (x86)\videolan\vlc\vlc.exe",
|
||||
r"c:\program files\videolan\vlc\vlc.exe",
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import os
|
||||
from syncplay import constants
|
||||
from syncplay.players.mpv import MpvPlayer
|
||||
from syncplay.utils import playerPathExists
|
||||
|
||||
class MpvnetPlayer(MpvPlayer):
|
||||
|
||||
|
@ -30,11 +31,11 @@ class MpvnetPlayer(MpvPlayer):
|
|||
|
||||
@staticmethod
|
||||
def getExpandedPath(playerPath):
|
||||
if not os.path.isfile(playerPath):
|
||||
if os.path.isfile(playerPath + "mpvnet.exe"):
|
||||
if not playerPathExists(playerPath):
|
||||
if playerPathExists(playerPath + "mpvnet.exe"):
|
||||
playerPath += "mpvnet.exe"
|
||||
return playerPath
|
||||
elif os.path.isfile(playerPath + "\\mpvnet.exe"):
|
||||
elif playerPathExists(playerPath + "\\mpvnet.exe"):
|
||||
playerPath += "\\mpvnet.exe"
|
||||
return playerPath
|
||||
if os.access(playerPath, os.X_OK):
|
||||
|
|
|
@ -9,7 +9,7 @@ from syncplay import utils
|
|||
from syncplay.messages import getMessage, getLanguages, setLanguage, getInitialLanguage
|
||||
from syncplay.players.playerFactory import PlayerFactory
|
||||
from syncplay.utils import isBSD, isLinux, isMacOS, isWindows
|
||||
from syncplay.utils import resourcespath, posixresourcespath
|
||||
from syncplay.utils import resourcespath, posixresourcespath, playerPathExists
|
||||
|
||||
from syncplay.vendor.Qt import QtCore, QtWidgets, QtGui, __binding__, IsPySide, IsPySide2
|
||||
from syncplay.vendor.Qt.QtCore import Qt, QSettings, QCoreApplication, QSize, QPoint, QUrl, QLine, QEventLoop, Signal
|
||||
|
@ -210,12 +210,14 @@ class ConfigDialog(QtWidgets.QDialog):
|
|||
self.executablepathCombobox.addItem(foundpath)
|
||||
|
||||
else:
|
||||
if not os.path.isfile(playerpath):
|
||||
if not playerPathExists(playerpath):
|
||||
expandedpath = PlayerFactory().getExpandedPlayerPathByPath(playerpath)
|
||||
if expandedpath is not None and os.path.isfile(expandedpath):
|
||||
if expandedpath is not None and playerPathExists(expandedpath):
|
||||
playerpath = expandedpath
|
||||
elif "mpvnet.exe" in playerpath and playerPathExists(playerpath.replace("mpvnet.exe","mpvnet.com")):
|
||||
self.executablepathCombobox.addItem(playerpath)
|
||||
|
||||
if os.path.isfile(playerpath):
|
||||
if playerPathExists(playerpath):
|
||||
foundpath = playerpath
|
||||
self.executablepathCombobox.addItem(foundpath)
|
||||
|
||||
|
@ -226,7 +228,7 @@ class ConfigDialog(QtWidgets.QDialog):
|
|||
if path != playerpath:
|
||||
self.executablepathCombobox.addItem(path)
|
||||
|
||||
elif os.path.isfile(path) and os.path.normcase(os.path.normpath(path)) != os.path.normcase(os.path.normpath(foundpath)):
|
||||
elif playerPathExists(path) and os.path.normcase(os.path.normpath(path)) != os.path.normcase(os.path.normpath(foundpath)):
|
||||
self.executablepathCombobox.addItem(path)
|
||||
if foundpath == "":
|
||||
foundpath = path
|
||||
|
|
|
@ -417,6 +417,13 @@ def open_system_file_browser(path):
|
|||
else:
|
||||
subprocess.Popen(["xdg-open", path])
|
||||
|
||||
def playerPathExists(path):
|
||||
if os.path.isfile(path):
|
||||
return True
|
||||
elif "mpvnet.exe" in path and os.path.isfile(path.replace("mpvnet.exe","mpvnet.com")):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def getListOfPublicServers():
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue