Merge branch 'master' into setOthersReadiness

This commit is contained in:
Etoh 2024-09-30 19:41:02 +01:00 committed by GitHub
commit bd9d233372
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
22 changed files with 109 additions and 52 deletions

View File

@ -16,7 +16,7 @@ Version: "$(
)"
Architecture: all
Maintainer: <dev@syncplay.pl>
Depends: python3 (>= 3.6), python3-pyside2.qtwidgets, python3-pyside2.qtcore, python3-twisted (>= 16.4.0), python3-certifi, mpv (>= 0.23) | vlc (>= 2.2.1)
Depends: python3 (>= 3.6), python3-pyside2.qtwidgets | python3-pyside6.qtwidgets, python3-pyside2.qtcore | python3-pyside6.qtcore, python3-twisted (>= 16.4.0), python3-certifi, python3-pem, mpv (>= 0.23) | vlc (>= 2.2.1)
Homepage: https://syncplay.pl
Section: web
Priority: optional

View File

@ -1,5 +1,5 @@
version = '1.7.2'
version = '1.7.4'
revision = ' development'
milestone = 'Yoitsu'
release_number = '110'
release_number = '113'
projectURL = 'https://syncplay.pl/'

View File

@ -71,6 +71,9 @@ class SyncplayClient(object):
constants.SHOW_SAME_ROOM_OSD = config['showSameRoomOSD']
constants.SHOW_DURATION_NOTIFICATION = config['showDurationNotification']
constants.DEBUG_MODE = config['debug']
constants.FOLDER_SEARCH_FIRST_FILE_TIMEOUT = config['folderSearchFirstFileTimeout']
constants.FOLDER_SEARCH_TIMEOUT = config['folderSearchTimeout']
constants.FOLDER_SEARCH_DOUBLE_CHECK_INTERVAL = config['folderSearchDoubleCheckInterval']
self.controlpasswords = {}
self.lastControlPasswordAttempt = None
@ -1795,6 +1798,9 @@ class SyncplayPlaylist():
def loadDelayedPath(self, changeToIndex):
# Implementing the behaviour set out at https://github.com/Syncplay/syncplay/issues/315
if not self._client:
return
if self._client.playerIsNotReady():
self._client.addPlayerReadyCallback(lambda x: self.loadDelayedPath(changeToIndex))
return

View File

