* Separate mpv from mplayer, increase min mpv ver to >= 0.17, refactor * Further separation of mpv from mplayer * Fix reference to isASCII * Add iwalton3's Python MPV JSONIPC library (Apache 2.0) * Move to JSON IPC API for mpv using iwaltons3's library (#261) * Add empty init in Python MPV JSONIPC to make py2exe happy * Use managed version of Python MPV JSONIPC to improve initialisation reliability * Set mpv min version to >=0.29.0 to ensure compatibility * Allow mpv >=0.23.0 based on daniel-123's tests * Update mpv compatibility message * Revert to old OSC compat message * Removed mpv option that's no longer used afer switching to IPC. * Update python-mpv-jsonipc to v1.1.11 * Use python-mpv-jsonipc's mpv quit handler * Shorten mpv paused/position update message Co-authored-by: daniel-123 <wrobel.dan@gmail.com>
52 lines
1.5 KiB
Python
52 lines
1.5 KiB
Python
import os
|
|
from syncplay import constants
|
|
from syncplay.players.mpv import MpvPlayer
|
|
|
|
class MpvnetPlayer(MpvPlayer):
|
|
|
|
|
|
@staticmethod
|
|
def run(client, playerPath, filePath, args):
|
|
constants.MPV_NEW_VERSION = True
|
|
constants.MPV_OSC_VISIBILITY_CHANGE_VERSION = True
|
|
return MpvnetPlayer(client, MpvnetPlayer.getExpandedPath(playerPath), filePath, args)
|
|
|
|
@staticmethod
|
|
def getDefaultPlayerPathsList():
|
|
l = []
|
|
for path in constants.MPVNET_PATHS:
|
|
p = MpvnetPlayer.getExpandedPath(path)
|
|
if p:
|
|
l.append(p)
|
|
return l
|
|
|
|
|
|
@staticmethod
|
|
def isValidPlayerPath(path):
|
|
if "mpvnet" in path and MpvnetPlayer.getExpandedPath(path):
|
|
return True
|
|
return False
|
|
|
|
|
|
@staticmethod
|
|
def getExpandedPath(playerPath):
|
|
if not os.path.isfile(playerPath):
|
|
if os.path.isfile(playerPath + "mpvnet.exe"):
|
|
playerPath += "mpvnet.exe"
|
|
return playerPath
|
|
elif os.path.isfile(playerPath + "\\mpvnet.exe"):
|
|
playerPath += "\\mpvnet.exe"
|
|
return playerPath
|
|
if os.access(playerPath, os.X_OK):
|
|
return playerPath
|
|
for path in os.environ['PATH'].split(':'):
|
|
path = os.path.join(os.path.realpath(path), playerPath)
|
|
if os.access(path, os.X_OK):
|
|
return path
|
|
|
|
|
|
@staticmethod
|
|
def getIconPath(path):
|
|
return constants.MPVNET_ICONPATH
|
|
|