Add initial mpv.net support
This commit is contained in:
parent
1d8ae6ea56
commit
187c8d87fc
@ -1,5 +1,5 @@
|
||||
version = '1.6.4'
|
||||
revision = 'a'
|
||||
version = '1.6.5'
|
||||
revision = ' development'
|
||||
milestone = 'Yoitsu'
|
||||
release_number = '79'
|
||||
release_number = '80'
|
||||
projectURL = 'https://syncplay.pl/'
|
||||
|
||||
@ -155,6 +155,8 @@ 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"]
|
||||
VLC_PATHS = [
|
||||
r"c:\program files (x86)\videolan\vlc\vlc.exe",
|
||||
r"c:\program files\videolan\vlc\vlc.exe",
|
||||
@ -169,6 +171,7 @@ VLC_PATHS = [
|
||||
VLC_ICONPATH = "vlc.png"
|
||||
MPLAYER_ICONPATH = "mplayer.png"
|
||||
MPV_ICONPATH = "mpv.png"
|
||||
MPVNET_ICONPATH = "mpvnet.ico"
|
||||
MPC_ICONPATH = "mpc-hc.png"
|
||||
MPC64_ICONPATH = "mpc-hc64.png"
|
||||
MPC_BE_ICONPATH = "mpc-be.png"
|
||||
|
||||
@ -108,7 +108,7 @@ de = {
|
||||
"mpc-be-version-insufficient-error": "MPC-Version nicht ausreichend, bitte nutze `mpc-be` >= `{}`",
|
||||
"mpv-version-error": "Syncplay ist nicht kompatibel mit dieser Version von mpv. Bitte benutze eine andere Version (z.B. Git HEAD).",
|
||||
"player-file-open-error": "Fehler beim Öffnen der Datei durch den Player",
|
||||
"player-path-error": "Ungültiger Player-Pfad. Supported players are: mpv, VLC, MPC-HC, MPC-BE and mplayer2", # To do: Translate end
|
||||
"player-path-error": "Ungültiger Player-Pfad. Supported players are: mpv, mpv.net, VLC, MPC-HC, MPC-BE and mplayer2", # To do: Translate end
|
||||
"hostname-empty-error": "Hostname darf nicht leer sein",
|
||||
"empty-error": "{} darf nicht leer sein", # Configuration
|
||||
"media-player-error": "Player-Fehler: \"{}\"", # Error line
|
||||
@ -119,7 +119,7 @@ de = {
|
||||
|
||||
"unable-to-start-client-error": "Client kann nicht gestartet werden",
|
||||
|
||||
"player-path-config-error": "Player-Pfad ist nicht ordnungsgemäß gesetzt. Supported players are: mpv, VLC, MPC-HC, MPC-BE and mplayer2.", # To do: Translate end
|
||||
"player-path-config-error": "Player-Pfad ist nicht ordnungsgemäß gesetzt. Supported players are: mpv, mpv.net, VLC, MPC-HC, MPC-BE and mplayer2.", # To do: Translate end
|
||||
"no-file-path-config-error": "Es muss eine Datei ausgewählt werden, bevor der Player gestartet wird.",
|
||||
"no-hostname-config-error": "Hostname darf nicht leer sein",
|
||||
"invalid-port-config-error": "Port muss gültig sein",
|
||||
|
||||
@ -108,7 +108,7 @@ en = {
|
||||
"mpc-be-version-insufficient-error": "MPC version not sufficient, please use `mpc-be` >= `{}`",
|
||||
"mpv-version-error": "Syncplay is not compatible with this version of mpv. Please use a different version of mpv (e.g. Git HEAD).",
|
||||
"player-file-open-error": "Player failed opening file",
|
||||
"player-path-error": "Player path is not set properly. Supported players are: mpv, VLC, MPC-HC, MPC-BE and mplayer2",
|
||||
"player-path-error": "Player path is not set properly. Supported players are: mpv, mpv.net, VLC, MPC-HC, MPC-BE and mplayer2",
|
||||
"hostname-empty-error": "Hostname can't be empty",
|
||||
"empty-error": "{} can't be empty", # Configuration
|
||||
"media-player-error": "Media player error: \"{}\"", # Error line
|
||||
@ -119,7 +119,7 @@ en = {
|
||||
|
||||
"unable-to-start-client-error": "Unable to start client",
|
||||
|
||||
"player-path-config-error": "Player path is not set properly. Supported players are: mpv, VLC, MPC-HC, MPC-BE and mplayer2.",
|
||||
"player-path-config-error": "Player path is not set properly. Supported players are: mpv, mpv.net, VLC, MPC-HC, MPC-BE and mplayer2.",
|
||||
"no-file-path-config-error": "File must be selected before starting your player",
|
||||
"no-hostname-config-error": "Hostname can't be empty",
|
||||
"invalid-port-config-error": "Port must be valid",
|
||||
|
||||
@ -108,7 +108,7 @@ es = {
|
||||
"mpc-be-version-insufficient-error": "La versión de MPC no es suficiente, por favor utiliza `mpc-be` >= `{}`",
|
||||
"mpv-version-error": "Syncplay no es compatible con esta versión de mpv. Por favor utiliza una versión diferente de mpv (p.ej. Git HEAD).",
|
||||
"player-file-open-error": "El reproductor falló al abrir el archivo",
|
||||
"player-path-error": "La ruta del reproductor no está definida correctamente. Los reproductores soportados son: mpv, VLC, MPC-HC, MPC-BE y mplayer2",
|
||||
"player-path-error": "La ruta del reproductor no está definida correctamente. Los reproductores soportados son: mpv, mpv.net, VLC, MPC-HC, MPC-BE y mplayer2",
|
||||
"hostname-empty-error": "El nombre del host no puede ser vacío",
|
||||
"empty-error": "{} no puede ser vacío", # Configuration
|
||||
"media-player-error": "Error del reproductor multimedia: \"{}\"", # Error line
|
||||
@ -119,7 +119,7 @@ es = {
|
||||
|
||||
"unable-to-start-client-error": "No se logró iniciar el cliente",
|
||||
|
||||
"player-path-config-error": "La ruta del reproductor no está definida correctamente. Los reproductores soportados son: mpv, VLC, MPC-HC, MPC-BE y mplayer2.",
|
||||
"player-path-config-error": "La ruta del reproductor no está definida correctamente. Los reproductores soportados son: mpv, mpv.net, VLC, MPC-HC, MPC-BE y mplayer2.",
|
||||
"no-file-path-config-error": "El archivo debe ser seleccionado antes de iniciar el reproductor",
|
||||
"no-hostname-config-error": "El nombre del host no puede ser vacío",
|
||||
"invalid-port-config-error": "El puerto debe ser válido",
|
||||
|
||||
@ -108,7 +108,7 @@ it = {
|
||||
"mpc-be-version-insufficient-error": "La tua versione di MPC è troppo vecchia, per favore usa `mpc-be` >= `{}`",
|
||||
"mpv-version-error": "Syncplay non è compatibile con questa versione di mpv. Per favore usa un'altra versione di mpv (es. Git HEAD).",
|
||||
"player-file-open-error": "Il player non è riuscito ad aprire il file",
|
||||
"player-path-error": "Il path del player non è configurato correttamente. I player supportati sono: mpv, VLC, MPC-HC, MPC-BE e mplayer2",
|
||||
"player-path-error": "Il path del player non è configurato correttamente. I player supportati sono: mpv, mpv.net, VLC, MPC-HC, MPC-BE e mplayer2",
|
||||
"hostname-empty-error": "Il campo hostname non può essere vuoto",
|
||||
"empty-error": "Il campo {} non può esssere vuoto", # Configuration
|
||||
"media-player-error": "Errore media player: \"{}\"", # Error line
|
||||
@ -119,7 +119,7 @@ it = {
|
||||
|
||||
"unable-to-start-client-error": "Impossibile avviare il client",
|
||||
|
||||
"player-path-config-error": "Il percorso del player non è configurato correttamente. I player supportati sono: mpv, VLC, MPC-HC, MPC-BE e mplayer2.",
|
||||
"player-path-config-error": "Il percorso del player non è configurato correttamente. I player supportati sono: mpv, mpv.net, VLC, MPC-HC, MPC-BE e mplayer2.",
|
||||
"no-file-path-config-error": "Deve essere selezionato un file prima di avviare il player",
|
||||
"no-hostname-config-error": "Il campo hostname non può essere vuoto",
|
||||
"invalid-port-config-error": "La porta deve essere valida",
|
||||
|
||||
@ -108,7 +108,7 @@ ru = {
|
||||
"mpc-be-version-insufficient-error": "Версия MPC слишком старая, пожалуйста, используйте `mpc-be` >= `{}`",
|
||||
"mpv-version-error": "Syncplay не совместим с данной версией mpv. Пожалуйста, используйте другую версию mpv (лучше свежайшую).",
|
||||
"player-file-open-error": "Проигрыватель не может открыть файл.",
|
||||
"player-path-error": "Путь к проигрывателю задан неверно. Supported players are: mpv, VLC, MPC-HC, MPC-BE and mplayer2.", # TODO: Translate last sentence
|
||||
"player-path-error": "Путь к проигрывателю задан неверно. Supported players are: mpv, mpv.net, VLC, MPC-HC, MPC-BE and mplayer2.", # TODO: Translate last sentence
|
||||
"hostname-empty-error": "Имя пользователя не может быть пустым.",
|
||||
"empty-error": "{} не может быть пустым.", # Configuration
|
||||
"media-player-error": "Ошибка проигрывателя: \"{}\"", # Error line
|
||||
@ -119,7 +119,7 @@ ru = {
|
||||
|
||||
"unable-to-start-client-error": "Невозможно запустить клиент",
|
||||
|
||||
"player-path-config-error": "Путь к проигрывателю установлен неверно. Supported players are: mpv, VLC, MPC-HC, MPC-BE and mplayer2", # To do: Translate end
|
||||
"player-path-config-error": "Путь к проигрывателю установлен неверно. Supported players are: mpv, mpv.net, VLC, MPC-HC, MPC-BE and mplayer2", # To do: Translate end
|
||||
"no-file-path-config-error": "Файл должен быть указан до включения проигрывателя",
|
||||
"no-hostname-config-error": "Имя сервера не может быть пустым",
|
||||
"invalid-port-config-error": "Неверный номер порта",
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
from syncplay.players.mplayer import MplayerPlayer
|
||||
from syncplay.players.mpv import MpvPlayer
|
||||
from syncplay.players.mpvnet import MpvnetPlayer
|
||||
from syncplay.players.vlc import VlcPlayer
|
||||
try:
|
||||
from syncplay.players.mpc import MPCHCAPIPlayer
|
||||
@ -14,4 +15,4 @@ except ImportError:
|
||||
|
||||
|
||||
def getAvailablePlayers():
|
||||
return [MPCHCAPIPlayer, MpvPlayer, VlcPlayer, MpcBePlayer, MplayerPlayer]
|
||||
return [MPCHCAPIPlayer, MpvPlayer, MpvnetPlayer, VlcPlayer, MpcBePlayer, MplayerPlayer]
|
||||
|
||||
@ -55,7 +55,7 @@ class MpvPlayer(MplayerPlayer):
|
||||
|
||||
@staticmethod
|
||||
def isValidPlayerPath(path):
|
||||
if "mpv" in path and MpvPlayer.getExpandedPath(path):
|
||||
if "mpv" in path and "mpvnet" not in path and MpvPlayer.getExpandedPath(path):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
51
syncplay/players/mpvnet.py
Normal file
51
syncplay/players/mpvnet.py
Normal file
@ -0,0 +1,51 @@
|
||||
import os
|
||||
from syncplay import constants
|
||||
from syncplay.players.mpv import NewMpvPlayer
|
||||
|
||||
class MpvnetPlayer(NewMpvPlayer):
|
||||
|
||||
|
||||
@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
|
||||
|
||||
BIN
syncplay/resources/mpvnet.ico
Normal file
BIN
syncplay/resources/mpvnet.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
Loading…
x
Reference in New Issue
Block a user