From 99954ad4f4fccb525b3e44f6df2ff45c873dc49e Mon Sep 17 00:00:00 2001 From: Etoh Date: Sat, 2 Feb 2019 01:21:56 +0000 Subject: [PATCH] Automatically copy syncplay.lua to VLC user intf directory --- GNUmakefile | 11 ---- appdmg.py | 1 - buildPy2exe.py | 87 ++----------------------------- resources/lua/intf/syncplay.lua | 8 +-- resources/win_lua_note.txt | 6 --- syncplay/messages_de.py | 3 -- syncplay/messages_en.py | 3 -- syncplay/messages_it.py | 3 -- syncplay/messages_ru.py | 3 -- syncplay/players/vlc.py | 90 ++++++++++++++++----------------- syncplay/utils.py | 2 +- 11 files changed, 51 insertions(+), 166 deletions(-) delete mode 100755 resources/win_lua_note.txt 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..c2a65b5 100755 --- a/appdmg.py +++ b/appdmg.py @@ -39,7 +39,6 @@ files = [ # Symlinks to create symlinks = { 'Applications': '/Applications', - 'Install for VLC': '.macos_vlc_install.command', 'Read Me': '.macOS_readme.pdf' } 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..becd9b6 100644 --- a/resources/lua/intf/syncplay.lua +++ b/resources/lua/intf/syncplay.lua @@ -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. 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/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..09eea51 100755 --- a/syncplay/players/vlc.py +++ b/syncplay/players/vlc.py @@ -356,7 +356,6 @@ class VlcPlayer(BasePlayer): 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/" @@ -374,9 +373,14 @@ 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))) + try: + 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 + shutil.copyfile(copyForm, copyTo) + except Exception as e: + playerController._client.ui.showErrorMessage(e) else: if isLinux(): playerController.vlcDataPath = "/usr/lib/syncplay/resources" @@ -395,49 +399,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/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