From e6238a54ee008331f3925c1941102d8a67cad382 Mon Sep 17 00:00:00 2001 From: Etoh Date: Thu, 14 Dec 2017 17:14:40 +0000 Subject: [PATCH 01/21] Dropping a file into the player or playlist adds it to playlist rather than just opening it --- syncplay/__init__.py | 4 +-- syncplay/client.py | 48 ++++++++++++++++++++++++++++-- syncplay/ui/ConfigurationGetter.py | 3 ++ syncplay/ui/gui.py | 24 ++++++++++----- 4 files changed, 67 insertions(+), 12 deletions(-) diff --git a/syncplay/__init__.py b/syncplay/__init__.py index 02e8e74..2cf5466 100644 --- a/syncplay/__init__.py +++ b/syncplay/__init__.py @@ -1,4 +1,4 @@ -version = '1.5.0' +version = '1.5.1' milestone = 'Yoitsu' -release_number = '50' +release_number = '51' projectURL = 'http://syncplay.pl/' diff --git a/syncplay/client.py b/syncplay/client.py index fa73d9e..c4b3e8a 100644 --- a/syncplay/client.py +++ b/syncplay/client.py @@ -117,6 +117,9 @@ class SyncplayClient(object): self.autoPlay = False self.autoPlayThreshold = None + self.ignorePath = None + self.ignorePathTime = None + self.autoplayTimer = task.LoopingCall(self.autoplayCountdown) self.autoplayTimeLeft = constants.AUTOPLAY_DELAY @@ -445,6 +448,11 @@ class SyncplayClient(object): return self._globalPaused def updateFile(self, filename, duration, path): + if self.ignorePath == path and self.ignorePathTime is not None and abs(time.time() - self.ignorePathTime) < 5.0: + self.ignorePath = None + self.ignorePathTime = None + return + newPath = u"" if utils.isURL(path): try: @@ -461,6 +469,28 @@ class SyncplayClient(object): size = os.path.getsize(path) except: size = 0 + + def _fileOpenedFromPlayer(): + return self.sharedPlaylistIsEnabled and self._config['dropFileAddsToPlaylist'] and not utils.isURL(path) and filename <> self.playlist.lastFileOpened and not filename in self.playlist._playlist + + if _fileOpenedFromPlayer(): + oldFilePath = self.userlist.currentUser.file['path'] if self.userlist.currentUser.file else None + self.ignorePath = deepcopy(oldFilePath) + self.ignorePathTime = time.time() + if not self.playlist._playlist and self.userlist.currentUser.file: + if utils.isURL(oldFilePath): + self.playlist.addFileToPlaylist(oldFilePath) + else: + self.playlist.addFileToPlaylist(os.path.basename(oldFilePath)) + self.playlist.addFileToPlaylist(filename) + if self.userlist.currentUser.file: + self._player.openFile(oldFilePath) + return + else: + self.playlist.lastFileOpened = filename + + # TODO: Cancel if new same as old? + if not utils.isURL(path) and os.path.exists(path): self.fileSwitch.notifyUserIfFileNotInMediaDirectory(filename, path) filename, size = self.__executePrivacySettings(filename, size) @@ -502,7 +532,7 @@ class SyncplayClient(object): return False def openFile(self, filePath, resetPosition=False): - self.playlist.openedFile() + self.playlist.openedFile(filePath) self._player.openFile(filePath, resetPosition) if resetPosition: self.establishRewindDoubleCheck() @@ -1424,6 +1454,7 @@ class SyncplayPlaylist(): self._playlistIndex = None self.addedChangeListCallback = False self._lastPlaylistIndexChange = time.time() + self.lastFileOpened = os.path.basename(self._client._config['file']) if self._client._config['file'] and not utils.isURL(self._client._config['file']) else None def needsSharedPlaylistsEnabled(f): # @NoSelf @wraps(f) @@ -1434,8 +1465,12 @@ class SyncplayPlaylist(): return f(self, *args, **kwds) return wrapper - def openedFile(self): + def openedFile(self, filePath): self._lastPlaylistIndexChange = time.time() + if utils.isURL(filePath): + self.lastFileOpened = None + return + self.lastFileOpened = os.path.basename(filePath) def changeToPlaylistIndexFromFilename(self, filename): try: @@ -1602,6 +1637,15 @@ class SyncplayPlaylist(): self.changePlaylist(shuffledPlaylist, username=None, resetIndex=True) self.switchToNewPlaylistIndex(0, resetPosition=True) + @needsSharedPlaylistsEnabled + def addFileToPlaylist(self, filename): + if filename in self._playlist: + return + newPlaylist = deepcopy(self._playlist) + newPlaylist.append(filename) + if newPlaylist <> self._playlist: + self.changePlaylist(newPlaylist, username=None, resetIndex=False) + def canUndoPlaylist(self, currentPlaylist): return self._previousPlaylist is not None and currentPlaylist <> self._previousPlaylist diff --git a/syncplay/ui/ConfigurationGetter.py b/syncplay/ui/ConfigurationGetter.py index b23814f..230a805 100755 --- a/syncplay/ui/ConfigurationGetter.py +++ b/syncplay/ui/ConfigurationGetter.py @@ -64,6 +64,7 @@ class ConfigurationGetter(object): "showNonControllerOSD" : False, "showContactInfo" : True, "showDurationNotification" : True, + "dropFileAddsToPlaylist": False, "publicServers" : [] } @@ -106,6 +107,7 @@ class ConfigurationGetter(object): "sharedPlaylistEnabled", "loopAtEndOfPlaylist", "loopSingleFiles", + "dropFileAddsToPlaylist", "onlySwitchToTrustedDomains" ] self._tristate = [ @@ -140,6 +142,7 @@ class ConfigurationGetter(object): "autoplayInitialState", "mediaSearchDirectories", "sharedPlaylistEnabled", "loopAtEndOfPlaylist", "loopSingleFiles", + "dropFileAddsToPlaylist", "onlySwitchToTrustedDomains", "trustedDomains","publicServers"], "gui": ["showOSD", "showOSDWarnings", "showSlowdownOSD", "showDifferentRoomOSD", "showSameRoomOSD", diff --git a/syncplay/ui/gui.py b/syncplay/ui/gui.py index 298d512..20efd71 100755 --- a/syncplay/ui/gui.py +++ b/syncplay/ui/gui.py @@ -612,7 +612,7 @@ class MainWindow(QtWidgets.QMainWindow): if roomToJoin <> self._syncplayClient.getRoom(): menu.addAction(getMessage("joinroom-menu-label").format(roomToJoin), lambda: self.joinRoom(roomToJoin)) elif username and filename and filename <> getMessage("nofile-note"): - if self.config['sharedPlaylistEnabled'] and not self.isItemInPlaylist(filename): + if self._syncplayClient.sharedPlaylistIsEnabled() and not self.isItemInPlaylist(filename): if isURL(filename): menu.addAction(QtGui.QPixmap(resourcespath + u"world_add.png"),getMessage("addusersstreamstoplaylist-menu-label").format(shortUsername), lambda: self.addStreamToPlaylist(filename)) else: @@ -681,11 +681,11 @@ class MainWindow(QtWidgets.QMainWindow): if self._isTryingToChangeToCurrentFile(filename): return if isURL(filename): - self._syncplayClient._player.openFile(filename, resetPosition=True) + self._syncplayClient.openFile(filename, resetPosition=True) else: pathFound = self._syncplayClient.fileSwitch.findFilepath(filename, highPriority=True) if pathFound: - self._syncplayClient._player.openFile(pathFound, resetPosition=True) + self._syncplayClient.openFile(pathFound, resetPosition=True) else: self._syncplayClient.ui.showErrorMessage(getMessage("cannot-find-file-for-playlist-switch-error").format(filename)) @@ -708,11 +708,11 @@ class MainWindow(QtWidgets.QMainWindow): if self._isTryingToChangeToCurrentFile(filename): return if isURL(filename): - self._syncplayClient._player.openFile(filename) + self._syncplayClient.openFile(filename) else: pathFound = self._syncplayClient.fileSwitch.findFilepath(filename, highPriority=True) if pathFound: - self._syncplayClient._player.openFile(pathFound) + self._syncplayClient.openFile(pathFound) else: self._syncplayClient.fileSwitch.updateInfo() self.showErrorMessage(getMessage("switch-file-not-found-error").format(filename)) @@ -869,7 +869,7 @@ class MainWindow(QtWidgets.QMainWindow): self.mediadirectory = os.path.dirname(fileName) self._syncplayClient.fileSwitch.setCurrentDirectory(self.mediadirectory) self.saveMediaBrowseSettings() - self._syncplayClient._player.openFile(fileName) + self._syncplayClient.openFile(fileName) @needsClient def OpenAddFilesToPlaylistDialog(self): @@ -1051,7 +1051,7 @@ class MainWindow(QtWidgets.QMainWindow): getMessage("promptforstreamurlinfo-msgbox-label"), QtWidgets.QLineEdit.Normal, "") if ok and streamURL != '': - self._syncplayClient._player.openFile(streamURL) + self._syncplayClient.openFile(streamURL) @needsClient def createControlledRoom(self): @@ -1575,10 +1575,18 @@ class MainWindow(QtWidgets.QMainWindow): data = event.mimeData() urls = data.urls() if urls and urls[0].scheme() == 'file': + url = event.mimeData().urls()[0] if isMacOS() and IsPySide: dropfilepath = os.path.abspath(NSURL.URLWithString_(str(url.toString())).filePathURL().path()) else: dropfilepath = os.path.abspath(unicode(url.toLocalFile())) + if self.config['dropFileAddsToPlaylist'] and self._syncplayClient.sharedPlaylistIsEnabled(): + filename = dropfilepath if isURL(dropfilepath) else os.path.basename(dropfilepath) + if self.isItemInPlaylist(filename): + self._syncplayClient._player.openFile(dropfilepath) + else: + self.addFileToPlaylist(dropfilepath) + return if rewindFile == False: self._syncplayClient._player.openFile(dropfilepath) else: @@ -1626,7 +1634,7 @@ class MainWindow(QtWidgets.QMainWindow): self.playlist.insertItem(index, filePath) def openFile(self, filePath, resetPosition=False): - self._syncplayClient._player.openFile(filePath, resetPosition) + self._syncplayClient.openFile(filePath, resetPosition) def noPlaylistDuplicates(self, filename): if self.isItemInPlaylist(filename): From ec3bb067f377d76c3e37faa18788fb18e098adc7 Mon Sep 17 00:00:00 2001 From: Etoh Date: Mon, 25 Dec 2017 13:22:10 +0000 Subject: [PATCH 02/21] Remove dropFileAddsToPlaylist for now --- syncplay/client.py | 48 ++---------------------------- syncplay/ui/ConfigurationGetter.py | 3 -- syncplay/ui/gui.py | 24 +++++---------- 3 files changed, 10 insertions(+), 65 deletions(-) diff --git a/syncplay/client.py b/syncplay/client.py index c4b3e8a..fa73d9e 100644 --- a/syncplay/client.py +++ b/syncplay/client.py @@ -117,9 +117,6 @@ class SyncplayClient(object): self.autoPlay = False self.autoPlayThreshold = None - self.ignorePath = None - self.ignorePathTime = None - self.autoplayTimer = task.LoopingCall(self.autoplayCountdown) self.autoplayTimeLeft = constants.AUTOPLAY_DELAY @@ -448,11 +445,6 @@ class SyncplayClient(object): return self._globalPaused def updateFile(self, filename, duration, path): - if self.ignorePath == path and self.ignorePathTime is not None and abs(time.time() - self.ignorePathTime) < 5.0: - self.ignorePath = None - self.ignorePathTime = None - return - newPath = u"" if utils.isURL(path): try: @@ -469,28 +461,6 @@ class SyncplayClient(object): size = os.path.getsize(path) except: size = 0 - - def _fileOpenedFromPlayer(): - return self.sharedPlaylistIsEnabled and self._config['dropFileAddsToPlaylist'] and not utils.isURL(path) and filename <> self.playlist.lastFileOpened and not filename in self.playlist._playlist - - if _fileOpenedFromPlayer(): - oldFilePath = self.userlist.currentUser.file['path'] if self.userlist.currentUser.file else None - self.ignorePath = deepcopy(oldFilePath) - self.ignorePathTime = time.time() - if not self.playlist._playlist and self.userlist.currentUser.file: - if utils.isURL(oldFilePath): - self.playlist.addFileToPlaylist(oldFilePath) - else: - self.playlist.addFileToPlaylist(os.path.basename(oldFilePath)) - self.playlist.addFileToPlaylist(filename) - if self.userlist.currentUser.file: - self._player.openFile(oldFilePath) - return - else: - self.playlist.lastFileOpened = filename - - # TODO: Cancel if new same as old? - if not utils.isURL(path) and os.path.exists(path): self.fileSwitch.notifyUserIfFileNotInMediaDirectory(filename, path) filename, size = self.__executePrivacySettings(filename, size) @@ -532,7 +502,7 @@ class SyncplayClient(object): return False def openFile(self, filePath, resetPosition=False): - self.playlist.openedFile(filePath) + self.playlist.openedFile() self._player.openFile(filePath, resetPosition) if resetPosition: self.establishRewindDoubleCheck() @@ -1454,7 +1424,6 @@ class SyncplayPlaylist(): self._playlistIndex = None self.addedChangeListCallback = False self._lastPlaylistIndexChange = time.time() - self.lastFileOpened = os.path.basename(self._client._config['file']) if self._client._config['file'] and not utils.isURL(self._client._config['file']) else None def needsSharedPlaylistsEnabled(f): # @NoSelf @wraps(f) @@ -1465,12 +1434,8 @@ class SyncplayPlaylist(): return f(self, *args, **kwds) return wrapper - def openedFile(self, filePath): + def openedFile(self): self._lastPlaylistIndexChange = time.time() - if utils.isURL(filePath): - self.lastFileOpened = None - return - self.lastFileOpened = os.path.basename(filePath) def changeToPlaylistIndexFromFilename(self, filename): try: @@ -1637,15 +1602,6 @@ class SyncplayPlaylist(): self.changePlaylist(shuffledPlaylist, username=None, resetIndex=True) self.switchToNewPlaylistIndex(0, resetPosition=True) - @needsSharedPlaylistsEnabled - def addFileToPlaylist(self, filename): - if filename in self._playlist: - return - newPlaylist = deepcopy(self._playlist) - newPlaylist.append(filename) - if newPlaylist <> self._playlist: - self.changePlaylist(newPlaylist, username=None, resetIndex=False) - def canUndoPlaylist(self, currentPlaylist): return self._previousPlaylist is not None and currentPlaylist <> self._previousPlaylist diff --git a/syncplay/ui/ConfigurationGetter.py b/syncplay/ui/ConfigurationGetter.py index 230a805..b23814f 100755 --- a/syncplay/ui/ConfigurationGetter.py +++ b/syncplay/ui/ConfigurationGetter.py @@ -64,7 +64,6 @@ class ConfigurationGetter(object): "showNonControllerOSD" : False, "showContactInfo" : True, "showDurationNotification" : True, - "dropFileAddsToPlaylist": False, "publicServers" : [] } @@ -107,7 +106,6 @@ class ConfigurationGetter(object): "sharedPlaylistEnabled", "loopAtEndOfPlaylist", "loopSingleFiles", - "dropFileAddsToPlaylist", "onlySwitchToTrustedDomains" ] self._tristate = [ @@ -142,7 +140,6 @@ class ConfigurationGetter(object): "autoplayInitialState", "mediaSearchDirectories", "sharedPlaylistEnabled", "loopAtEndOfPlaylist", "loopSingleFiles", - "dropFileAddsToPlaylist", "onlySwitchToTrustedDomains", "trustedDomains","publicServers"], "gui": ["showOSD", "showOSDWarnings", "showSlowdownOSD", "showDifferentRoomOSD", "showSameRoomOSD", diff --git a/syncplay/ui/gui.py b/syncplay/ui/gui.py index 20efd71..298d512 100755 --- a/syncplay/ui/gui.py +++ b/syncplay/ui/gui.py @@ -612,7 +612,7 @@ class MainWindow(QtWidgets.QMainWindow): if roomToJoin <> self._syncplayClient.getRoom(): menu.addAction(getMessage("joinroom-menu-label").format(roomToJoin), lambda: self.joinRoom(roomToJoin)) elif username and filename and filename <> getMessage("nofile-note"): - if self._syncplayClient.sharedPlaylistIsEnabled() and not self.isItemInPlaylist(filename): + if self.config['sharedPlaylistEnabled'] and not self.isItemInPlaylist(filename): if isURL(filename): menu.addAction(QtGui.QPixmap(resourcespath + u"world_add.png"),getMessage("addusersstreamstoplaylist-menu-label").format(shortUsername), lambda: self.addStreamToPlaylist(filename)) else: @@ -681,11 +681,11 @@ class MainWindow(QtWidgets.QMainWindow): if self._isTryingToChangeToCurrentFile(filename): return if isURL(filename): - self._syncplayClient.openFile(filename, resetPosition=True) + self._syncplayClient._player.openFile(filename, resetPosition=True) else: pathFound = self._syncplayClient.fileSwitch.findFilepath(filename, highPriority=True) if pathFound: - self._syncplayClient.openFile(pathFound, resetPosition=True) + self._syncplayClient._player.openFile(pathFound, resetPosition=True) else: self._syncplayClient.ui.showErrorMessage(getMessage("cannot-find-file-for-playlist-switch-error").format(filename)) @@ -708,11 +708,11 @@ class MainWindow(QtWidgets.QMainWindow): if self._isTryingToChangeToCurrentFile(filename): return if isURL(filename): - self._syncplayClient.openFile(filename) + self._syncplayClient._player.openFile(filename) else: pathFound = self._syncplayClient.fileSwitch.findFilepath(filename, highPriority=True) if pathFound: - self._syncplayClient.openFile(pathFound) + self._syncplayClient._player.openFile(pathFound) else: self._syncplayClient.fileSwitch.updateInfo() self.showErrorMessage(getMessage("switch-file-not-found-error").format(filename)) @@ -869,7 +869,7 @@ class MainWindow(QtWidgets.QMainWindow): self.mediadirectory = os.path.dirname(fileName) self._syncplayClient.fileSwitch.setCurrentDirectory(self.mediadirectory) self.saveMediaBrowseSettings() - self._syncplayClient.openFile(fileName) + self._syncplayClient._player.openFile(fileName) @needsClient def OpenAddFilesToPlaylistDialog(self): @@ -1051,7 +1051,7 @@ class MainWindow(QtWidgets.QMainWindow): getMessage("promptforstreamurlinfo-msgbox-label"), QtWidgets.QLineEdit.Normal, "") if ok and streamURL != '': - self._syncplayClient.openFile(streamURL) + self._syncplayClient._player.openFile(streamURL) @needsClient def createControlledRoom(self): @@ -1575,18 +1575,10 @@ class MainWindow(QtWidgets.QMainWindow): data = event.mimeData() urls = data.urls() if urls and urls[0].scheme() == 'file': - url = event.mimeData().urls()[0] if isMacOS() and IsPySide: dropfilepath = os.path.abspath(NSURL.URLWithString_(str(url.toString())).filePathURL().path()) else: dropfilepath = os.path.abspath(unicode(url.toLocalFile())) - if self.config['dropFileAddsToPlaylist'] and self._syncplayClient.sharedPlaylistIsEnabled(): - filename = dropfilepath if isURL(dropfilepath) else os.path.basename(dropfilepath) - if self.isItemInPlaylist(filename): - self._syncplayClient._player.openFile(dropfilepath) - else: - self.addFileToPlaylist(dropfilepath) - return if rewindFile == False: self._syncplayClient._player.openFile(dropfilepath) else: @@ -1634,7 +1626,7 @@ class MainWindow(QtWidgets.QMainWindow): self.playlist.insertItem(index, filePath) def openFile(self, filePath, resetPosition=False): - self._syncplayClient.openFile(filePath, resetPosition) + self._syncplayClient._player.openFile(filePath, resetPosition) def noPlaylistDuplicates(self, filename): if self.isItemInPlaylist(filename): From a97d1fe86363038fd18d34fc8abf501fa07a1f87 Mon Sep 17 00:00:00 2001 From: Etoh Date: Mon, 25 Dec 2017 13:26:26 +0000 Subject: [PATCH 03/21] Fix dropfile on main GUI window --- syncplay/ui/gui.py | 1 + 1 file changed, 1 insertion(+) diff --git a/syncplay/ui/gui.py b/syncplay/ui/gui.py index 298d512..17ac512 100755 --- a/syncplay/ui/gui.py +++ b/syncplay/ui/gui.py @@ -1575,6 +1575,7 @@ class MainWindow(QtWidgets.QMainWindow): data = event.mimeData() urls = data.urls() if urls and urls[0].scheme() == 'file': + url = event.mimeData().urls()[0] if isMacOS() and IsPySide: dropfilepath = os.path.abspath(NSURL.URLWithString_(str(url.toString())).filePathURL().path()) else: From 1dd1317791fadb2de80b03c45215312f2eca6a61 Mon Sep 17 00:00:00 2001 From: Etoh Date: Mon, 25 Dec 2017 13:27:09 +0000 Subject: [PATCH 04/21] Change recent client to 1.5.1 --- syncplay/constants.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syncplay/constants.py b/syncplay/constants.py index 707ccea..891df7a 100644 --- a/syncplay/constants.py +++ b/syncplay/constants.py @@ -9,7 +9,7 @@ UI_TIME_FORMAT = "[%X] " CONFIG_NAMES = [".syncplay", "syncplay.ini"] #Syncplay searches first to last DEFAULT_CONFIG_NAME_WINDOWS = "syncplay.ini" DEFAULT_CONFIG_NAME_LINUX = ".syncplay" -RECENT_CLIENT_THRESHOLD = "1.5.0" #This and higher considered 'recent' clients (no warnings) +RECENT_CLIENT_THRESHOLD = "1.5.1" #This and higher considered 'recent' clients (no warnings) WARN_OLD_CLIENTS = True #Use MOTD to inform old clients to upgrade LIST_RELATIVE_CONFIGS = True # Print list of relative configs loaded SHOW_CONTACT_INFO = True # Displays dev contact details below list in GUI From 18e12b0667c8ec4b3631b14bcdac23791883ecec Mon Sep 17 00:00:00 2001 From: Ricardo Constantino Date: Sun, 2 Jul 2017 14:02:32 +0100 Subject: [PATCH 05/21] buildPy2exe: Find installed NSIS through registry Require NSIS >=3 for unicode support --- buildPy2exe.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/buildPy2exe.py b/buildPy2exe.py index 452a359..6d8f730 100755 --- a/buildPy2exe.py +++ b/buildPy2exe.py @@ -5,7 +5,7 @@ ) If you get the error "ImportError: No module named zope.interface" then add an empty __init__.py file to the PYTHONDIR/Lib/site-packages/zope directory -2) It is expected that you will have NSIS 3 NSIS from http://nsis.sourceforge.net installed to: C:\Program Files (x86)\NSIS\ +2) It is expected that you will have NSIS 3 NSIS from http://nsis.sourceforge.net installed. ''' @@ -31,8 +31,24 @@ if missingStrings is not None and missingStrings is not "": import warnings warnings.warn("MISSING/UNUSED STRINGS DETECTED:\n{}".format(missingStrings)) -p = "C:\\Program Files (x86)\\NSIS\\makensis.exe" #TODO: how to move that into proper place, huh -NSIS_COMPILE = p if os.path.isfile(p) else "makensis.exe" +def get_nsis_path(): + bin_name = "makensis.exe" + try: + from winreg import HKEY_LOCAL_MACHINE as HKLM + from winreg import KEY_READ, KEY_WOW64_32KEY, OpenKey, QueryValueEx + except ImportError: + return bin_name + + try: + nsisreg = OpenKey(HKLM, "Software\\NSIS", 0, KEY_READ | KEY_WOW64_32KEY) + if QueryValueEx(nsisreg, "VersionMajor")[0] >= 3: + return "{}\\{}".format(QueryValueEx(nsisreg, "")[0], bin_name) + else: + raise Exception("You must install NSIS 3 or later.") + except WindowsError: + return bin_name +NSIS_COMPILE = get_nsis_path() + OUT_DIR = "syncplay_v{}".format(syncplay.version) SETUP_SCRIPT_PATH = "syncplay_setup.nsi" NSIS_SCRIPT_TEMPLATE = r""" From 14296e7f3ad907875d546e4116f17afe19778217 Mon Sep 17 00:00:00 2001 From: Ricardo Constantino Date: Mon, 25 Dec 2017 19:08:24 +0000 Subject: [PATCH 06/21] buildPy2exe: use proper python2 name for winreg --- buildPy2exe.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/buildPy2exe.py b/buildPy2exe.py index 6d8f730..db4dbaa 100755 --- a/buildPy2exe.py +++ b/buildPy2exe.py @@ -33,11 +33,8 @@ if missingStrings is not None and missingStrings is not "": def get_nsis_path(): bin_name = "makensis.exe" - try: - from winreg import HKEY_LOCAL_MACHINE as HKLM - from winreg import KEY_READ, KEY_WOW64_32KEY, OpenKey, QueryValueEx - except ImportError: - return bin_name + from _winreg import HKEY_LOCAL_MACHINE as HKLM + from _winreg import KEY_READ, KEY_WOW64_32KEY, OpenKey, QueryValueEx try: nsisreg = OpenKey(HKLM, "Software\\NSIS", 0, KEY_READ | KEY_WOW64_32KEY) From be3a3c6ebcddb7b0f2eb61e2c978d705db515f32 Mon Sep 17 00:00:00 2001 From: Etoh Date: Mon, 25 Dec 2017 20:11:01 +0000 Subject: [PATCH 07/21] Re-implement alby128's appveyor code --- .appveyor.yml | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .appveyor.yml diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 0000000..0ead4d2 --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,54 @@ +environment: + MINICONDA: "C:\\Miniconda" + clone_folder: c:\projects\syncplay + +image: + - Visual Studio 2013 + +platform: x86 + +configuration: Release + +init: + - set PATH=C:\Miniconda;C:\Miniconda\Scripts;%PATH% + - cmd: conda create -n syncplay -y + - cmd: activate syncplay + - cmd: conda install python pywin32 pyside -y + - cmd: pip install twisted py2exe_py2 zope.interface + - cmd: type nul > C:\Miniconda\envs\syncplay\lib\site-packages\zope\__init__.py + - cmd: pip freeze + - cmd: conda list + +install: + - cmd: cd c:\projects\syncplay + - cmd: python buildPy2exe.py + - cmd: del C:\projects\syncplay\syncplay_v1.5.1\lib\DNSAPI.dll + - cmd: del C:\projects\syncplay\syncplay_v1.5.1\lib\MPR.dll + - cmd: mkdir C:\projects\syncplay\syncplay_v1.5.1\platforms + #- cmd: copy C:\Miniconda\envs\syncplay\library\plugins\platforms\qwindows.dll C:\projects\syncplay\syncplay_v1.5.1\platforms\ + +# Not a project with an msbuild file, build done at install. +build: off + +artifacts: + path: 'syncplay_v1.5.1' + type: zip + name: Syncplay_win + +# Push artefact to S3 bucket and list all +before_deploy: + - cmd: dir + #- cmd: python -c "from PySide2 import QtCore; print QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.PluginsPath)" + +# Deploy build to BinTray +deploy: + provider: BinTray + username: etoh + api_key: + secure: TfwB161OlDOcAz5nnmjtNjDmJw2KyCz/uB1KzN4r5/9AL3uczWNuY+k6qVGaRvOP + subject: syncplay + repo: Syncplay + package: Syncplay-win + version: "1.5.1" + publish: true + override: true From bf00d9e828d4cd0e036e009b8e458d63ab8a1de7 Mon Sep 17 00:00:00 2001 From: Etoh Date: Mon, 25 Dec 2017 20:18:16 +0000 Subject: [PATCH 08/21] Adapt wiiaboo's appveyor code --- .appveyor.yml | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 0ead4d2..641f6d3 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,9 +1,5 @@ environment: MINICONDA: "C:\\Miniconda" - clone_folder: c:\projects\syncplay - -image: - - Visual Studio 2013 platform: x86 @@ -11,34 +7,35 @@ configuration: Release init: - set PATH=C:\Miniconda;C:\Miniconda\Scripts;%PATH% - - cmd: conda create -n syncplay -y - - cmd: activate syncplay - - cmd: conda install python pywin32 pyside -y - - cmd: pip install twisted py2exe_py2 zope.interface - - cmd: type nul > C:\Miniconda\envs\syncplay\lib\site-packages\zope\__init__.py - - cmd: pip freeze - - cmd: conda list + - conda create -n syncplay -y + - activate syncplay + - conda install python pywin32 pyside -y + - pip2 install twisted py2exe_py2 zope.interface + - type nul > C:\Miniconda\envs\syncplay\lib\site-packages\zope\__init__.py + - pip2 freeze + - conda list + - for /f %%a in ('git describe --tags --abbrev^=0 --match^=v*') do set gittagversion=%%a install: - - cmd: cd c:\projects\syncplay - - cmd: python buildPy2exe.py - - cmd: del C:\projects\syncplay\syncplay_v1.5.1\lib\DNSAPI.dll - - cmd: del C:\projects\syncplay\syncplay_v1.5.1\lib\MPR.dll - - cmd: mkdir C:\projects\syncplay\syncplay_v1.5.1\platforms - #- cmd: copy C:\Miniconda\envs\syncplay\library\plugins\platforms\qwindows.dll C:\projects\syncplay\syncplay_v1.5.1\platforms\ + - cd %APPVEYOR_BUILD_FOLDER% + - py -2 buildPy2exe.py + - del syncplay_%gittagversion%\lib\DNSAPI.dll + - del syncplay_%gittagversion%\lib\MPR.dll + - mkdir syncplay_%gittagversion%\platforms + #- copy C:\Miniconda\envs\syncplay\library\plugins\platforms\qwindows.dll C:\projects\syncplay\syncplay_v1.5.0\platforms\ # Not a project with an msbuild file, build done at install. build: off artifacts: - path: 'syncplay_v1.5.1' + path: 'syncplay_$(gittagversion)' type: zip name: Syncplay_win # Push artefact to S3 bucket and list all before_deploy: - - cmd: dir - #- cmd: python -c "from PySide2 import QtCore; print QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.PluginsPath)" + - dir + #- python -c "from PySide2 import QtCore; print QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.PluginsPath)" # Deploy build to BinTray deploy: @@ -46,9 +43,8 @@ deploy: username: etoh api_key: secure: TfwB161OlDOcAz5nnmjtNjDmJw2KyCz/uB1KzN4r5/9AL3uczWNuY+k6qVGaRvOP - subject: syncplay repo: Syncplay package: Syncplay-win - version: "1.5.1" + version: $(gittagversion) publish: true override: true From 33942e9be58d39a793dc4927ac81c5f7d31f01de Mon Sep 17 00:00:00 2001 From: Etoh Date: Mon, 25 Dec 2017 20:23:03 +0000 Subject: [PATCH 09/21] Use updated wiiaboo code --- .appveyor.yml | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 641f6d3..3c7a663 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -6,31 +6,33 @@ platform: x86 configuration: Release init: - - set PATH=C:\Miniconda;C:\Miniconda\Scripts;%PATH% + - set PATH=C:\Miniconda;C:\Miniconda\Scripts;C:\Program Files (x86)\NSIS;%PATH% - conda create -n syncplay -y - activate syncplay - conda install python pywin32 pyside -y - - pip2 install twisted py2exe_py2 zope.interface + - pip install twisted py2exe_py2 zope.interface - type nul > C:\Miniconda\envs\syncplay\lib\site-packages\zope\__init__.py - - pip2 freeze + - pip freeze - conda list - - for /f %%a in ('git describe --tags --abbrev^=0 --match^=v*') do set gittagversion=%%a install: - cd %APPVEYOR_BUILD_FOLDER% - - py -2 buildPy2exe.py - - del syncplay_%gittagversion%\lib\DNSAPI.dll - - del syncplay_%gittagversion%\lib\MPR.dll - - mkdir syncplay_%gittagversion%\platforms + - for /F "tokens=2 delims='" %%a in ('findstr version syncplay\__init__.py') do @set ver=%%a + - python buildPy2exe.py + - del syncplay_v%ver%\lib\MPR.dll + - mkdir syncplay_v%ver%\platforms #- copy C:\Miniconda\envs\syncplay\library\plugins\platforms\qwindows.dll C:\projects\syncplay\syncplay_v1.5.0\platforms\ # Not a project with an msbuild file, build done at install. build: off artifacts: - path: 'syncplay_$(gittagversion)' - type: zip - name: Syncplay_win + - path: 'syncplay_v$(ver)' + type: zip + name: Syncplay-$(ver)-win + + - path: Syncplay-$(ver)-Setup.exe + name: Syncplay-$(ver)-win-setup # Push artefact to S3 bucket and list all before_deploy: @@ -45,6 +47,6 @@ deploy: secure: TfwB161OlDOcAz5nnmjtNjDmJw2KyCz/uB1KzN4r5/9AL3uczWNuY+k6qVGaRvOP repo: Syncplay package: Syncplay-win - version: $(gittagversion) + version: v$(gittagversion) publish: true override: true From e75ca541d181f9caeed9ee017052041a89876714 Mon Sep 17 00:00:00 2001 From: Etoh Date: Mon, 25 Dec 2017 20:25:50 +0000 Subject: [PATCH 10/21] Add apveyor subject --- .appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.appveyor.yml b/.appveyor.yml index 3c7a663..26f67cc 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -47,6 +47,7 @@ deploy: secure: TfwB161OlDOcAz5nnmjtNjDmJw2KyCz/uB1KzN4r5/9AL3uczWNuY+k6qVGaRvOP repo: Syncplay package: Syncplay-win + subject: etoh version: v$(gittagversion) publish: true override: true From 0a5d4f8e71bf588aa8e966890838233aef67a526 Mon Sep 17 00:00:00 2001 From: Etoh Date: Mon, 25 Dec 2017 20:32:45 +0000 Subject: [PATCH 11/21] Update .appveyor.yml --- .appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 26f67cc..b52f3e3 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -46,8 +46,8 @@ deploy: api_key: secure: TfwB161OlDOcAz5nnmjtNjDmJw2KyCz/uB1KzN4r5/9AL3uczWNuY+k6qVGaRvOP repo: Syncplay - package: Syncplay-win - subject: etoh + package: Syncplay + subject: syncplay version: v$(gittagversion) publish: true override: true From 2bed3e067064fff996329eed9c07721753b6f126 Mon Sep 17 00:00:00 2001 From: Etoh Date: Mon, 25 Dec 2017 20:36:45 +0000 Subject: [PATCH 12/21] Update .appveyor.yml --- .appveyor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index b52f3e3..7c03173 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -39,6 +39,7 @@ before_deploy: - dir #- python -c "from PySide2 import QtCore; print QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.PluginsPath)" + # Deploy build to BinTray deploy: provider: BinTray @@ -48,6 +49,6 @@ deploy: repo: Syncplay package: Syncplay subject: syncplay - version: v$(gittagversion) + version: v$(ver) publish: true override: true From 3f7c9d2e76ba338ae7798a350671600c6b0c3e1d Mon Sep 17 00:00:00 2001 From: Etoh Date: Mon, 25 Dec 2017 20:43:36 +0000 Subject: [PATCH 13/21] Remove spaces from Syncplay setup --- buildPy2exe.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildPy2exe.py b/buildPy2exe.py index db4dbaa..f08a237 100755 --- a/buildPy2exe.py +++ b/buildPy2exe.py @@ -61,7 +61,7 @@ NSIS_SCRIPT_TEMPLATE = r""" Unicode true Name "Syncplay $version" - OutFile "Syncplay $version Setup.exe" + OutFile "Syncplay-$version-Setup.exe"" InstallDir $$PROGRAMFILES\Syncplay RequestExecutionLevel admin XPStyle on From e9e71f5e5eca8c1f68aa801e8bf672a10dafa8ba Mon Sep 17 00:00:00 2001 From: Etoh Date: Mon, 25 Dec 2017 20:46:44 +0000 Subject: [PATCH 14/21] Update buildPy2exe.py --- buildPy2exe.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildPy2exe.py b/buildPy2exe.py index f08a237..6b2100c 100755 --- a/buildPy2exe.py +++ b/buildPy2exe.py @@ -61,7 +61,7 @@ NSIS_SCRIPT_TEMPLATE = r""" Unicode true Name "Syncplay $version" - OutFile "Syncplay-$version-Setup.exe"" + OutFile "Syncplay-$version-Setup.exe" InstallDir $$PROGRAMFILES\Syncplay RequestExecutionLevel admin XPStyle on From 5446b549f82dc9a3d9969d4e1eca1bd6abfb298d Mon Sep 17 00:00:00 2001 From: Etoh Date: Mon, 25 Dec 2017 21:01:04 +0000 Subject: [PATCH 15/21] Add /syncplay_v* to gitignore list --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 6335c67..d3c6767 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ venv /build /dist /syncplay v* +/syncplay_v* syncplay_setup.nsi dist.7z .* From 0de85cbe6fb7ad71eb559f4c56e31f5e07443ae7 Mon Sep 17 00:00:00 2001 From: Etoh Date: Mon, 25 Dec 2017 21:02:52 +0000 Subject: [PATCH 16/21] Move bintray to 1.5.1 --- bintray.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bintray.json b/bintray.json index 8e21765..44df3f7 100644 --- a/bintray.json +++ b/bintray.json @@ -6,7 +6,7 @@ }, "version": { - "name": "1.5.0" + "name": "1.5.1" }, "files": @@ -16,4 +16,4 @@ "override": 1 }} ], "publish": true -} \ No newline at end of file +} From c4ee8028fc185902e4a3ea61e5970e29b7e68bd4 Mon Sep 17 00:00:00 2001 From: Etoh Date: Mon, 25 Dec 2017 21:10:09 +0000 Subject: [PATCH 17/21] Update bintray.json --- bintray.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bintray.json b/bintray.json index 44df3f7..6ecef62 100644 --- a/bintray.json +++ b/bintray.json @@ -6,7 +6,7 @@ }, "version": { - "name": "1.5.1" + "name": "v1.5.1" }, "files": From 4674cadca3f71977b8941bb44acd0e93df8c9666 Mon Sep 17 00:00:00 2001 From: Etoh Date: Mon, 25 Dec 2017 21:14:42 +0000 Subject: [PATCH 18/21] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d394743..9995dd2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,7 @@ before_deploy: - 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 -- dmgbuild -s appdmg.py "Syncplay" dist_dmg/Syncplay_macOS.dmg +- dmgbuild -s appdmg.py "Syncplay" dist_dmg/Syncplay_$(ver)_macOS.dmg deploy: on: master From b568652824c7438c11d4cf6f74bc9ffde1221353 Mon Sep 17 00:00:00 2001 From: Etoh Date: Wed, 27 Dec 2017 20:40:25 +0000 Subject: [PATCH 19/21] Add support for K-Lite version of MPC-HC --- syncplay/players/mpc.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/syncplay/players/mpc.py b/syncplay/players/mpc.py index 1dc3064..c274ef7 100644 --- a/syncplay/players/mpc.py +++ b/syncplay/players/mpc.py @@ -479,7 +479,7 @@ class MPCHCAPIPlayer(BasePlayer): @staticmethod def getIconPath(path): - if MPCHCAPIPlayer.getExpandedPath(path).lower().endswith(u'mpc-hc64.exe'.lower()): + if MPCHCAPIPlayer.getExpandedPath(path).lower().endswith(u'mpc-hc64.exe'.lower()) or MPCHCAPIPlayer.getExpandedPath(path).lower().endswith(u'mpc-hc64_nvo.exe'.lower()): return constants.MPC64_ICONPATH else: return constants.MPC_ICONPATH @@ -493,7 +493,7 @@ class MPCHCAPIPlayer(BasePlayer): @staticmethod def getExpandedPath(path): if os.path.isfile(path): - if path.lower().endswith(u'mpc-hc.exe'.lower()) or path.lower().endswith(u'mpc-hc64.exe'.lower()): + if path.lower().endswith(u'mpc-hc.exe'.lower()) or path.lower().endswith(u'mpc-hc64.exe'.lower()) or path.lower().endswith(u'mpc-hc64_nvo.exe'.lower()) or path.lower().endswith(u'mpc-hc_nvo.exe'.lower()): return path if os.path.isfile(path + u"mpc-hc.exe"): path += u"mpc-hc.exe" @@ -501,9 +501,22 @@ class MPCHCAPIPlayer(BasePlayer): if os.path.isfile(path + u"\\mpc-hc.exe"): path += u"\\mpc-hc.exe" return path + if os.path.isfile(path + u"mpc-hc_nvo.exe"): + path += u"mpc-hc_nvo.exe" + return path + if os.path.isfile(path + u"\\mpc-hc_nvo.exe"): + path += u"\\mpc-hc_nvo.exe" + return path if os.path.isfile(path + u"mpc-hc64.exe"): path += u"mpc-hc64.exe" return path if os.path.isfile(path + u"\\mpc-hc64.exe"): path += u"\\mpc-hc64.exe" return path + if os.path.isfile(path + u"mpc-hc64_nvo.exe"): + path += u"mpc-hc64_nvo.exe" + return path + if os.path.isfile(path + u"\\mpc-hc64_nvo.exe"): + path += u"\\mpc-hc64_nvo.exe" + return path + From 78c29ec5b2d474c0612ed75353db2da586667653 Mon Sep 17 00:00:00 2001 From: Etoh Date: Mon, 8 Jan 2018 00:56:32 +0000 Subject: [PATCH 20/21] Fix Syncplay handling of file duration in mpv >~0.28.0 caused by mpv commit 877775f --- syncplay/constants.py | 2 +- syncplay/players/mplayer.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/syncplay/constants.py b/syncplay/constants.py index 891df7a..02913f4 100644 --- a/syncplay/constants.py +++ b/syncplay/constants.py @@ -177,7 +177,7 @@ USERLIST_GUI_FILENAME_COLUMN = 3 MPLAYER_SLAVE_ARGS = ['-slave', '--hr-seek=always', '-nomsgcolor', '-msglevel', 'all=1:global=4:cplayer=4', '-af-add', 'scaletempo'] MPV_ARGS = ['--force-window', '--idle', '--hr-seek=always', '--keep-open'] MPV_SLAVE_ARGS = ['--msg-level=all=error,cplayer=info,term-msg=info', '--input-terminal=no', '--input-file=/dev/stdin'] -MPV_SLAVE_ARGS_NEW = ['--term-playing-msg=\nANS_filename=${filename}\nANS_length=${=length:${=duration:0}}\nANS_path=${path}\n', '--terminal=yes'] +MPV_SLAVE_ARGS_NEW = ['--term-playing-msg=\nANS_filename=${filename}\nANS_length=${=duration:${=length:0}}\nANS_path=${path}\n', '--terminal=yes'] MPV_NEW_VERSION = False VLC_SLAVE_ARGS = ['--extraintf=luaintf', '--lua-intf=syncplay', '--no-quiet', '--no-input-fast-seek', '--play-and-pause', '--start-time=0'] diff --git a/syncplay/players/mplayer.py b/syncplay/players/mplayer.py index 56e6b4e..a0a610d 100644 --- a/syncplay/players/mplayer.py +++ b/syncplay/players/mplayer.py @@ -183,7 +183,10 @@ class MplayerPlayer(BasePlayer): self._storePauseState(bool(value == 'yes')) self._pausedAsk.set() elif name == "length": - self._duration = float(value) + try: + self._duration = float(value) + except: + self._duration = 0 self._durationAsk.set() elif name == "path": self._filepath = value From a24ec1951768c3aa429a2dfd3c447eb74bbd88c4 Mon Sep 17 00:00:00 2001 From: Etoh Date: Mon, 8 Jan 2018 01:09:09 +0000 Subject: [PATCH 21/21] Fix Syncplay handling of file duration in mpv (part 2) --- syncplay/players/mpv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syncplay/players/mpv.py b/syncplay/players/mpv.py index 0278876..88bd7a3 100644 --- a/syncplay/players/mpv.py +++ b/syncplay/players/mpv.py @@ -124,7 +124,7 @@ class NewMpvPlayer(OldMpvPlayer): if property_ in floatProperties: propertyID = u"={}".format(property_) elif property_ == 'length': - propertyID = u'=length:${=duration:0}' + propertyID = u'=duration:${=length:0}' else: propertyID = property_ self._listener.sendLine(u"print_text ""ANS_{}=${{{}}}""".format(property_, propertyID))