diff --git a/.appveyor.yml b/.appveyor.yml index 1a9351d..824e7d1 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,44 +1,44 @@ 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 + - 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 + - pip install twisted py2exe_py2 zope.interface + - type nul > C:\Miniconda\envs\syncplay\lib\site-packages\zope\__init__.py + - pip freeze + - conda list install: - - cmd: cd c:\projects\syncplay - - cmd: python buildPy2exe.py - - cmd: del C:\projects\syncplay\syncplay_v1.5.0\lib\DNSAPI.dll - - cmd: del C:\projects\syncplay\syncplay_v1.5.0\lib\MPR.dll - - cmd: mkdir C:\projects\syncplay\syncplay_v1.5.0\platforms - #- cmd: copy C:\Miniconda\envs\syncplay\library\plugins\platforms\qwindows.dll C:\projects\syncplay\syncplay_v1.5.0\platforms\ + - cd %APPVEYOR_BUILD_FOLDER% + - 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_v1.5.0' - 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: - - 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: @@ -51,4 +51,5 @@ deploy: package: Syncplay version: "test" publish: true - override: true \ No newline at end of file + override: true + \ No newline at end of file diff --git a/.gitignore b/.gitignore index 8309fad..9b9e6b4 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ venv /build /dist /syncplay v* +/syncplay_v* syncplay_setup.nsi dist.7z .* diff --git a/.travis.yml b/.travis.yml index ef95684..26836c0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,8 @@ 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 +- export VER="$(cat syncplay/__init__.py | awk '/version/ {gsub("\047", "", $3); print $NF}')" +- dmgbuild -s appdmg.py "Syncplay" dist_dmg/Syncplay_$(VER)_macOS.dmg deploy: on: master_local diff --git a/bintray.json b/bintray.json index 9da4879..830cb2a 100644 --- a/bintray.json +++ b/bintray.json @@ -16,4 +16,4 @@ "override": 1 }} ], "publish": true -} \ No newline at end of file +} diff --git a/buildPy2exe.py b/buildPy2exe.py index 452a359..6b2100c 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,21 @@ 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" + 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) + 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""" @@ -48,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 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/constants.py b/syncplay/constants.py index 707ccea..02913f4 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 @@ -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/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 + 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 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)) 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: