diff --git a/.appveyor.yml b/.appveyor.yml index a505d46..87132ef 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -29,7 +29,6 @@ install: - for /F "tokens=2 delims='" %%a in ('findstr version syncplay\__init__.py') do @set ver=%%a - python buildPy2exe.py - type nul > syncplay_v%ver%\syncplay.ini - - copy resources\win_lua_note.txt syncplay_v%ver%\"VLC LUA Script installation.txt" # Not a project with an msbuild file, build done at install. build: off diff --git a/.travis.yml b/.travis.yml index 3d5857f..5acd051 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: objective-c -osx_image: xcode7.3 +osx_image: xcode8.3 branches: only: @@ -10,18 +10,12 @@ script: before_install: - brew update -- cd $(brew --repo homebrew/core) -#- git fetch --depth=20000 -- git checkout 80860911cd26d9df62f3cc30575ed2076019ed1a -- cd $TRAVIS_BUILD_DIR - brew upgrade python - which python3 - python3 --version - which pip3 - pip3 --version - brew install pyside -- ln -s /usr/local/lib/python3.7/site-packages/PySide2/libpyside2.cpython-37m-darwin.5.11.dylib /usr/local/lib/ -- ln -s /usr/local/lib/python3.7/site-packages/PySide2/libshiboken2.cpython-37m-darwin.5.11.dylib /usr/local/lib/ - python3 -c "from PySide2 import __version__; print(__version__)" - python3 -c "from PySide2.QtCore import __version__; print(__version__)" - pip3 install py2app @@ -33,8 +27,6 @@ install: before_deploy: - pip3 install dmgbuild - mkdir dist_dmg -- mv resources/macos_vlc_install.command resources/.macos_vlc_install.command -- mv resources/lua/intf/syncplay.lua resources/lua/intf/.syncplay.lua - mv resources/macOS_readme.pdf resources/.macOS_readme.pdf - export VER="$(cat syncplay/__init__.py | awk '/version/ {gsub("\047", "", $3); print $NF}')" - dmgbuild -s appdmg.py "Syncplay" dist_dmg/Syncplay_${VER}.dmg diff --git a/GNUmakefile b/GNUmakefile index 29842fa..6936f70 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1,9 +1,5 @@ SINGLE_USER = false -ifndef VLC_SUPPORT - VLC_SUPPORT = true -endif - ifeq ($(shell uname)),FreeBSD) BSD = true endif @@ -69,13 +65,6 @@ client: ifeq ($(SINGLE_USER),false) chmod 755 $(APP_SHORTCUT_PATH)/syncplay.desktop endif - -ifeq ($(VLC_SUPPORT),true) - -mkdir -p ${DESTDIR}$(VLC_LIB_PATH)/vlc/lua/intf/ - cp resources/lua/intf/syncplay.lua ${DESTDIR}$(VLC_LIB_PATH)/vlc/lua/intf/ - -mkdir -p ${DESTDIR}$(VLC_LIB_PATH64)/vlc/lua/intf/ - cp resources/lua/intf/syncplay.lua ${DESTDIR}$(VLC_LIB_PATH64)/vlc/lua/intf/ -endif u-client: -rm $(BIN_PATH)/syncplay diff --git a/appdmg.py b/appdmg.py index 45a3f9d..8c23084 100755 --- a/appdmg.py +++ b/appdmg.py @@ -31,15 +31,12 @@ size = defines.get('size', None) # Files to include files = [ application, - 'resources/lua/intf/.syncplay.lua', - 'resources/.macos_vlc_install.command', 'resources/.macOS_readme.pdf' ] # Symlinks to create symlinks = { 'Applications': '/Applications', - 'Install for VLC': '.macos_vlc_install.command', 'Read Me': '.macOS_readme.pdf' } @@ -54,10 +51,9 @@ badge_icon = icon_from_app(application) # Where to put the icons icon_locations = { - appname: (150, 110), - 'Applications': (450, 110), - 'Read Me': (100, 285), - 'Install for VLC': (500, 285) + appname: (90, 110), + 'Applications': (410, 110), + 'Read Me': (250, 240), } # .. Window configuration ...................................................... @@ -92,7 +88,7 @@ show_sidebar = False sidebar_width = 180 # Window position in ((x, y), (w, h)) format -window_rect = ((100, 100), (600, 460)) +window_rect = ((100, 100), (500, 400)) # Select the default view; must be one of # diff --git a/buildPy2app.py b/buildPy2app.py index 40bbe3f..8824f67 100755 --- a/buildPy2app.py +++ b/buildPy2app.py @@ -28,7 +28,7 @@ OPTIONS = { 'CFBundleName': 'Syncplay', 'CFBundleShortVersionString': syncplay.version, 'CFBundleIdentifier': 'pl.syncplay.Syncplay', - 'LSMinimumSystemVersion': '10.11.0', + 'LSMinimumSystemVersion': '10.12.0', 'NSHumanReadableCopyright': 'Copyright © 2019 Syncplay All Rights Reserved' } } diff --git a/buildPy2exe.py b/buildPy2exe.py index bbe17fe..0dfe4af 100644 --- a/buildPy2exe.py +++ b/buildPy2exe.py @@ -95,8 +95,6 @@ NSIS_SCRIPT_TEMPLATE = r""" LangString ^SyncplayLanguage $${LANG_ENGLISH} "en" LangString ^Associate $${LANG_ENGLISH} "Associate Syncplay with multimedia files." - LangString ^VLC $${LANG_ENGLISH} "Install Syncplay interface for VLC 2 and above" - LangString ^BrowseVLCBtn $${LANG_ENGLISH} "Select VLC folder" LangString ^Shortcut $${LANG_ENGLISH} "Create Shortcuts in following locations:" LangString ^StartMenu $${LANG_ENGLISH} "Start Menu" LangString ^Desktop $${LANG_ENGLISH} "Desktop" @@ -106,8 +104,6 @@ NSIS_SCRIPT_TEMPLATE = r""" LangString ^SyncplayLanguage $${LANG_POLISH} "pl" LangString ^Associate $${LANG_POLISH} "Skojarz Syncplaya z multimediami" - LangString ^VLC $${LANG_POLISH} "Zainstaluj interface Syncplaya dla VLC 2+" - LangString ^BrowseVLCBtn $${LANG_POLISH} "Określ folder VLC" LangString ^Shortcut $${LANG_POLISH} "Utworz skroty w nastepujacych miejscach:" LangString ^StartMenu $${LANG_POLISH} "Menu Start" LangString ^Desktop $${LANG_POLISH} "Pulpit" @@ -116,8 +112,6 @@ NSIS_SCRIPT_TEMPLATE = r""" LangString ^SyncplayLanguage $${LANG_RUSSIAN} "ru" LangString ^Associate $${LANG_RUSSIAN} "Ассоциировать Syncplay с видеофайлами" - LangString ^VLC $${LANG_RUSSIAN} "Установить интерфейс Syncplay для VLC 2+" - LangString ^BrowseVLCBtn $${LANG_RUSSIAN} "Укажите папку VLC" LangString ^Shortcut $${LANG_RUSSIAN} "Создать ярлыки:" LangString ^StartMenu $${LANG_RUSSIAN} "в меню Пуск" LangString ^Desktop $${LANG_RUSSIAN} "на рабочем столе" @@ -127,9 +121,7 @@ NSIS_SCRIPT_TEMPLATE = r""" LangString ^SyncplayLanguage $${LANG_GERMAN} "de" LangString ^Associate $${LANG_GERMAN} "Syncplay als Standardprogramm für Multimedia-Dateien verwenden." - LangString ^VLC $${LANG_GERMAN} "Syncplay-Interface für VLC installieren (ab VLC 2+)" LangString ^Shortcut $${LANG_GERMAN} "Erstelle Verknüpfungen an folgenden Orten:" - LangString ^BrowseVLCBtn $${LANG_GERMAN} "VLC-Ordner wählen" LangString ^StartMenu $${LANG_GERMAN} "Startmenü" LangString ^Desktop $${LANG_GERMAN} "Desktop" LangString ^QuickLaunchBar $${LANG_GERMAN} "Schnellstartleiste" @@ -138,8 +130,6 @@ NSIS_SCRIPT_TEMPLATE = r""" LangString ^SyncplayLanguage $${LANG_ITALIAN} "it" LangString ^Associate $${LANG_ITALIAN} "Associa Syncplay con i file multimediali." - LangString ^VLC $${LANG_ITALIAN} "Installa l'interfaccia di Syncplay per VLC 2+" - LangString ^BrowseVLCBtn $${LANG_ITALIAN} "Cartella di VLC" LangString ^Shortcut $${LANG_ITALIAN} "Crea i collegamenti nei percorsi seguenti:" LangString ^StartMenu $${LANG_ITALIAN} "Menu Start" LangString ^Desktop $${LANG_ITALIAN} "Desktop" @@ -163,19 +153,16 @@ NSIS_SCRIPT_TEMPLATE = r""" Var Icon_Syncplay Var Icon_Syncplay_Handle ;Var CheckBox_Associate - Var CheckBox_VLC Var CheckBox_AutomaticUpdates Var CheckBox_StartMenuShortcut Var CheckBox_DesktopShortcut Var CheckBox_QuickLaunchShortcut ;Var CheckBox_Associate_State - Var CheckBox_VLC_State Var CheckBox_AutomaticUpdates_State Var CheckBox_StartMenuShortcut_State Var CheckBox_DesktopShortcut_State Var CheckBox_QuickLaunchShortcut_State Var Button_Browse - Var Button_Browse_VLC Var Directory Var GroupBox_DirSub Var Label_Text @@ -234,8 +221,6 @@ NSIS_SCRIPT_TEMPLATE = r""" ;StrCpy $$CheckBox_Associate_State $${BST_CHECKED} StrCpy $$CheckBox_StartMenuShortcut_State $${BST_CHECKED} - Call GetVLCDir - Call UpdateVLCCheckbox Call GetSize Call DriveSpace @@ -297,38 +282,26 @@ NSIS_SCRIPT_TEMPLATE = r""" ;$${NSD_CreateCheckBox} 8u 59u 187u 10u "$$(^Associate)" ;Pop $$CheckBox_Associate - $${NSD_CreateBrowseButton} 185u 70u 70u 14u "$$(^BrowseVLCBtn)" - Pop $$Button_Browse_VLC - $${NSD_OnClick} $$Button_Browse_VLC DirectoryBrowseDialogVLC - - $${NSD_CreateCheckBox} 8u 72u 250u 10u "$$(^VLC)" - Pop $$CheckBox_VLC - - $${NSD_CreateCheckBox} 8u 85u 250u 10u "$$(^AutomaticUpdates)" + $${NSD_CreateCheckBox} 8u 72u 250u 10u "$$(^AutomaticUpdates)" Pop $$CheckBox_AutomaticUpdates $${NSD_Check} $$CheckBox_AutomaticUpdates - $${NSD_CreateLabel} 8u 98u 187u 10u "$$(^Shortcut)" + $${NSD_CreateLabel} 8u 95u 187u 10u "$$(^Shortcut)" Pop $$Label_Shortcut - $${NSD_CreateCheckbox} 8u 111u 60u 10u "$$(^StartMenu)" + $${NSD_CreateCheckbox} 8u 105u 60u 10u "$$(^StartMenu)" Pop $$CheckBox_StartMenuShortcut - $${NSD_CreateCheckbox} 78u 111u 70u 10u "$$(^Desktop)" + $${NSD_CreateCheckbox} 78u 105u 70u 10u "$$(^Desktop)" Pop $$CheckBox_DesktopShortcut - $${NSD_CreateCheckbox} 158u 111u 130u 10u "$$(^QuickLaunchBar)" + $${NSD_CreateCheckbox} 158u 105u 130u 10u "$$(^QuickLaunchBar)" Pop $$CheckBox_QuickLaunchShortcut ;$${If} $$CheckBox_Associate_State == $${BST_CHECKED} ; $${NSD_Check} $$CheckBox_Associate ;$${EndIf} - $${If} $$CheckBox_VLC_State == $${BST_CHECKED} - $${NSD_Check} $$CheckBox_VLC - $${EndIf} - - Call UpdateVLCCheckbox $${If} $$CheckBox_StartMenuShortcut_State == $${BST_CHECKED} $${NSD_Check} $$CheckBox_StartMenuShortcut @@ -355,7 +328,6 @@ NSIS_SCRIPT_TEMPLATE = r""" Function DirectoryCustomLeave $${NSD_GetText} $$Text_Directory $$INSTDIR ;$${NSD_GetState} $$CheckBox_Associate $$CheckBox_Associate_State - $${NSD_GetState} $$CheckBox_VLC $$CheckBox_VLC_State $${NSD_GetState} $$CheckBox_AutomaticUpdates $$CheckBox_AutomaticUpdates_State $${NSD_GetState} $$CheckBox_StartMenuShortcut $$CheckBox_StartMenuShortcut_State $${NSD_GetState} $$CheckBox_DesktopShortcut $$CheckBox_DesktopShortcut_State @@ -374,47 +346,6 @@ NSIS_SCRIPT_TEMPLATE = r""" Abort FunctionEnd - Function GetVLCDir - IfFileExists "$$VLC_Directory\vlc.exe" VLCFound 0 - ReadRegStr $$VLC_Directory HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Syncplay" "VLCInstallLocation" - IfFileExists "$$VLC_Directory\vlc.exe" VLCFound 0 - ReadRegStr $$VLC_Directory HKLM "Software\VideoLAN\VLC" "InstallDir" - IfFileExists "$$VLC_Directory\vlc.exe" VLCFound 0 - StrCpy $$VLC_Directory "c:\program files (x86)\videolan\vlc" - IfFileExists "$$VLC_Directory\vlc.exe" VLCFound 0 - StrCpy $$VLC_Directory "c:\program files\videolan\vlc" - IfFileExists "$$VLC_Directory\vlc.exe" VLCFound 0 - StrCpy $$VLC_Directory "" - VLCFound: - FunctionEnd - - Function UpdateVLCCheckbox - IfFileExists "$$VLC_Directory\vlc.exe" VLC_Enabled VLC_Disabled - - VLC_Enabled: - EnableWindow $$CheckBox_VLC 1 - StrCpy $$CheckBox_VLC_State $${BST_CHECKED} - $${NSD_SetState} $$CheckBox_VLC $$CheckBox_VLC_State - goto CheckboxUpdated - - VLC_Disabled: - EnableWindow $$CheckBox_VLC 0 - StrCpy $$CheckBox_VLC_State $${BST_UNCHECKED} - $${NSD_SetState} $$CheckBox_VLC $$CheckBox_VLC_State - - CheckboxUpdated: - FunctionEnd - - Function DirectoryBrowseDialogVLC - nsDialogs::SelectFolderDialog $$(^BrowseVLCBtn) $$VLC_Directory - Pop $$Directory - $${If} $$Directory != error - StrCpy $$VLC_Directory $$Directory - Call UpdateVLCCheckbox - $${EndIf} - Abort - FunctionEnd - Function GetSize StrCpy $$Size "$totalSize" IntOp $$Size $$Size / 1024 @@ -452,13 +383,6 @@ NSIS_SCRIPT_TEMPLATE = r""" $${If} $$CheckBox_QuickLaunchShortcut_State == $${BST_CHECKED} CreateShortCut "$$QUICKLAUNCH\Syncplay.lnk" "$$INSTDIR\Syncplay.exe" "" $${EndIf} - - $${If} $$CheckBox_VLC_State == $${BST_CHECKED} - IfFileExists "$$VLC_Directory\vlc.exe" 0 EndOfVLC - SetOutPath $$VLC_Directory\lua\intf - File resources\lua\intf\syncplay.lua - EndOfVLC: - $${EndIf} FunctionEnd ;Associates extensions with Syncplay @@ -494,7 +418,6 @@ NSIS_SCRIPT_TEMPLATE = r""" WriteRegStr HKLM SOFTWARE\Syncplay "Install_Dir" "$$INSTDIR" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Syncplay" "DisplayName" "Syncplay" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Syncplay" "InstallLocation" "$$INSTDIR" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Syncplay" "VLCInstallLocation" "$$VLC_Directory" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Syncplay" "UninstallString" '"$$INSTDIR\uninstall.exe"' WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Syncplay" "DisplayIcon" "$$INSTDIR\resources\icon.ico" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Syncplay" "Publisher" "Syncplay" diff --git a/resources/lua/intf/syncplay.lua b/resources/lua/intf/syncplay.lua index 44e8828..54ce65f 100644 --- a/resources/lua/intf/syncplay.lua +++ b/resources/lua/intf/syncplay.lua @@ -5,7 +5,7 @@ Principal author: Etoh Other contributors: DerGenaue, jb, Pilotat Project: https://syncplay.pl/ - Version: 0.3.4 + Version: 0.3.5 Note: * This interface module is intended to be used in conjunction with Syncplay. @@ -17,13 +17,7 @@ === Installation instructions === -Place the syncplay.lua file in the main (all user) VLC /lua/intf/ sub-directory: -* Window: %ProgramFiles%\VideoLAN\VLC\lua\intf\ -* Linux: /usr/lib/vlc/lua/intf/ or /usr/lib64/vlc/lua/intf/ or /usr/lib/x86_64-linux-gnu/vlc/lua/intf on some systems (look for where the .luac files are) -* Mac OS X: /Applications/VLC.app/Contents/MacOS/share/lua/intf/ -* FreeBSD, OpenBSD etc.: /usr/local/lib/vlc/lua/intf/ - -You may also need to re-copy the syncplay.lua file when you update VLC. +Syncplay should install this automatically to your user folder. === Commands and responses === = Note: ? denotes optional responses; * denotes mandatory response; uses \n terminator. @@ -84,7 +78,7 @@ You may also need to re-copy the syncplay.lua file when you update VLC. --]==========================================================================] -local connectorversion = "0.3.4" +local connectorversion = "0.3.5" local vlcversion = vlc.misc.version() local vlcmajorversion = tonumber(vlcversion:sub(1,1)) -- get the major version of VLC local durationdelay = 500000 -- Pause for get_duration command etc for increased reliability (uses microseconds) diff --git a/resources/macOS_dmg_bkg.tiff b/resources/macOS_dmg_bkg.tiff index 9ead2f6..3c29b25 100644 Binary files a/resources/macOS_dmg_bkg.tiff and b/resources/macOS_dmg_bkg.tiff differ diff --git a/resources/macOS_readme.pdf b/resources/macOS_readme.pdf index f18c6db..bf726fd 100644 Binary files a/resources/macOS_readme.pdf and b/resources/macOS_readme.pdf differ diff --git a/resources/macos_vlc_install.command b/resources/macos_vlc_install.command deleted file mode 100755 index 4774144..0000000 --- a/resources/macos_vlc_install.command +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -mkdir -p $HOME/Library/Application\ Support/org.videolan.vlc/lua/intf/ - -cp /Volumes/Syncplay/.syncplay.lua $HOME/Library/Application\ Support/org.videolan.vlc/lua/intf/syncplay.lua diff --git a/resources/win_lua_note.txt b/resources/win_lua_note.txt deleted file mode 100755 index 66835d8..0000000 --- a/resources/win_lua_note.txt +++ /dev/null @@ -1,6 +0,0 @@ -You must follow the following instructions to use Syncplay with VLC: - -Place the syncplay.lua file from /resources/lua/intf/ into the main (all user) VLC /lua/intf/ sub-directory: -* Window: %ProgramFiles%\VideoLAN\VLC\lua\intf\ - -Note: A version of these instructions is also available from http://syncplay.pl/LUA \ No newline at end of file diff --git a/syncplay/constants.py b/syncplay/constants.py index 76fdd17..babe85d 100755 --- a/syncplay/constants.py +++ b/syncplay/constants.py @@ -102,7 +102,7 @@ COMMANDS_TOGGLE = ['t', 'toggle'] MPC_MIN_VER = "1.6.4" MPC_BE_MIN_VER = "1.5.2.3123" VLC_MIN_VERSION = "2.2.1" -VLC_INTERFACE_MIN_VERSION = "0.3.4" +VLC_INTERFACE_VERSION = "0.3.5" VLC_LATENCY_ERROR_THRESHOLD = 2.0 MPV_UNRESPONSIVE_THRESHOLD = 60.0 CONTROLLED_ROOMS_MIN_VERSION = "1.3.0" diff --git a/syncplay/messages_de.py b/syncplay/messages_de.py index 9c3c235..fc09489 100755 --- a/syncplay/messages_de.py +++ b/syncplay/messages_de.py @@ -94,9 +94,6 @@ de = { "language-changed-msgbox-label": "Die Sprache wird geändert, wenn du Syncplay neu startest.", "promptforupdate-label": "Soll Syncplay regelmäßig nach Updates suchen?", - "vlc-interface-version-mismatch": "Du nutzt Version {} des VLC-Syncplay Interface-Moduls, Syncplay benötigt aber mindestens Version {}. In der Syncplay-Anleitung unter https://syncplay.pl/guide/ [Englisch] findest du Details zur Installation des syncplay.lua-Skripts.", # VLC interface version, VLC interface min version - "vlc-interface-oldversion-warning": "Warnung: Es ist eine alte Version des Syncplay Interface-Moduls für VLC im VLC-Verzeichnis installiert. In der Syncplay-Anleitung unter https://syncplay.pl/guide/ [Englisch] findest du Details zur Installation des syncplay.lua-Skripts.", - "vlc-interface-not-installed": "Warnung: Es wurde kein Syncplay Interface-Modul für VLC im VLC-Verzeichnis gefunden. Daher wird, wenn du VLC 2.0 nutzt, die syncplay.lua die mit Syncplay mitgeliefert wurde, verwendet. Dies bedeutet allerdings, dass keine anderen Interface-Skripts und Erweiterungen geladen werden. In der Syncplay-Anleitung unter https://syncplay.pl/guide/ [Englisch] findest du Details zur Installation des syncplay.lua-Skripts.", "media-player-latency-warning": "Warnung: Der Mediaplayer brauchte {} Sekunden zum Antworten. Wenn Probleme bei der Synchronisation auftreten, schließe bitte andere Anwendungen, um Ressourcen freizugeben. Sollte das nicht funktionieren, versuche es mit einem anderen Media-Player.", # Seconds to respond "mpv-unresponsive-error": "MPV hat für {} Sekunden nicht geantwortet und scheint abgestürzt zu sein. Bitte starte Syncplay neu.", # Seconds to respond diff --git a/syncplay/messages_en.py b/syncplay/messages_en.py index 9fbbc83..8c869ee 100755 --- a/syncplay/messages_en.py +++ b/syncplay/messages_en.py @@ -94,9 +94,6 @@ en = { "language-changed-msgbox-label": "Language will be changed when you run Syncplay.", "promptforupdate-label": "Is it okay for Syncplay to automatically check for updates from time to time?", - "vlc-interface-version-mismatch": "You are running version {} of the Syncplay interface module for VLC, but Syncplay is designed to run with version {} and above. Please refer to the Syncplay User Guide at https://syncplay.pl/guide/ for instructions on how to install syncplay.lua.", # VLC interface version, VLC interface min version - "vlc-interface-oldversion-warning": "Warning: Syncplay detected that an old version version of the Syncplay interface module for VLC was installed in the VLC directory. Please refer to the Syncplay User Guide at https://syncplay.pl/guide/ for instructions on how to install syncplay.lua.", - "vlc-interface-not-installed": "Warning: The Syncplay interface module for VLC was not found in the VLC directory. As such, if you are running VLC 2.0 then VLC will use the syncplay.lua module contained within the Syncplay directory, but this will mean that other custom interface scripts and extensions will not work. Please refer to the Syncplay User Guide at https://syncplay.pl/guide/ for instructions on how to install syncplay.lua.", "media-player-latency-warning": "Warning: The media player took {} seconds to respond. If you experience syncing issues then close applications to free up system resources, and if that doesn't work then try a different media player.", # Seconds to respond "mpv-unresponsive-error": "mpv has not responded for {} seconds so appears to have malfunctioned. Please restart Syncplay.", # Seconds to respond diff --git a/syncplay/messages_it.py b/syncplay/messages_it.py index 26dd7f8..a3d4c8c 100755 --- a/syncplay/messages_it.py +++ b/syncplay/messages_it.py @@ -94,10 +94,7 @@ it = { "language-changed-msgbox-label": "La lingua sarà cambiata quando avvierai Syncplay.", "promptforupdate-label": "Ti piacerebbe che, di tanto in tanto, Syncplay controllasse automaticamente la presenza di aggiornamenti?", - "vlc-interface-version-mismatch": "Stai eseguendo la versione {} del modulo di interfaccia per VLC di Syncplay, ma Syncplay è progettato per essere utilizzato con la versione {} o superiore. Per favore, fai riferimento alla User Guide di Syncplay presso https://syncplay.pl/guide/ per istruzioni su come installare syncplay.lua.", # VLC interface version, VLC interface min version - "vlc-interface-oldversion-warning": "Attenzione: Syncplay ha rilevato una vecchia versione del modulo di interfaccia per VLC di Syncplay installata nella cartella di VLC. Per favore, fai riferimento alla User Guide di Syncplay presso https://syncplay.pl/guide/ per istruzioni su come installare syncplay.lua.", "media-player-latency-warning": "Attenzione: il media player ha impiegato {} secondi per rispondere. Se stai avendo problemi di sincronizzazione, chiudi delle applicazioni per liberare le risorse di sistema e, se ciò non dovesse avere alcun effetto, prova un altro media player.", # Seconds to respond - "vlc-interface-not-installed": "Attenzione: il modulo di interfaccia per VLC di Syncplay non è stato trovato nella cartella di VLC. Se stai utilizzando VLC 2.0, VLC userà il modulo syncplay.lua contenuto nella cartella di Syncplay, ma ciò significa che altri custom script di interfaccia ed estensioni non funzioneranno. Per favore, fai riferimento alla User Guide di Syncplay presso https://syncplay.pl/guide/ per istruzioni su come installare syncplay.lua.", "mpv-unresponsive-error": "mpv non ha risposto per {} secondi, quindi sembra non funzionare correttamente. Per favore, riavvia Syncplay.", # Seconds to respond # Client prompts diff --git a/syncplay/messages_ru.py b/syncplay/messages_ru.py index 3dbec04..f9156d2 100755 --- a/syncplay/messages_ru.py +++ b/syncplay/messages_ru.py @@ -94,9 +94,6 @@ ru = { "language-changed-msgbox-label": "Язык переключится при следующем запуске Syncplay.", "promptforupdate-label": "Вы не против, если Syncplay будет автоматически изредка проверять наличие обновлений?", - "vlc-interface-version-mismatch": "Вы используете модуль интерфейса Syncplay устаревшей версии {} для VLC. К сожалению, Syncplay способен работать с версией {} и выше. Пожалуйста, обратитесь к Руководству Пользователя Syncplay (https://syncplay.pl/guide/) за инструкциями о том, как установить syncplay.lua.", # VLC interface version, VLC interface min version - "vlc-interface-oldversion-warning": "Внимание: Syncplay обнаружил, что старая версия модуля интерфейса Syncplay для VLC уже установлена в директорию VLC. Пожалуйста, обратитесь к Руководству Пользователя Syncplay (https://syncplay.pl/guide/) за инструкциями о том, как установить syncplay.lua.", - "vlc-interface-not-installed": "Внимание: Модуль интерфейса Syncplay для VLC не обнаружен в директории VLC. По существу, если Вы используете VLC 2.0, то VLC будет использовать модуль syncplay.lua из директории Syncplay, но в таком случае другие пользовательские скрипты и расширения интерфейса не будут работать. Пожалуйста, обратитесь к Руководству Пользователя Syncplay (https://syncplay.pl/guide/) за инструкциями о том, как установить syncplay.lua.", "media-player-latency-warning": "Внимание: У Вашего проигрывателя слишком большой отклик ({} секунд). Если Вы замечаете проблемы с синхронизацией, то закройте ресурсоемкие приложения. Если это не помогло - попробуйте другой проигрыватель.", # Seconds to respond "mpv-unresponsive-error": "mpv не отвечает {} секунд, по-видимому, произошел сбой. Пожалуйста, перезапустите Syncplay.", # Seconds to respond diff --git a/syncplay/players/vlc.py b/syncplay/players/vlc.py index 3a1bbd9..0575dd2 100755 --- a/syncplay/players/vlc.py +++ b/syncplay/players/vlc.py @@ -341,23 +341,6 @@ class VlcPlayer(BasePlayer): call.append(filePath) else: call.append(self.__playerController.getMRL(filePath)) - - def _usevlcintf(vlcIntfPath, vlcIntfUserPath): - vlcSyncplayInterfacePath = vlcIntfPath + "syncplay.lua" - if not os.path.isfile(vlcSyncplayInterfacePath): - vlcSyncplayInterfacePath = vlcIntfUserPath + "syncplay.lua" - if os.path.isfile(vlcSyncplayInterfacePath): - with open(vlcSyncplayInterfacePath, 'rU') as interfacefile: - for line in interfacefile: - if "local connectorversion" in line: - interface_version = line[26:31] - if utils.meetsMinVersion(interface_version, constants.VLC_INTERFACE_MIN_VERSION): - return True - else: - self.oldIntfVersion = line[26:31] - return False - playerController._client.ui.showErrorMessage(getMessage("vlc-interface-not-installed")) - return False if isLinux(): playerController.vlcIntfPath = "/usr/lib/vlc/lua/intf/" playerController.vlcIntfUserPath = os.path.join(os.getenv('HOME', '.'), ".local/share/vlc/lua/intf/") @@ -374,18 +357,55 @@ class VlcPlayer(BasePlayer): playerController.vlcIntfPath = os.path.dirname(playerPath).replace("\\", "/") + "/lua/intf/" playerController.vlcIntfUserPath = os.path.join(os.getenv('APPDATA', '.'), "VLC\\lua\\intf\\") playerController.vlcModulePath = playerController.vlcIntfPath + "modules/?.luac" - if _usevlcintf(playerController.vlcIntfPath, playerController.vlcIntfUserPath): - playerController.SLAVE_ARGS.append( - '--lua-config=syncplay={{port=\"{}\"}}'.format(str(playerController.vlcport))) - else: - if isLinux(): - playerController.vlcDataPath = "/usr/lib/syncplay/resources" + def _createIntfFolder(vlcSyncplayInterfaceDir): + self.__playerController._client.ui.showDebugMessage("Checking if syncplay.lua intf directory exists") + from pathlib import Path + if os.path.exists(vlcSyncplayInterfaceDir): + self.__playerController._client.ui.showDebugMessage("Found syncplay.lua intf directory:'{}'".format(vlcSyncplayInterfaceDir)) else: - playerController.vlcDataPath = utils.findWorkingDir() + "\\resources" - playerController.SLAVE_ARGS.append('--data-path={}'.format(playerController.vlcDataPath)) - playerController.SLAVE_ARGS.append( - '--lua-config=syncplay={{modulepath=\"{}\",port=\"{}\"}}'.format( - playerController.vlcModulePath, str(playerController.vlcport))) + self.__playerController._client.ui.showDebugMessage("syncplay.lua intf directory not found, so creating directory '{}'".format(vlcSyncplayInterfaceDir)) + Path(vlcSyncplayInterfaceDir).mkdir(mode=0o755, parents=True, exist_ok=True) + def _intfNeedsUpdating(vlcSyncplayInterfacePath): + self.__playerController._client.ui.showDebugMessage("Checking if '{}' exists and if it is the expected version".format(vlcSyncplayInterfacePath)) + if not os.path.isfile(vlcSyncplayInterfacePath): + self.__playerController._client.ui.showDebugMessage("syncplay.lua not found, so file needs copying") + return True + if os.path.isfile(vlcSyncplayInterfacePath): + with open(vlcSyncplayInterfacePath, 'rU') as interfacefile: + for line in interfacefile: + if "local connectorversion" in line: + interface_version = line[26:31] + if interface_version == constants.VLC_INTERFACE_VERSION: + self.__playerController._client.ui.showDebugMessage("syncplay.lua exists and is expected version, so no file needs copying") + return False + else: + self.oldIntfVersion = line[26:31] + self.__playerController._client.ui.showDebugMessage("syncplay.lua is {} but expected version is {} so file needs to be copied".format(interface_version, constants.VLC_INTERFACE_VERSION)) + return True + self.__playerController._client.ui.showDebugMessage("Up-to-dateness checks failed, so copy the file.") + return True + if _intfNeedsUpdating(os.path.join(playerController.vlcIntfUserPath, "syncplay.lua")): + try: + _createIntfFolder(playerController.vlcIntfUserPath) + copyForm = utils.findResourcePath("syncplay.lua") + copyTo = os.path.join(playerController.vlcIntfUserPath, "syncplay.lua") + self.__playerController._client.ui.showDebugMessage("Copying VLC Lua Interface from '{}' to '{}'".format(copyForm, copyTo)) + import shutil + if os.path.exists(copyTo): + os.chmod(copyTo, 0o755) + shutil.copyfile(copyForm, copyTo) + os.chmod(copyTo, 0o755) + except Exception as e: + playerController._client.ui.showErrorMessage(e) + return + if isLinux(): + playerController.vlcDataPath = "/usr/lib/syncplay/resources" + else: + playerController.vlcDataPath = utils.findWorkingDir() + "\\resources" + playerController.SLAVE_ARGS.append('--data-path={}'.format(playerController.vlcDataPath)) + playerController.SLAVE_ARGS.append( + '--lua-config=syncplay={{modulepath=\"{}\",port=\"{}\"}}'.format( + playerController.vlcModulePath, str(playerController.vlcport))) call.extend(playerController.SLAVE_ARGS) if args: @@ -395,49 +415,43 @@ class VlcPlayer(BasePlayer): self._vlcclosed = vlcClosed self._vlcVersion = None - if self.oldIntfVersion: - self.__playerController.drop( - getMessage("vlc-interface-version-mismatch").format( - self.oldIntfVersion, constants.VLC_INTERFACE_MIN_VERSION)) - + if isWindows() and getattr(sys, 'frozen', '') and getattr(sys, '_MEIPASS', '') is not None: # Needed for pyinstaller --onefile bundle + self.__process = subprocess.Popen( + call, stdin=subprocess.PIPE, stderr=subprocess.PIPE, stdout=subprocess.PIPE, + shell=False, creationflags=0x08000000) else: - if isWindows() and getattr(sys, 'frozen', '') and getattr(sys, '_MEIPASS', '') is not None: # Needed for pyinstaller --onefile bundle - self.__process = subprocess.Popen( - call, stdin=subprocess.PIPE, stderr=subprocess.PIPE, stdout=subprocess.PIPE, - shell=False, creationflags=0x08000000) - else: - self.__process = subprocess.Popen(call, stderr=subprocess.PIPE, stdout=subprocess.PIPE) - self.timeVLCLaunched = time.time() - if self._shouldListenForSTDOUT(): - for line in iter(self.__process.stderr.readline, ''): - line = line.decode('utf-8') - self.vlcHasResponded = True - self.timeVLCLaunched = None - if "[syncplay]" in line: - if "Listening on host" in line: - break - if "Hosting Syncplay" in line: - break - elif "Couldn't find lua interface" in line: - playerController._client.ui.showErrorMessage( - getMessage("vlc-failed-noscript").format(line), True) - break - elif "lua interface error" in line: - playerController._client.ui.showErrorMessage( - getMessage("media-player-error").format(line), True) - break - if not isMacOS(): - self.__process.stderr = None - else: - vlcoutputthread = threading.Thread(target=self.handle_vlcoutput, args=()) - vlcoutputthread.setDaemon(True) - vlcoutputthread.start() - threading.Thread.__init__(self, name="VLC Listener") - asynchat.async_chat.__init__(self) - self.set_terminator(b'\n') - self._ibuffer = [] - self.create_socket(socket.AF_INET, socket.SOCK_STREAM) - self._sendingData = threading.Lock() + self.__process = subprocess.Popen(call, stderr=subprocess.PIPE, stdout=subprocess.PIPE) + self.timeVLCLaunched = time.time() + if self._shouldListenForSTDOUT(): + for line in iter(self.__process.stderr.readline, ''): + line = line.decode('utf-8') + self.vlcHasResponded = True + self.timeVLCLaunched = None + if "[syncplay]" in line: + if "Listening on host" in line: + break + if "Hosting Syncplay" in line: + break + elif "Couldn't find lua interface" in line: + playerController._client.ui.showErrorMessage( + getMessage("vlc-failed-noscript").format(line), True) + break + elif "lua interface error" in line: + playerController._client.ui.showErrorMessage( + getMessage("media-player-error").format(line), True) + break + if not isMacOS(): + self.__process.stderr = None + else: + vlcoutputthread = threading.Thread(target=self.handle_vlcoutput, args=()) + vlcoutputthread.setDaemon(True) + vlcoutputthread.start() + threading.Thread.__init__(self, name="VLC Listener") + asynchat.async_chat.__init__(self) + self.set_terminator(b'\n') + self._ibuffer = [] + self.create_socket(socket.AF_INET, socket.SOCK_STREAM) + self._sendingData = threading.Lock() def _shouldListenForSTDOUT(self): return not isWindows() diff --git a/syncplay/ui/GuiConfiguration.py b/syncplay/ui/GuiConfiguration.py index d645321..acb0bf8 100755 --- a/syncplay/ui/GuiConfiguration.py +++ b/syncplay/ui/GuiConfiguration.py @@ -1109,8 +1109,8 @@ class ConfigDialog(QtWidgets.QDialog): if lang == self.config['language']: self.languageCombobox.setCurrentIndex(self.languageCombobox.count()-1) self.languageCombobox.currentIndexChanged.connect(self.languageChanged) - self.languageLayout.addWidget(self.languageLabel, 1, 0) - self.languageLayout.addWidget(self.languageCombobox, 1, 1) + self.languageLayout.addWidget(self.languageLabel, 1, Qt.AlignLeft) + self.languageLayout.addWidget(self.languageCombobox, 1, Qt.AlignLeft) self.displaySettingsLayout.addWidget(self.languageFrame) self.languageLabel.setObjectName("language") diff --git a/syncplay/utils.py b/syncplay/utils.py index 50a1a24..776889b 100755 --- a/syncplay/utils.py +++ b/syncplay/utils.py @@ -147,7 +147,7 @@ def isASCII(s): def findResourcePath(resourceName): if resourceName == "syncplay.lua": - resourcePath = os.path.join(findWorkingDir(), "lua", "intf", "resources", resourceName) + resourcePath = os.path.join(findWorkingDir(),"resources", "lua", "intf", resourceName) else: resourcePath = os.path.join(findWorkingDir(), "resources", resourceName) return resourcePath