Merge branch 'master' into mpv-store-path

This commit is contained in:
Etoh 2024-04-29 19:07:33 +01:00 committed by GitHub
commit 6d3b1ab8d3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
26 changed files with 111 additions and 64 deletions

View File

@ -63,10 +63,6 @@ client:
cp syncplay/resources/syncplay.desktop $(APP_SHORTCUT_PATH)/ cp syncplay/resources/syncplay.desktop $(APP_SHORTCUT_PATH)/
gzip docs/syncplay.1 --stdout > $(SHARE_PATH)/man/man1/syncplay.1.gz gzip docs/syncplay.1 --stdout > $(SHARE_PATH)/man/man1/syncplay.1.gz
ifeq ($(SINGLE_USER),false)
chmod 755 $(APP_SHORTCUT_PATH)/syncplay.desktop
endif
u-client: u-client:
-rm $(BIN_PATH)/syncplay -rm $(BIN_PATH)/syncplay
-rm $(LIB_PATH)/syncplay/syncplayClient.py -rm $(LIB_PATH)/syncplay/syncplayClient.py
@ -84,10 +80,6 @@ server:
cp syncplay/resources/syncplay-server.desktop $(APP_SHORTCUT_PATH)/ cp syncplay/resources/syncplay-server.desktop $(APP_SHORTCUT_PATH)/
gzip docs/syncplay-server.1 --stdout > $(SHARE_PATH)/man/man1/syncplay-server.1.gz gzip docs/syncplay-server.1 --stdout > $(SHARE_PATH)/man/man1/syncplay-server.1.gz
ifeq ($(SINGLE_USER),false)
chmod 755 $(APP_SHORTCUT_PATH)/syncplay-server.desktop
endif
u-server: u-server:
-rm $(BIN_PATH)/syncplay-server -rm $(BIN_PATH)/syncplay-server
-rm $(LIB_PATH)/syncplay/syncplayServer.py -rm $(LIB_PATH)/syncplay/syncplayServer.py

View File

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

View File

@ -1,5 +1,5 @@
version = '1.7.1' version = '1.7.2'
revision = '' revision = ''
milestone = 'Yoitsu' milestone = 'Yoitsu'
release_number = '109' release_number = '111'
projectURL = 'https://syncplay.pl/' projectURL = 'https://syncplay.pl/'

View File

@ -1785,6 +1785,9 @@ class SyncplayPlaylist():
def loadDelayedPath(self, changeToIndex): def loadDelayedPath(self, changeToIndex):
# Implementing the behaviour set out at https://github.com/Syncplay/syncplay/issues/315 # Implementing the behaviour set out at https://github.com/Syncplay/syncplay/issues/315
if not self._client:
return
if self._client.playerIsNotReady(): if self._client.playerIsNotReady():
self._client.addPlayerReadyCallback(lambda x: self.loadDelayedPath(changeToIndex)) self._client.addPlayerReadyCallback(lambda x: self.loadDelayedPath(changeToIndex))
return return

View File

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

View File

