MPV support.
This commit is contained in:
parent
e61cddacbe
commit
98c63b7db9
@ -38,6 +38,7 @@ MPC_PATHS = [
|
|||||||
"C:\Program Files\MPC HomeCinema (x64)\mpc-hc64.exe",
|
"C:\Program Files\MPC HomeCinema (x64)\mpc-hc64.exe",
|
||||||
]
|
]
|
||||||
MPLAYER_PATHS = ["mplayer2", "mplayer"]
|
MPLAYER_PATHS = ["mplayer2", "mplayer"]
|
||||||
|
MPV_PATHS = ["mpv", "/opt/mpv/mpv"]
|
||||||
#Changing these is usually not something you're looking for
|
#Changing these is usually not something you're looking for
|
||||||
PLAYER_ASK_DELAY = 0.1
|
PLAYER_ASK_DELAY = 0.1
|
||||||
PING_MOVING_AVERAGE_WEIGHT = 0.85
|
PING_MOVING_AVERAGE_WEIGHT = 0.85
|
||||||
@ -49,6 +50,7 @@ MPC_PAUSE_TOGGLE_DELAY = 0.05
|
|||||||
|
|
||||||
#These are not changes you're looking for
|
#These are not changes you're looking for
|
||||||
MPLAYER_SLAVE_ARGS = [ '-slave', '-msglevel', 'all=1:global=4']
|
MPLAYER_SLAVE_ARGS = [ '-slave', '-msglevel', 'all=1:global=4']
|
||||||
|
MPV_SLAVE_ARGS = [ '--slave-broken', '-msglevel', 'all=1:global=4']
|
||||||
MPLAYER_ANSWER_REGEX = "^ANS_([a-zA-Z_]+)=(.+)$"
|
MPLAYER_ANSWER_REGEX = "^ANS_([a-zA-Z_]+)=(.+)$"
|
||||||
UI_COMMAND_REGEX = r"^(?P<command>[^\ ]+)(?:\ (?P<parameter>.+))?"
|
UI_COMMAND_REGEX = r"^(?P<command>[^\ ]+)(?:\ (?P<parameter>.+))?"
|
||||||
UI_OFFSET_REGEX = r"^(?:o|offset)\ ?(?P<sign>[/+-])?(?P<time>\d{1,4}(?:[^\d\.](?:\d{1,6})){0,2}(?:\.(?:\d{1,3}))?)$"
|
UI_OFFSET_REGEX = r"^(?:o|offset)\ ?(?P<sign>[/+-])?(?P<time>\d{1,4}(?:[^\d\.](?:\d{1,6})){0,2}(?:\.(?:\d{1,3}))?)$"
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
from syncplay.players.mplayer import MplayerPlayer
|
from syncplay.players.mplayer import MplayerPlayer
|
||||||
|
from syncplay.players.mpv import MpvPlayer
|
||||||
try:
|
try:
|
||||||
from syncplay.players.mpc import MPCHCAPIPlayer
|
from syncplay.players.mpc import MPCHCAPIPlayer
|
||||||
except ImportError:
|
except ImportError:
|
||||||
@ -6,4 +7,4 @@ except ImportError:
|
|||||||
MPCHCAPIPlayer = DummyPlayer
|
MPCHCAPIPlayer = DummyPlayer
|
||||||
|
|
||||||
def getAvailablePlayers():
|
def getAvailablePlayers():
|
||||||
return [MPCHCAPIPlayer, MplayerPlayer]
|
return [MPCHCAPIPlayer, MplayerPlayer, MpvPlayer]
|
||||||
|
|||||||
26
syncplay/players/mpv.py
Normal file
26
syncplay/players/mpv.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import subprocess
|
||||||
|
import threading
|
||||||
|
from syncplay.players.mplayer import MplayerPlayer
|
||||||
|
from syncplay import constants
|
||||||
|
|
||||||
|
class MpvPlayer(MplayerPlayer):
|
||||||
|
SLAVE_ARGS = constants.MPV_SLAVE_ARGS
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def run(client, playerPath, filePath, args):
|
||||||
|
return MpvPlayer(client, MpvPlayer.getExpandedPath(playerPath), filePath, args)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def getDefaultPlayerPathsList():
|
||||||
|
l = []
|
||||||
|
for path in constants.MPV_PATHS:
|
||||||
|
p = MpvPlayer.getExpandedPath(path)
|
||||||
|
if p:
|
||||||
|
l.append(p)
|
||||||
|
return l
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def isValidPlayerPath(path):
|
||||||
|
if("mpv" in path and MpvPlayer.getExpandedPath(path)):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
Loading…
x
Reference in New Issue
Block a user