@ -29,7 +29,7 @@ MPLAYER_OSD_LEVEL = 1
UI_TIME_FORMAT = "[%X] "
CONFIG_NAMES = [".syncplay", "syncplay.ini"] # Syncplay searches first to last
DEFAULT_CONFIG_NAME = "syncplay.ini"
RECENT_CLIENT_THRESHOLD = "1.7.1" # This and higher considered 'recent' clients (no warnings)
RECENT_CLIENT_THRESHOLD = "1.7.3" # This and higher considered 'recent' clients (no warnings)
MUSIC_FORMATS = [".mp3", ".m4a", ".m4p", ".wav", ".aiff", ".r", ".ogg", ".flac"] # ALL LOWER CASE!
WARN_OLD_CLIENTS = True # Use MOTD to inform old clients to upgrade
LIST_RELATIVE_CONFIGS = True # Print list of relative configs loaded
@ -112,9 +112,9 @@ FOLDER_SEARCH_DOUBLE_CHECK_INTERVAL = 30.0 # Secs - Frequency of updating cache
# Usually there's no need to adjust these
DOUBLE_CHECK_REWIND = False
LAST_PAUSED_DIFF_THRESHOLD = 2
FILENAME_STRIP_REGEX = "[-~_\.\[\](): ]"
CONTROL_PASSWORD_STRIP_REGEX = "[^a-zA-Z0-9\-]"
ROOM_NAME_STRIP_REGEX = "^(\+)(?P<roomnamebase>.*)(:)(\w{12})$"
FILENAME_STRIP_REGEX = r"[-~_\.\[\](): ]"
CONTROL_PASSWORD_STRIP_REGEX = r"[^a-zA-Z0-9\-]"
ROOM_NAME_STRIP_REGEX = r"^(\+)(?P<roomnamebase>.*)(:)(\w{12})$"
ARGUMENT_SPLIT_REGEX = r'(?:[^\s"]+|"[^"]*")+'
COMMANDS_UNDO = ["u", "undo", "revert"]
COMMANDS_CHAT = ["ch", "chat"]
@ -166,7 +166,7 @@ MPC_PATHS = [
]
MPC_EXECUTABLES = ["mpc-hc.exe", "mpc-hc64.exe", "mpc-hcportable.exe", "mpc-hc_nvo.exe", "mpc-hc64_nvo.exe", "shoukaku.exe"]
MPC64_EXECUTABLES = ["mpc-hc64.exe", "mpc-hc64_nvo.exe", "x64\mpc-hc\shoukaku.exe"]
MPC64_EXECUTABLES = ["mpc-hc64.exe", "mpc-hc64_nvo.exe", r"x64\mpc-hc\shoukaku.exe"]
MPC_BE_PATHS = [
r"c:\program files\mpc-be x64\mpc-be64.exe",
@ -183,6 +183,7 @@ try:
import os
MPVNET_PATHS.append(os.path.expandvars(r'%LOCALAPPDATA%\Microsoft\WindowsApps\mpvnet.exe'))
MPVNET_PATHS.append(os.path.expandvars(r'%LOCALAPPDATA%\Programs\mpv.net\mpvnet.exe'))
MPV_PATHS.append(os.path.expandvars(r'%LOCALAPPDATA%\Microsoft\WindowsApps\mpv.exe'))
except:
pass
VLC_PATHS = [
@ -305,7 +306,7 @@ VLC_SLAVE_EXTRA_ARGS = getValueForOS({
OS_MACOS: ['--verbose=2', '--no-file-logging']})
MPV_SUPERSEDE_IF_DUPLICATE_COMMANDS = ["set_property time-pos ", "loadfile "]
MPV_REMOVE_BOTH_IF_DUPLICATE_COMMANDS = ["cycle pause"]
MPLAYER_ANSWER_REGEX = "^ANS_([a-zA-Z_-]+)=(.+)$|^(Exiting)\.\.\. \((.+)\)$"
MPLAYER_ANSWER_REGEX = r"^ANS_([a-zA-Z_-]+)=(.+)$|^(Exiting)\.\.\. \((.+)\)$"
VLC_ANSWER_REGEX = r"(?:^(?P<command>[a-zA-Z_-]+)(?:\: )?(?P<argument>.*))"
UI_COMMAND_REGEX = r"^(?P<command>[^\ ]+)(?:\ (?P<parameter>.+))?"
UI_OFFSET_REGEX = r"^(?:o|offset)\ ?(?P<sign>[/+-])?(?P<time>\d{1,9}(?:[^\d\.](?:\d{1,9})){0,2}(?:\.(?:\d{1,3}))?)$"

View File

@ -138,7 +138,7 @@ de = {
"hostname-empty-error": "Hostname darf nicht leer sein",
"empty-error": "{} darf nicht leer sein", # Configuration
"media-player-error": "Player-Fehler: \"{}\"", # Error line
"unable-import-gui-error": "Konnte die GUI-Bibliotheken nicht importieren. PySide muss installiert sein, damit die grafische Oberfläche funktioniert.",
"unable-import-gui-error": "Konnte die GUI-Bibliotheken nicht importieren. PySide muss installiert sein, damit die grafische Oberfläche funktioniert. If you want to run Syncplay in console mode then run it with the --no-gui command line switch. See https://syncplay.pl/guide/ for more details.", # TODO: Translate end of message and update second sentence to be a translation of "You need to have the correct version of PySide installed for the GUI to work."
"unable-import-twisted-error": "Twisted konnte nicht importiert werden. Bitte installiere Twisted v16.4.0 oder höher",
"arguments-missing-error": "Notwendige Argumente fehlen, siehe --help",

View File

@ -138,7 +138,7 @@ en = {
"hostname-empty-error": "Hostname can't be empty",
"empty-error": "{} can't be empty", # Configuration
"media-player-error": "Media player error: \"{}\"", # Error line
"unable-import-gui-error": "Could not import GUI libraries. If you do not have PySide installed then you will need to install it for the GUI to work.",
"unable-import-gui-error": "Could not import GUI libraries. You need to have the correct version of PySide installed for the GUI to work. If you want to run Syncplay in console mode then run it with the --no-gui command line switch. See https://syncplay.pl/guide/ for more details.",
"unable-import-twisted-error": "Could not import Twisted. Please install Twisted v16.4.0 or later.",
"arguments-missing-error": "Some necessary arguments are missing, refer to --help",

View File

@ -141,7 +141,7 @@ eo = {
"hostname-empty-error": "Nomo de gastiga komputilo ne povas esti malplena",
"empty-error": "{} ne povas esti malplena", # Configuration
"media-player-error": "Eraro de vidaŭdaĵa ludilo: \"{}\"", # Error line
"unable-import-gui-error": "Ne povis enporti fasadajn bibliotekojn. Se PySide ne estas instalita, vi devos instali ĝin, por ke la fasado funkciu.",
"unable-import-gui-error": "Ne povis enporti fasadajn bibliotekojn. Se PySide ne estas instalita, vi devos instali ĝin, por ke la fasado funkciu. If you want to run Syncplay in console mode then run it with the --no-gui command line switch. See https://syncplay.pl/guide/ for more details.", # TODO: Translate end of message and update second sentence to be a translation of "You need to have the correct version of PySide installed for the GUI to work."
"unable-import-twisted-error": "Ne povis enporti la bibliotekon Twisted. Bonvolu instali version 16.4.0 de Twisted, aŭ pli altan.",
"arguments-missing-error": "Iuj bezonataj parametroj mankas; vidu al --help",

View File

@ -138,7 +138,7 @@ es = {
"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
"unable-import-gui-error": "No se lograron importar las librerías GUI. Si no tienes instalado PySide, entonces tendrás que instalarlo para que funcione el GUI.",
"unable-import-gui-error": "No se lograron importar las librerías GUI. Si no tienes instalado PySide, entonces tendrás que instalarlo para que funcione el GUI. If you want to run Syncplay in console mode then run it with the --no-gui command line switch. See https://syncplay.pl/guide/ for more details.", # TODO: Translate end of message and update second sentence to be a translation of "You need to have the correct version of PySide installed for the GUI to work."
"unable-import-twisted-error": "No se logró importar Twisted. Por favor instala Twisted v16.4.0 o posterior.",
"arguments-missing-error": "Están faltando algunos argumentos necesarios. Por favor revisa --help",

View File

@ -138,7 +138,7 @@ fi = {
"hostname-empty-error": "Palvelinnimi ei voi olla tyhjä",
"empty-error": "{} ei voi jättää tyhjäksi", # Configuration
"media-player-error": "Mediasoitin kohtasi virheen: \"{}\"", # Error line
"unable-import-gui-error": "Käyttöliittymäkirjastoja ei saatu tuotua. Mikäli sinulla ei ole PySide asennettuna, tulee sinun asentaa se jotta käyttöliittymä toimisi.",
"unable-import-gui-error": "Käyttöliittymäkirjastoja ei saatu tuotua. Mikäli sinulla ei ole PySide asennettuna, tulee sinun asentaa se jotta käyttöliittymä toimisi. If you want to run Syncplay in console mode then run it with the --no-gui command line switch. See https://syncplay.pl/guide/ for more details.", # TODO: Translate end of message and update second sentence to be a translation of "You need to have the correct version of PySide installed for the GUI to work."
"unable-import-twisted-error": "Twisted:iä ei onnistuttu tuomaan. Asenna Twisted v16.4.0 tai myöhäisempi.",
"arguments-missing-error": "Joitakin vipuja uupuu, katso apua --help",

View File

@ -138,7 +138,7 @@ fr = {
"hostname-empty-error": "Le nom d'hôte ne peut pas être vide",
"empty-error": "{} ne peut pas être vide", # Configuration
"media-player-error": "Media player error: \"{}\"", # Error line
"unable-import-gui-error": "Impossible d'importer les bibliothèques GUI. Si vous n'avez pas installé PySide, vous devrez l'installer pour que l'interface graphique fonctionne.",
"unable-import-gui-error": "Impossible d'importer les bibliothèques GUI. Si vous n'avez pas installé PySide, vous devrez l'installer pour que l'interface graphique fonctionne. If you want to run Syncplay in console mode then run it with the --no-gui command line switch. See https://syncplay.pl/guide/ for more details.", # TODO: Translate end of message and update second sentence to be a translation of "You need to have the correct version of PySide installed for the GUI to work."
"unable-import-twisted-error": "Impossible d'importer Twisted. Veuillez installer Twisted v16.4.0 ou une version ultérieure.",
"arguments-missing-error": "Certains arguments nécessaires sont manquants, reportez-vous à --help",

View File

@ -138,7 +138,7 @@ it = {
"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
"unable-import-gui-error": "Non è possibile importare le librerie di interfaccia grafica. Hai bisogno di PySide per poter utilizzare l'interfaccia grafica.",
"unable-import-gui-error": "Non è possibile importare le librerie di interfaccia grafica. Hai bisogno di PySide per poter utilizzare l'interfaccia grafica. If you want to run Syncplay in console mode then run it with the --no-gui command line switch. See https://syncplay.pl/guide/ for more details.", # TODO: Translate end of message and update second sentence to be a translation of "You need to have the correct version of PySide installed for the GUI to work."
"unable-import-twisted-error": "Non è possibile importare Twisted. Si prega di installare Twisted v16.4.0 o superiore.",
"arguments-missing-error": "Alcuni argomenti obbligatori non sono stati trovati. Fai riferimento a --help",

View File

@ -138,7 +138,7 @@ ko = {
"hostname-empty-error": "호스트이름은 비워둘 수 없습니다",
"empty-error": "{}은(는) 비워 둘 수 없습니다", # Configuration
"media-player-error": "미디어 플레이어 오류: \"{}\"", # Error line
"unable-import-gui-error": "GUI 라이브러리를 가져올 수 없습니다. PySide가 설치되어 있지 않은 경우 GUI가 작동하려면 설치해야 합니다.",
"unable-import-gui-error": "GUI 라이브러리를 가져올 수 없습니다. PySide가 설치되어 있지 않은 경우 GUI가 작동하려면 설치해야 합니다. If you want to run Syncplay in console mode then run it with the --no-gui command line switch. See https://syncplay.pl/guide/ for more details.", # TODO: Translate end of message and update second sentence to be a translation of "You need to have the correct version of PySide installed for the GUI to work."
"unable-import-twisted-error": "Twisted를 가져올 수 없습니다. Twisted v16.4.0 이상을 설치하세요.",
"arguments-missing-error": "일부 필요한 인수가 누락되었습니다. --help를 참조하세요.",

View File

@ -138,7 +138,7 @@ pt_BR = {
"hostname-empty-error": "O endereço do servidor não pode estar vazio",
"empty-error": "{} não pode estar vazio", # Configuration
"media-player-error": "Erro do reprodutor de mídia: \"{}\"", # Error line
"unable-import-gui-error": "Não foi possível importar bibliotecas da GUI. Se você não possuir o PySide instalado, instale-o para que a GUI funcione.",
"unable-import-gui-error": "Não foi possível importar bibliotecas da GUI. Se você não possuir o PySide instalado, instale-o para que a GUI funcione. If you want to run Syncplay in console mode then run it with the --no-gui command line switch. See https://syncplay.pl/guide/ for more details.", # TODO: Translate end of message and update second sentence to be a translation of "You need to have the correct version of PySide installed for the GUI to work."
"unable-import-twisted-error": "Não foi possível importar o Twisted. Por favor, instale o Twisted v16.4.0 ou superior.",
"arguments-missing-error": "Alguns argumentos necessários estão faltando, por favor reveja --help",

View File

@ -138,7 +138,7 @@ pt_PT = {
"hostname-empty-error": "O endereço do servidor não pode ser vazio",
"empty-error": "{} não pode ser vazio", # Configuration
"media-player-error": "Erro do reprodutor de mídia: \"{}\"", # Error line
"unable-import-gui-error": "Não foi possível importar bibliotecas da GUI. Se você não possuir o PySide instalado, instale-o para que a GUI funcione.",
"unable-import-gui-error": "Não foi possível importar bibliotecas da GUI. Se você não possuir o PySide instalado, instale-o para que a GUI funcione. If you want to run Syncplay in console mode then run it with the --no-gui command line switch. See https://syncplay.pl/guide/ for more details.", # TODO: Translate end of message and update second sentence to be a translation of "You need to have the correct version of PySide installed for the GUI to work."
"unable-import-twisted-error": "Não foi possível importar o Twisted. Por favor, instale o Twisted v16.4.0 ou superior.",
"arguments-missing-error": "Alguns argumentos necessários estão faltando, por favor reveja --help",

View File

@ -138,7 +138,7 @@ ru = {
"hostname-empty-error": "Имя пользователя не может быть пустым.",
"empty-error": "{} не может быть пустым.", # Configuration
"media-player-error": "Ошибка проигрывателя: \"{}\"", # Error line
"unable-import-gui-error": "Невозможно импортировать библиотеки графического интерфейса. Необходимо установить PySide, иначе графический интерфейс не будет работать.",
"unable-import-gui-error": "Невозможно импортировать библиотеки графического интерфейса. Необходимо установить PySide, иначе графический интерфейс не будет работать. If you want to run Syncplay in console mode then run it with the --no-gui command line switch. See https://syncplay.pl/guide/ for more details.", # TODO: Translate end of message and update second sentence to be a translation of "You need to have the correct version of PySide installed for the GUI to work."
"unable-import-twisted-error": "Невозможно импортировать Twisted. Установите Twisted 16.4.0 или более позднюю версию.",
"arguments-missing-error": "Некоторые необходимые аргументы отсутствуют, обратитесь к --help",

View File

@ -98,7 +98,7 @@ tr = {
"commandlist-notification/undo": "\tu - son isteği geri alır",
"commandlist-notification/pause": "\tp - duraklatmayı değiştirir",
"commandlist-notification/seek": "\t[s][+-]time - verilen zaman değerine atlar, eğer + veya - belirtilmezse, saniye:dakika cinsinden mutlak zamandır.",
"commandlist-notification/offset": "\to[+-]duration - offset local playback by the given duration (in seconds or min:sec) from the server seek position - this is a deprecated feature", # TODO: Translate
"commandlist-notification/offset": "\to[+-]süre - yerel oynatmayı sunucu arama konumundan verilen süreye göre (saniye veya dakika:saniye cinsinden) dengeleme - bu, kullanımdan kaldırılmış bir özelliktir",
"commandlist-notification/help": "\th - yardım",
"commandlist-notification/toggle": "\tt - izlemeye hazır olup olmadığınızı değiştirir",
"commandlist-notification/setready": "\tsr [name] - sets user as ready", # TODO: Translate
@ -107,10 +107,10 @@ tr = {
"commandlist-notification/auth": "\ta [password] - operatör şifresi ile oda operatörü olarak kimlik doğrular",
"commandlist-notification/chat": "\tch [message] - bir odaya sohbet mesajı gönderir",
"commandList-notification/queue": "\tqa [file/url] - oynatma listesinin altına dosya veya bağlantı ekler",
"commandList-notification/queueandselect": "\tqas [file/url] - add file or url to bottom of playlist and select it", # TO DO: Translate
"commandList-notification/queueandselect": "\tqas [dosya/url] - oynatma listesinin en altına dosya veya URL ekler ve onu seçer",
"commandList-notification/playlist": "\tql - mevcut oynatma listesini gösterir",
"commandList-notification/select": "\tqs [index] - oynatma listesinde verilen girişi seçer",
"commandList-notification/next": "\tqn - select next entry in the playlist", # TODO: Translate
"commandList-notification/next": "\tqn - oynatma listesindeki sonraki girişi seçer",
"commandList-notification/delete": "\tqd [index] - verilen girişi oynatma listesinden siler",
"syncplay-version-notification": "Syncplay sürümü: {}", # syncplay.version
"more-info-notification": "Daha fazla bilgiye şu adresten ulaşabilirsiniz: {}", # projectURL
@ -138,7 +138,7 @@ tr = {
"hostname-empty-error": "Ana bilgisayar adı boş olamaz",
"empty-error": "{} boş olamaz", # Configuration
"media-player-error": "Medaya oynatıcısı hatası: \"{}\"", # Error line
"unable-import-gui-error": "GUI kitaplıkları içe aktarılamadı. PySide kurulu değilse, GUI'nin çalışması için kurmanız gerekecektir.",
"unable-import-gui-error": "GUI kitaplıkları içe aktarılamadı. GUI'nin çalışması için PySide'ın doğru sürümünün kurulu olması gerekir. Syncplay'i terminal modunda çalıştırmak istiyorsanız --no-gui komut satırı anahtarıyla çalıştırın. Daha fazla ayrıntı için https://syncplay.pl/guide/ adresine bakın.",
"unable-import-twisted-error": "Twisted içe aktarılamadı. Lütfen Twisted v16.4.0 veya sonraki sürümünü yükleyin.",
"arguments-missing-error": "Bazı gerekli argümanlar eksik, bakınız --help",
@ -312,7 +312,7 @@ tr = {
"autoplay-menu-label": "Otomatik oynat düğmesini göster",
"autoplay-guipushbuttonlabel": "Her şey hazır olduğunda oynat",
"autoplay-minimum-label": "Asgari kullanıcı:",
"hideemptyrooms-menu-label": "Hide empty persistent rooms", # TODO: Translate
"hideemptyrooms-menu-label": "Boş kalıcı odaları gizle",
"sendmessage-label": "Gönder",
@ -479,7 +479,7 @@ tr = {
# Server messages to client
"new-syncplay-available-motd-message": "Syncplay {} kullanıyorsunuz ancak daha yeni bir sürüm https://syncplay.pl adresinde mevcut", # ClientVersion
"persistent-rooms-notice": "NOTICE: This server uses persistent rooms, which means that the playlist information is stored between playback sessions. If you want to create a room where information is not saved then put -temp at the end of the room name.", # TO DO: Translate - NOTE: Do not translate the word -temp
"persistent-rooms-notice": "DİKKAT: Bu sunucu kalıcı odalar kullanır; bu, oynatma oturumları arasında oynatma listesi bilgilerinin saklandığı anlamına gelir. Bilgilerin kaydedilmediği bir oda oluşturmak istiyorsanız oda adının sonuna -temp koyun.",
"ready-chat-message": "I have set {} as ready.", # User # TODO: Translate
"not-ready-chat-message": "I have set {} as not ready.", # User # TODO: Translate
@ -499,8 +499,8 @@ tr = {
"server-salt-argument": "yönetilen oda şifreleri oluşturmak için kullanılan rastgele dize",
"server-disable-ready-argument": "hazır olma özelliğini devre dışı bırak",
"server-motd-argument": "motd alınacak dosyanın yolu",
"server-rooms-argument": "path to database file to use and/or create to store persistent room data. Enables rooms to persist without watchers and through restarts", # TODO: Translate
"server-permanent-rooms-argument": "path to file which lists permenant rooms that will be listed even if the room is empty (in the form of a text file which lists one room per line) - requires persistent rooms to be enabled", # TODO: Translate
"server-rooms-argument": "kalıcı oda verilerini depolamak için kullanılacak ve/veya oluşturulacak veritabanı dosyasının yolu. Odaların gözlemciler olmadan ve yeniden başlatmalar yoluyla varlığını sürdürmesini sağlar",
"server-permanent-rooms-argument": "oda boş olsa bile listelenecek kalıcı odaları listeleyen dosyanın yolu (satır başına bir odayı listeleyen bir metin dosyası biçiminde) - kalıcı odaların etkinleştirilmesini gerektirir",
"server-chat-argument": "Sohbet devre dışı bırakılmalı mı?",
"server-chat-maxchars-argument": "Bir sohbet mesajındaki maksimum karakter sayısı (varsayılan: {})", # Default number of characters
"server-maxusernamelength-argument": "Bir kullanıcı adındaki maksimum karakter sayısı (varsayılan {})",

View File

@ -138,7 +138,7 @@ zh_CN = {
"hostname-empty-error": "主机名不能是空的",
"empty-error": "{}不能是空的", # Configuration
"media-player-error": "媒体播放器错误:\"{}\"", # Error line
"unable-import-gui-error": "无法导入GUI库。如果你没有安装PySideGUI则无法工作请安装PySide。",
"unable-import-gui-error": "无法导入GUI库。如果你没有安装PySideGUI则无法工作请安装PySide。 If you want to run Syncplay in console mode then run it with the --no-gui command line switch. See https://syncplay.pl/guide/ for more details.", # TODO: Translate end of message and update second sentence to be a translation of "You need to have the correct version of PySide installed for the GUI to work."
"unable-import-twisted-error": "无法导入Twisted。请安装Twisted v16.4.0或更高版本。",
"arguments-missing-error": "缺少一些必要的参数,使用--help命令查看详细信息",

View File

@ -1,5 +1,6 @@
# coding:utf8
import os
import random
import re
import sys
import time
@ -10,8 +11,9 @@ import ast
from syncplay import constants
from syncplay.messages import getMessage
from syncplay.players.basePlayer import BasePlayer
from syncplay.utils import isURL, findResourcePath
from syncplay.utils import getRuntimeDir, 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 +92,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):
@ -181,6 +183,9 @@ class MpvPlayer(BasePlayer):
self._listener.sendLine(["print_text", '"ANS_{}=${{{}}}"'.format(property_, propertyID)])
def getCalculatedPosition(self):
if self._recentlyReset():
return 0
if self.fileLoaded == False:
self._client.ui.showDebugMessage(
"File not loaded so using GlobalPosition for getCalculatedPosition({})".format(
@ -375,7 +380,7 @@ class MpvPlayer(BasePlayer):
self._listener.sendLine(['loadfile', filePath], notReadyAfterThis=True)
def setFeatures(self, featureList):
self.sendMpvOptions()
self._sendMpvOptions()
def setPosition(self, value):
if value < constants.DO_NOT_RESET_POSITION_THRESHOLD and self._recentlyReset():
@ -408,7 +413,7 @@ class MpvPlayer(BasePlayer):
self._storePosition(0)
# TO TRY: self._listener.setReadyToSend(False)
def sendMpvOptions(self):
def _sendMpvOptions(self):
options = []
for option in constants.MPV_SYNCPLAYINTF_OPTIONS_TO_SEND:
options.append("{}={}".format(option, self._client._config[option]))
@ -420,6 +425,9 @@ class MpvPlayer(BasePlayer):
options_string = ", ".join(options)
self._listener.sendLine(["script-message-to", "syncplayintf", "set_syncplayintf_options", options_string])
self._setOSDPosition()
socketPath = self._listener.mpv_arguments.get("input-ipc-server")
if socketPath is not None:
self._setProperty("input-ipc-server", socketPath)
def _handleUnknownLine(self, line):
self.mpvErrorCheck(line)
@ -447,7 +455,7 @@ class MpvPlayer(BasePlayer):
#self._client.ui.showDebugMessage("{} = {} / {}".format(update_string, paused_update, position_update))
if "<get_syncplayintf_options>" in line:
self.sendMpvOptions()
self._sendMpvOptions()
if line == "<SyncplayUpdateFile>" or "Playing:" in line:
self._client.ui.showDebugMessage("Not ready to send due to <SyncplayUpdateFile>")
@ -618,8 +626,15 @@ class MpvPlayer(BasePlayer):
env['PATH'] = python_executable + ':' + env['PATH']
env['PYTHONPATH'] = pythonPath
try:
socket = self.mpv_arguments.get('input-ipc-server')
self.mpvpipe = self.playerIPCHandler(mpv_location=self.playerPath, ipc_socket=socket, loglevel="info", log_handler=self.__playerController.mpv_log_handler, quit_callback=self.stop_client, env=env, **self.mpv_arguments)
self.mpvpipe = self.playerIPCHandler(
loglevel="info",
ipc_socket=self._get_ipc_socket(),
mpv_location=self.playerPath,
log_handler=self.__playerController.mpv_log_handler,
quit_callback=self.stop_client,
env=env,
**self.mpv_arguments
)
except Exception as e:
self.quitReason = getMessage("media-player-error").format(str(e)) + " " + getMessage("mpv-failed-advice")
self.__playerController.reactor.callFromThread(self.__playerController._client.ui.showErrorMessage, self.quitReason, True)
@ -628,6 +643,12 @@ class MpvPlayer(BasePlayer):
#self.mpvpipe.show_text("HELLO WORLD!", 1000)
threading.Thread.__init__(self, name="MPV Listener")
def _get_ipc_socket(self):
if isWindows():
# On Windows, mpv expects a named pipe identifier (not a path)
return "syncplay-mpv-{0}".format(random.randint(0, 2**48))
return getRuntimeDir().joinpath("mpv-socket").as_posix()
def __getCwd(self, filePath, env):
if not filePath:
return None

View File

@ -50,9 +50,4 @@ class MpvnetPlayer(MpvPlayer):
def getIconPath(path):
return constants.MPVNET_ICONPATH
def sendMpvOptions(self):
for key in self._listener.mpv_arguments:
if key != "script" and key != "input-ipc-server":
self._setProperty(key, self._listener.mpv_arguments[key])
super().sendMpvOptions()

View File

@ -50,6 +50,9 @@ class ConfigurationGetter(object):
"slowOnDesync": True,
"fastforwardOnDesync": True,
"dontSlowDownWithMe": False,
"folderSearchFirstFileTimeout": constants.FOLDER_SEARCH_FIRST_FILE_TIMEOUT,
"folderSearchTimeout": constants.FOLDER_SEARCH_TIMEOUT,
"folderSearchDoubleCheckInterval": constants.FOLDER_SEARCH_DOUBLE_CHECK_INTERVAL,
"filenamePrivacyMode": constants.PRIVACY_SENDRAW_MODE,
"filesizePrivacyMode": constants.PRIVACY_SENDRAW_MODE,
"pauseOnLeave": False,
@ -163,6 +166,9 @@ class ConfigurationGetter(object):
"slowdownThreshold",
"rewindThreshold",
"fastforwardThreshold",
"folderSearchFirstFileTimeout",
"folderSearchTimeout",
"folderSearchDoubleCheckInterval",
"autoplayMinUsers",
"chatInputRelativeFontSize",
"chatInputFontWeight",
@ -188,6 +194,7 @@ class ConfigurationGetter(object):
"name", "room", "roomList", "playerPath",
"perPlayerArguments", "slowdownThreshold",
"rewindThreshold", "fastforwardThreshold",
"folderSearchFirstFileTimeout", "folderSearchTimeout", "folderSearchDoubleCheckInterval",
"slowOnDesync", "rewindOnDesync",
"fastforwardOnDesync", "dontSlowDownWithMe",
"forceGuiPrompt", "filenamePrivacyMode",
@ -520,7 +527,7 @@ class ConfigurationGetter(object):
from syncplay.vendor.Qt.QtCore import QCoreApplication
from syncplay.vendor import qt5reactor
if not (IsPySide6 or IsPySide2 or IsPySide):
raise ImportError
raise ImportError("Failed to identify compatible version of PySide.")
if QCoreApplication.instance() is None:
self.app = QtWidgets.QApplication(sys.argv)
self.app.setDesktopFileName("syncplay")
@ -537,13 +544,14 @@ class ConfigurationGetter(object):
if isMacOS():
import appnope
appnope.nope()
except ImportError:
except ImportError as e:
try:
from twisted.trial import unittest
except Exception as e:
print(e)
except Exception as ee:
print(ee)
print(getMessage("unable-import-twisted-error"))
sys.exit()
print(e)
print(getMessage("unable-import-gui-error"))
self._config['noGui'] = True
if self._config['file'] and self._config['file'][:2] == "--":

View File

@ -1516,6 +1516,8 @@ class MainWindow(QtWidgets.QMainWindow):
if isMacOS(): window.userlistLayout.setContentsMargins(3, 0, 3, 0)
window.listSplit = QtWidgets.QSplitter(Qt.Vertical, self)
window.listSplit.setHandleWidth(6)
window.listSplit.setStyle(QtWidgets.QStyleFactory.create("fusion"))
window.listSplit.addWidget(window.userlistFrame)
window.listLayout.addWidget(window.listSplit)
window.roomsCombobox = QtWidgets.QComboBox(self)
@ -1550,8 +1552,10 @@ class MainWindow(QtWidgets.QMainWindow):
window.topSplit.addWidget(window.outputFrame)
window.topSplit.addWidget(window.listFrame)
window.topSplit.setHandleWidth(6)
window.topSplit.setStretchFactor(0, 4)
window.topSplit.setStretchFactor(1, 5)
window.topSplit.setStyle(QtWidgets.QStyleFactory.create("fusion"))
window.mainLayout.addWidget(window.topSplit)
window.topSplit.setSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding)

View File

@ -1,5 +1,5 @@
import ast
import atexit
import datetime
import hashlib
import itertools
@ -10,11 +10,13 @@ import re
import string
import subprocess
import sys
import tempfile
import time
import traceback
import urllib.error
import urllib.parse
import urllib.request
from pathlib import Path
from syncplay import constants
from syncplay.messages import getMessage
@ -37,9 +39,28 @@ def isMacOS():
def isBSD():
return constants.OS_BSD in sys.platform or sys.platform.startswith(constants.OS_DRAGONFLY)
def isWindowsConsole():
return os.path.basename(sys.executable) == "SyncplayConsole.exe"
def getRuntimeDir():
cachedPath = getattr(getRuntimeDir, "cachedPath", None)
if cachedPath is not None:
return cachedPath
baseDir = None
if not isWindows() and not isMacOS():
baseDir = os.getenv("XDG_RUNTIME_DIR", None)
tmp = tempfile.TemporaryDirectory(prefix="syncplay-", dir=baseDir)
atexit.register(tmp.cleanup)
o = Path(tmp.name)
setattr(getRuntimeDir, "cachedPath", o)
return o
def retry(ExceptionToCheck, tries=4, delay=3, backoff=2, logger=None):
"""Retry calling the decorated function using an exponential backoff.
@ -211,7 +232,8 @@ def blackholeStdoutForFrozenWindow():
self._file = open(path, 'a', encoding='utf-8')
# TODO: Handle errors.
if self._file is not None:
self._file.write(text)
if not (text.startswith("<frozen zipimport>") and "UserWarning:" in text):
self._file.write(text)
self._file.flush()
def flush(self):
@ -305,7 +327,7 @@ def stripfilename(filename, stripURL):
def stripRoomName(RoomName):
if RoomName:
try:
return re.sub(constants.ROOM_NAME_STRIP_REGEX, "\g<roomnamebase>", RoomName)
return re.sub(constants.ROOM_NAME_STRIP_REGEX, r"\g<roomnamebase>", RoomName)
except IndexError:
return RoomName
else:
@ -483,8 +505,8 @@ def getListOfPublicServers():
class RoomPasswordProvider(object):
CONTROLLED_ROOM_REGEX = re.compile("^\+(.*):(\w{12})$")
PASSWORD_REGEX = re.compile("[A-Z]{2}-\d{3}-\d{3}")
CONTROLLED_ROOM_REGEX = re.compile(r"^\+(.*):(\w{12})$")
PASSWORD_REGEX = re.compile(r"[A-Z]{2}-\d{3}-\d{3}")
@staticmethod
def isControlledRoom(roomName):