@ -101,12 +101,12 @@ de = {
"commandlist-notification/create": "\tc [name] - erstelle zentral gesteuerten Raum mit dem aktuellen Raumnamen", "commandlist-notification/create": "\tc [name] - erstelle zentral gesteuerten Raum mit dem aktuellen Raumnamen",
"commandlist-notification/auth": "\ta [password] - authentifiziere als Raumleiter mit Passwort", "commandlist-notification/auth": "\ta [password] - authentifiziere als Raumleiter mit Passwort",
"commandlist-notification/chat": "\tch [message] - Chatnachricht an einem Raum senden", "commandlist-notification/chat": "\tch [message] - Chatnachricht an einem Raum senden",
"commandList-notification/queue": "\tqa [file/url] - add file or url to bottom of playlist", # TO DO: Translate "commandList-notification/queue": "\tqa [file/url] - füge Datei oder URL ans Ende der Wiedergabeliste",
"commandList-notification/queueandselect": "\tqas [file/url] - add file or url to bottom of playlist and select it", # TO DO: Translate "commandList-notification/queueandselect": "\tqas [file/url] - füge Datei oder URL ans Ende der Wiedergabeliste und wähle diese aus",
"commandList-notification/playlist": "\tql - show the current playlist", # TO DO: Translate "commandList-notification/playlist": "\tql - zeige aktuelle Wiedergabeliste",
"commandList-notification/select": "\tqs [index] - select given entry in the playlist", # TO DO: Translate "commandList-notification/select": "\tqs [index] - wähle den ausgewählten Eintrag in der Wiedergabeliste",
"commandList-notification/next": "\tqn - select next entry in the playlist", # TODO: Translate "commandList-notification/next": "\tqn - wähle den nächsten Eintrag in der Wiedergabeliste",
"commandList-notification/delete": "\tqd [index] - delete the given entry from the playlist", # TO DO: Translate "commandList-notification/delete": "\tqd [index] - lösche den ausgewählten Eintrag in der Wiedergabeliste",
"syncplay-version-notification": "Syncplay Version: {}", # syncplay.version "syncplay-version-notification": "Syncplay Version: {}", # syncplay.version
"more-info-notification": "Weitere Informationen auf: {}", # projectURL "more-info-notification": "Weitere Informationen auf: {}", # projectURL
@ -127,13 +127,13 @@ de = {
"mpc-version-insufficient-error": "MPC-Version nicht ausreichend, bitte nutze `mpc-hc` >= `{}`", "mpc-version-insufficient-error": "MPC-Version nicht ausreichend, bitte nutze `mpc-hc` >= `{}`",
"mpc-be-version-insufficient-error": "MPC-Version nicht ausreichend, bitte nutze `mpc-be` >= `{}`", "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).", "mpv-version-error": "Syncplay ist nicht kompatibel mit dieser Version von mpv. Bitte benutze eine andere Version (z.B. Git HEAD).",
"mpv-failed-advice": "The reason mpv cannot start may be due to the use of unsupported command line arguments or an unsupported version of mpv.", # TODO: Translate "mpv-failed-advice": "Der Grund dass mpv nicht gestartet werden kann, kann an der Verwendung nicht unterstützter Befehlszeilenargumente oder einer nicht unterstützten Version von mpv liegen.",
"player-file-open-error": "Fehler beim Öffnen der Datei durch den Player", "player-file-open-error": "Fehler beim Öffnen der Datei durch den Player",
"player-path-error": "Ungültiger Player-Pfad. Unterstützte Player sind: mpv, mpv.net, VLC, MPC-HC, MPC-BE, mplayer2 und IINA", "player-path-error": "Ungültiger Player-Pfad. Unterstützte Player sind: mpv, mpv.net, VLC, MPC-HC, MPC-BE, mplayer2 und IINA",
"hostname-empty-error": "Hostname darf nicht leer sein", "hostname-empty-error": "Hostname darf nicht leer sein",
"empty-error": "{} darf nicht leer sein", # Configuration "empty-error": "{} darf nicht leer sein", # Configuration
"media-player-error": "Player-Fehler: \"{}\"", # Error line "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", "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", "arguments-missing-error": "Notwendige Argumente fehlen, siehe --help",
@ -205,7 +205,7 @@ de = {
"name-label": "Benutzername (optional):", "name-label": "Benutzername (optional):",
"password-label": "Server-Passwort (falls nötig):", "password-label": "Server-Passwort (falls nötig):",
"room-label": "Standard-Raum:", "room-label": "Standard-Raum:",
"roomlist-msgbox-label": "Edit room list (one per line)", # TODO: Translate "roomlist-msgbox-label": "Bearbeite Raum Liste (eins pro Linie)",
"media-setting-title": "Media-Player Einstellungen", "media-setting-title": "Media-Player Einstellungen",
"executable-path-label": "Pfad zum Media-Player:", "executable-path-label": "Pfad zum Media-Player:",
@ -348,8 +348,8 @@ de = {
"startTLS-initiated": "Sichere Verbindung wird versucht", "startTLS-initiated": "Sichere Verbindung wird versucht",
"startTLS-secure-connection-ok": "Sichere Verbindung hergestellt ({})", "startTLS-secure-connection-ok": "Sichere Verbindung hergestellt ({})",
"startTLS-server-certificate-invalid": 'Sichere Verbindung fehlgeschlagen. Der Server benutzt ein ungültiges Sicherheitszertifikat. Der Kanal könnte von Dritten abgehört werden. Für weitere Details und Problemlösung siehe <a href="https://syncplay.pl/trouble">hier</a> [Englisch].', "startTLS-server-certificate-invalid": 'Sichere Verbindung fehlgeschlagen. Der Server benutzt ein ungültiges Sicherheitszertifikat. Der Kanal könnte von Dritten abgehört werden. Für weitere Details und Problemlösung siehe <a href="https://syncplay.pl/trouble">hier</a> [Englisch].',
"startTLS-server-certificate-invalid-DNS-ID": "Syncplay does not trust this server because it uses a certificate that is not valid for its hostname.", # TODO: Translate "startTLS-server-certificate-invalid-DNS-ID": "Syncplay vertraut diesem Server nicht, da er ein Zertifikat verwendet, das für seinen Hostnamen ungültig ist.",
"startTLS-not-supported-client": "Dieser Server unterstützt kein TLS", "startTLS-not-supported-client": "Dieser Client unterstützt kein TLS",
"startTLS-not-supported-server": "Dieser Server unterstützt kein TLS", "startTLS-not-supported-server": "Dieser Server unterstützt kein TLS",
# TLS certificate dialog # TLS certificate dialog
@ -396,7 +396,7 @@ de = {
"password-tooltip": "Passwörter sind nur bei Verbindung zu privaten Servern nötig.", "password-tooltip": "Passwörter sind nur bei Verbindung zu privaten Servern nötig.",
"room-tooltip": "Der Raum, der betreten werden soll, kann ein x-beliebiger sein. Allerdings werden nur Clients im selben Raum synchronisiert.", "room-tooltip": "Der Raum, der betreten werden soll, kann ein x-beliebiger sein. Allerdings werden nur Clients im selben Raum synchronisiert.",
"edit-rooms-tooltip": "Edit room list.", # TO DO: Translate "edit-rooms-tooltip": "Bearbeite Raum Liste.",
"executable-path-tooltip": "Pfad zum ausgewählten, unterstützten Mediaplayer (mpv, mpv.net, VLC, MPC-HC/BE, mplayer2, oder IINA).", "executable-path-tooltip": "Pfad zum ausgewählten, unterstützten Mediaplayer (mpv, mpv.net, VLC, MPC-HC/BE, mplayer2, oder IINA).",
"media-path-tooltip": "Pfad zum wiederzugebenden Video oder Stream. Notwendig für mplayer2.", "media-path-tooltip": "Pfad zum wiederzugebenden Video oder Stream. Notwendig für mplayer2.",
@ -540,6 +540,6 @@ de = {
"playlist-instruction-item-message": "Zieh eine Datei hierher, um sie zur geteilten Playlist hinzuzufügen.", "playlist-instruction-item-message": "Zieh eine Datei hierher, um sie zur geteilten Playlist hinzuzufügen.",
"sharedplaylistenabled-tooltip": "Raumleiter können Dateien zu einer geteilten Playlist hinzufügen und es so erleichtern, gemeinsam das Gleiche zu gucken. Konfiguriere Medienverzeichnisse unter „Diverse“", "sharedplaylistenabled-tooltip": "Raumleiter können Dateien zu einer geteilten Playlist hinzufügen und es so erleichtern, gemeinsam das Gleiche zu gucken. Konfiguriere Medienverzeichnisse unter „Diverse“",
"playlist-empty-error": "Playlist is currently empty.", # TO DO: Translate "playlist-empty-error": "Wiedergabeliste is aktuell leer.",
"playlist-invalid-index-error": "Invalid playlist index", # TO DO: Translate "playlist-invalid-index-error": "Ungültiger Wiedergabelisten-Index",
} }

View File

@ -133,7 +133,7 @@ en = {
"hostname-empty-error": "Hostname can't be empty", "hostname-empty-error": "Hostname can't be empty",
"empty-error": "{} can't be empty", # Configuration "empty-error": "{} can't be empty", # Configuration
"media-player-error": "Media player error: \"{}\"", # Error line "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.", "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", "arguments-missing-error": "Some necessary arguments are missing, refer to --help",

View File

@ -136,7 +136,7 @@ eo = {
"hostname-empty-error": "Nomo de gastiga komputilo ne povas esti malplena", "hostname-empty-error": "Nomo de gastiga komputilo ne povas esti malplena",
"empty-error": "{} ne povas esti malplena", # Configuration "empty-error": "{} ne povas esti malplena", # Configuration
"media-player-error": "Eraro de vidaŭdaĵa ludilo: \"{}\"", # Error line "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.", "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", "arguments-missing-error": "Iuj bezonataj parametroj mankas; vidu al --help",

View File

@ -133,7 +133,7 @@ es = {
"hostname-empty-error": "El nombre del host no puede ser vacío", "hostname-empty-error": "El nombre del host no puede ser vacío",
"empty-error": "{} no puede ser vacío", # Configuration "empty-error": "{} no puede ser vacío", # Configuration
"media-player-error": "Error del reproductor multimedia: \"{}\"", # Error line "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.", "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", "arguments-missing-error": "Están faltando algunos argumentos necesarios. Por favor revisa --help",

View File

@ -133,7 +133,7 @@ fi = {
"hostname-empty-error": "Palvelinnimi ei voi olla tyhjä", "hostname-empty-error": "Palvelinnimi ei voi olla tyhjä",
"empty-error": "{} ei voi jättää tyhjäksi", # Configuration "empty-error": "{} ei voi jättää tyhjäksi", # Configuration
"media-player-error": "Mediasoitin kohtasi virheen: \"{}\"", # Error line "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.", "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", "arguments-missing-error": "Joitakin vipuja uupuu, katso apua --help",

View File

@ -133,7 +133,7 @@ fr = {
"hostname-empty-error": "Le nom d'hôte ne peut pas être vide", "hostname-empty-error": "Le nom d'hôte ne peut pas être vide",
"empty-error": "{} ne peut pas être vide", # Configuration "empty-error": "{} ne peut pas être vide", # Configuration
"media-player-error": "Media player error: \"{}\"", # Error line "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.", "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", "arguments-missing-error": "Certains arguments nécessaires sont manquants, reportez-vous à --help",

View File

@ -133,7 +133,7 @@ it = {
"hostname-empty-error": "Il campo hostname non può essere vuoto", "hostname-empty-error": "Il campo hostname non può essere vuoto",
"empty-error": "Il campo {} non può esssere vuoto", # Configuration "empty-error": "Il campo {} non può esssere vuoto", # Configuration
"media-player-error": "Errore media player: \"{}\"", # Error line "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.", "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", "arguments-missing-error": "Alcuni argomenti obbligatori non sono stati trovati. Fai riferimento a --help",

View File

@ -133,7 +133,7 @@ ko = {
"hostname-empty-error": "호스트이름은 비워둘 수 없습니다", "hostname-empty-error": "호스트이름은 비워둘 수 없습니다",
"empty-error": "{}은(는) 비워 둘 수 없습니다", # Configuration "empty-error": "{}은(는) 비워 둘 수 없습니다", # Configuration
"media-player-error": "미디어 플레이어 오류: \"{}\"", # Error line "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 이상을 설치하세요.", "unable-import-twisted-error": "Twisted를 가져올 수 없습니다. Twisted v16.4.0 이상을 설치하세요.",
"arguments-missing-error": "일부 필요한 인수가 누락되었습니다. --help를 참조하세요.", "arguments-missing-error": "일부 필요한 인수가 누락되었습니다. --help를 참조하세요.",

View File

@ -134,7 +134,7 @@ pt_BR = {
"hostname-empty-error": "O endereço do servidor não pode estar vazio", "hostname-empty-error": "O endereço do servidor não pode estar vazio",
"empty-error": "{} não pode estar vazio", # Configuration "empty-error": "{} não pode estar vazio", # Configuration
"media-player-error": "Erro do reprodutor de mídia: \"{}\"", # Error line "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.", "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", "arguments-missing-error": "Alguns argumentos necessários estão faltando, por favor reveja --help",

View File

@ -133,7 +133,7 @@ pt_PT = {
"hostname-empty-error": "O endereço do servidor não pode ser vazio", "hostname-empty-error": "O endereço do servidor não pode ser vazio",
"empty-error": "{} não pode ser vazio", # Configuration "empty-error": "{} não pode ser vazio", # Configuration
"media-player-error": "Erro do reprodutor de mídia: \"{}\"", # Error line "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.", "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", "arguments-missing-error": "Alguns argumentos necessários estão faltando, por favor reveja --help",

View File

@ -132,7 +132,7 @@ ru = {
"hostname-empty-error": "Имя пользователя не может быть пустым.", "hostname-empty-error": "Имя пользователя не может быть пустым.",
"empty-error": "{} не может быть пустым.", # Configuration "empty-error": "{} не может быть пустым.", # Configuration
"media-player-error": "Ошибка проигрывателя: \"{}\"", # Error line "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 или более позднюю версию.", "unable-import-twisted-error": "Невозможно импортировать Twisted. Установите Twisted 16.4.0 или более позднюю версию.",
"arguments-missing-error": "Некоторые необходимые аргументы отсутствуют, обратитесь к --help", "arguments-missing-error": "Некоторые необходимые аргументы отсутствуют, обратитесь к --help",

View File

@ -133,7 +133,7 @@ tr = {
"hostname-empty-error": "Ana bilgisayar adı boş olamaz", "hostname-empty-error": "Ana bilgisayar adı boş olamaz",
"empty-error": "{} boş olamaz", # Configuration "empty-error": "{} boş olamaz", # Configuration
"media-player-error": "Medaya oynatıcısı hatası: \"{}\"", # Error line "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ı. PySide kurulu değilse, GUI'nin çalışması için kurmanız gerekecektir. 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çe aktarılamadı. Lütfen Twisted v16.4.0 veya sonraki sürümünü yükleyin.", "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", "arguments-missing-error": "Bazı gerekli argümanlar eksik, bakınız --help",

View File

@ -133,7 +133,7 @@ zh_CN = {
"hostname-empty-error": "主机名不能是空的", "hostname-empty-error": "主机名不能是空的",
"empty-error": "{}不能是空的", # Configuration "empty-error": "{}不能是空的", # Configuration
"media-player-error": "媒体播放器错误:\"{}\"", # Error line "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或更高版本。", "unable-import-twisted-error": "无法导入Twisted。请安装Twisted v16.4.0或更高版本。",
"arguments-missing-error": "缺少一些必要的参数,使用--help命令查看详细信息", "arguments-missing-error": "缺少一些必要的参数,使用--help命令查看详细信息",

View File

@ -283,6 +283,7 @@ class MpcHcApi:
pCDS = ctypes.cast(lparam, self.__PCOPYDATASTRUCT) pCDS = ctypes.cast(lparam, self.__PCOPYDATASTRUCT)
# print "API:\tin>\t 0x%X\t" % int(pCDS.contents.dwData), ctypes.wstring_at(pCDS.contents.lpData) # print "API:\tin>\t 0x%X\t" % int(pCDS.contents.dwData), ctypes.wstring_at(pCDS.contents.lpData)
self.__mpcApi.handleCommand(pCDS.contents.dwData, ctypes.wstring_at(pCDS.contents.lpData)) self.__mpcApi.handleCommand(pCDS.contents.dwData, ctypes.wstring_at(pCDS.contents.lpData))
return 0
def SendCommand(self, cmd, message=''): def SendCommand(self, cmd, message=''):
# print "API:\t<out\t 0x%X\t" % int(cmd), message # print "API:\t<out\t 0x%X\t" % int(cmd), message
@ -406,7 +407,7 @@ class MPCHCAPIPlayer(BasePlayer):
def openFile(self, filePath, resetPosition=False): def openFile(self, filePath, resetPosition=False):
self._mpcApi.openFile(filePath) self._mpcApi.openFile(filePath)
if resetPosition: if resetPosition and self._mpcApi.filePlaying:
self.setPosition(0, resetPosition=True) self.setPosition(0, resetPosition=True)
def displayMessage( def displayMessage(

View File

@ -1,5 +1,6 @@
# coding:utf8 # coding:utf8
import os import os
import random
import re import re
import sys import sys
import time import time
@ -10,7 +11,7 @@ import ast
from syncplay import constants from syncplay import constants
from syncplay.messages import getMessage from syncplay.messages import getMessage
from syncplay.players.basePlayer import BasePlayer 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 isMacOS, isWindows, isASCII
from syncplay.utils import playerPathExists from syncplay.utils import playerPathExists
from syncplay.vendor.python_mpv_jsonipc.python_mpv_jsonipc import MPV from syncplay.vendor.python_mpv_jsonipc.python_mpv_jsonipc import MPV
@ -376,7 +377,7 @@ class MpvPlayer(BasePlayer):
self._listener.sendLine(['loadfile', filePath], notReadyAfterThis=True) self._listener.sendLine(['loadfile', filePath], notReadyAfterThis=True)
def setFeatures(self, featureList): def setFeatures(self, featureList):
self.sendMpvOptions() self._sendMpvOptions()
def setPosition(self, value): def setPosition(self, value):
if value < constants.DO_NOT_RESET_POSITION_THRESHOLD and self._recentlyReset(): if value < constants.DO_NOT_RESET_POSITION_THRESHOLD and self._recentlyReset():
@ -409,7 +410,7 @@ class MpvPlayer(BasePlayer):
self._storePosition(0) self._storePosition(0)
# TO TRY: self._listener.setReadyToSend(False) # TO TRY: self._listener.setReadyToSend(False)
def sendMpvOptions(self): def _sendMpvOptions(self):
options = [] options = []
for option in constants.MPV_SYNCPLAYINTF_OPTIONS_TO_SEND: for option in constants.MPV_SYNCPLAYINTF_OPTIONS_TO_SEND:
options.append("{}={}".format(option, self._client._config[option])) options.append("{}={}".format(option, self._client._config[option]))
@ -421,6 +422,9 @@ class MpvPlayer(BasePlayer):
options_string = ", ".join(options) options_string = ", ".join(options)
self._listener.sendLine(["script-message-to", "syncplayintf", "set_syncplayintf_options", options_string]) self._listener.sendLine(["script-message-to", "syncplayintf", "set_syncplayintf_options", options_string])
self._setOSDPosition() 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): def _handleUnknownLine(self, line):
self.mpvErrorCheck(line) self.mpvErrorCheck(line)
@ -448,7 +452,7 @@ class MpvPlayer(BasePlayer):
#self._client.ui.showDebugMessage("{} = {} / {}".format(update_string, paused_update, position_update)) #self._client.ui.showDebugMessage("{} = {} / {}".format(update_string, paused_update, position_update))
if "<get_syncplayintf_options>" in line: if "<get_syncplayintf_options>" in line:
self.sendMpvOptions() self._sendMpvOptions()
if line == "<SyncplayUpdateFile>" or "Playing:" in line: if line == "<SyncplayUpdateFile>" or "Playing:" in line:
self._client.ui.showDebugMessage("Not ready to send due to <SyncplayUpdateFile>") self._client.ui.showDebugMessage("Not ready to send due to <SyncplayUpdateFile>")
@ -619,8 +623,15 @@ class MpvPlayer(BasePlayer):
env['PATH'] = python_executable + ':' + env['PATH'] env['PATH'] = python_executable + ':' + env['PATH']
env['PYTHONPATH'] = pythonPath env['PYTHONPATH'] = pythonPath
try: try:
socket = self.mpv_arguments.get('input-ipc-server') self.mpvpipe = self.playerIPCHandler(
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) 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: except Exception as e:
self.quitReason = getMessage("media-player-error").format(str(e)) + " " + getMessage("mpv-failed-advice") 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) self.__playerController.reactor.callFromThread(self.__playerController._client.ui.showErrorMessage, self.quitReason, True)
@ -629,6 +640,12 @@ class MpvPlayer(BasePlayer):
#self.mpvpipe.show_text("HELLO WORLD!", 1000) #self.mpvpipe.show_text("HELLO WORLD!", 1000)
threading.Thread.__init__(self, name="MPV Listener") 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): def __getCwd(self, filePath, env):
if not filePath: if not filePath:
return None return None

View File

@ -50,3 +50,4 @@ class MpvnetPlayer(MpvPlayer):
def getIconPath(path): def getIconPath(path):
return constants.MPVNET_ICONPATH return constants.MPVNET_ICONPATH

View File

@ -487,10 +487,14 @@ class VlcPlayer(BasePlayer):
call.extend(self.__playerController.SLAVE_ARGS) call.extend(self.__playerController.SLAVE_ARGS)
if args: if args:
call.extend(args) for arg in args:
if "=" in arg and "\"" in arg:
(argName, argValue) = arg.split("=", 1)
if argValue.startswith("\"") and argValue.endswith("\""):
arg = argName + "=" + argValue[1:-1]
call.extend([arg])
self._vlcVersion = None self._vlcVersion = None
if isWindows() and getattr(sys, 'frozen', '') and getattr(sys, '_MEIPASS', '') is not None: # Needed for pyinstaller --onefile bundle if isWindows() and getattr(sys, 'frozen', '') and getattr(sys, '_MEIPASS', '') is not None: # Needed for pyinstaller --onefile bundle
self.__process = subprocess.Popen( self.__process = subprocess.Popen(
call, stdin=subprocess.PIPE, stderr=subprocess.PIPE, stdout=subprocess.PIPE, call, stdin=subprocess.PIPE, stderr=subprocess.PIPE, stdout=subprocess.PIPE,

View File

@ -520,7 +520,7 @@ class ConfigurationGetter(object):
from syncplay.vendor.Qt.QtCore import QCoreApplication from syncplay.vendor.Qt.QtCore import QCoreApplication
from syncplay.vendor import qt5reactor from syncplay.vendor import qt5reactor
if not (IsPySide6 or IsPySide2 or IsPySide): if not (IsPySide6 or IsPySide2 or IsPySide):
raise ImportError raise ImportError("Failed to identify compatible version of PySide.")
if QCoreApplication.instance() is None: if QCoreApplication.instance() is None:
self.app = QtWidgets.QApplication(sys.argv) self.app = QtWidgets.QApplication(sys.argv)
self.app.setDesktopFileName("syncplay") self.app.setDesktopFileName("syncplay")
@ -537,13 +537,14 @@ class ConfigurationGetter(object):
if isMacOS(): if isMacOS():
import appnope import appnope
appnope.nope() appnope.nope()
except ImportError: except ImportError as e:
try: try:
from twisted.trial import unittest from twisted.trial import unittest
except Exception as e: except Exception as ee:
print(e) print(ee)
print(getMessage("unable-import-twisted-error")) print(getMessage("unable-import-twisted-error"))
sys.exit() sys.exit()
print(e)
print(getMessage("unable-import-gui-error")) print(getMessage("unable-import-gui-error"))
self._config['noGui'] = True self._config['noGui'] = True
if self._config['file'] and self._config['file'][:2] == "--": if self._config['file'] and self._config['file'][:2] == "--":

View File

@ -279,7 +279,7 @@ class ConfigDialog(QtWidgets.QDialog):
currentplayerpath = self.executablepathCombobox.currentText() currentplayerpath = self.executablepathCombobox.currentText()
if currentplayerpath: if currentplayerpath:
NewPlayerArgs = self.playerargsTextbox.text().split(" ") if self.playerargsTextbox.text() else "" NewPlayerArgs = utils.parseCommandLineString(self.playerargsTextbox.text()) if self.playerargsTextbox.text() else ""
self.perPlayerArgs[self.executablepathCombobox.currentText()] = NewPlayerArgs self.perPlayerArgs[self.executablepathCombobox.currentText()] = NewPlayerArgs
def languageChanged(self): def languageChanged(self):

View File

@ -9,7 +9,7 @@ if "QT_PREFERRED_BINDING" not in os.environ:
if not isWindowsConsole(): if not isWindowsConsole():
try: try:
from syncplay.ui.gui import MainWindow as GraphicalUI from syncplay.ui.gui import MainWindow as GraphicalUI
except ImportError: except (ImportError, AttributeError) as e:
pass pass
from syncplay.ui.consoleUI import ConsoleUI from syncplay.ui.consoleUI import ConsoleUI

View File

@ -1,5 +1,5 @@
import ast import ast
import atexit
import datetime import datetime
import hashlib import hashlib
import itertools import itertools
@ -10,11 +10,13 @@ import re
import string import string
import subprocess import subprocess
import sys import sys
import tempfile
import time import time
import traceback import traceback
import urllib.error import urllib.error
import urllib.parse import urllib.parse
import urllib.request import urllib.request
from pathlib import Path
from syncplay import constants from syncplay import constants
from syncplay.messages import getMessage from syncplay.messages import getMessage
@ -37,9 +39,28 @@ def isMacOS():
def isBSD(): def isBSD():
return constants.OS_BSD in sys.platform or sys.platform.startswith(constants.OS_DRAGONFLY) return constants.OS_BSD in sys.platform or sys.platform.startswith(constants.OS_DRAGONFLY)
def isWindowsConsole(): def isWindowsConsole():
return os.path.basename(sys.executable) == "SyncplayConsole.exe" 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): def retry(ExceptionToCheck, tries=4, delay=3, backoff=2, logger=None):
"""Retry calling the decorated function using an exponential backoff. """Retry calling the decorated function using an exponential backoff.
@ -191,6 +212,10 @@ def limitedPowerset(s, minLength):
return itertools.chain.from_iterable(itertools.combinations(s, r) for r in range(len(s), minLength, -1)) return itertools.chain.from_iterable(itertools.combinations(s, r) for r in range(len(s), minLength, -1))
def parseCommandLineString(s):
arsToReturn = re.findall(constants.ARGUMENT_SPLIT_REGEX, s)
return arsToReturn
def blackholeStdoutForFrozenWindow(): def blackholeStdoutForFrozenWindow():
if getattr(sys, 'frozen', '') == "windows_exe": if getattr(sys, 'frozen', '') == "windows_exe":
class Stderr(object): class Stderr(object):
@ -207,7 +232,8 @@ def blackholeStdoutForFrozenWindow():
self._file = open(path, 'a', encoding='utf-8') self._file = open(path, 'a', encoding='utf-8')
# TODO: Handle errors. # TODO: Handle errors.
if self._file is not None: 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() self._file.flush()
def flush(self): def flush(self):
@ -301,7 +327,7 @@ def stripfilename(filename, stripURL):
def stripRoomName(RoomName): def stripRoomName(RoomName):
if RoomName: if RoomName:
try: 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: except IndexError:
return RoomName return RoomName
else: else:
@ -479,8 +505,8 @@ def getListOfPublicServers():
class RoomPasswordProvider(object): class RoomPasswordProvider(object):
CONTROLLED_ROOM_REGEX = re.compile("^\+(.*):(\w{12})$") CONTROLLED_ROOM_REGEX = re.compile(r"^\+(.*):(\w{12})$")
PASSWORD_REGEX = re.compile("[A-Z]{2}-\d{3}-\d{3}") PASSWORD_REGEX = re.compile(r"[A-Z]{2}-\d{3}-\d{3}")
@staticmethod @staticmethod
def isControlledRoom(roomName): def isControlledRoom(roomName):