From a035e906cbe4a80bcf27e8c1b3aac322a6520414 Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Wed, 27 Feb 2019 10:20:34 -0700 Subject: automatically check for updates --- requirements.txt | 1 + setup.py | 4 +++- vidslice.py | 19 ++++++++++++++++++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 3e4d57b..16a7ca2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ wxPython==4.0.4 cx_Freeze +agithub diff --git a/setup.py b/setup.py index a65edaa..8e63656 100644 --- a/setup.py +++ b/setup.py @@ -6,6 +6,8 @@ buildOptions = dict(packages=[], excludes=[]) import sys +from vidslice import VERSION + base = 'Win32GUI' if sys.platform == 'win32' else None executables = [ @@ -13,7 +15,7 @@ executables = [ ] setup(name='vidslice', - version='1.1', + version=VERSION, description='', options=dict(build_exe=buildOptions), executables=executables) diff --git a/vidslice.py b/vidslice.py index b9dcae9..b9213e8 100644 --- a/vidslice.py +++ b/vidslice.py @@ -3,11 +3,27 @@ import sys import wx import wx.adv +from agithub.GitHub import GitHub from options import OptionsPanel from output import OutputPanel from sources import SourcesPanel, update_ytdl +VERSION = "1.2" + + +def check_update(parent): + client = GitHub() + status, data = client.repos.boringcactus.vidslice.releases.latest.get() + if status == 200: + newest_version = data['tag_name'].lstrip('v') + if VERSION != newest_version: + answer = wx.MessageBox("vidslice update available. download?", "Update", wx.YES_NO, parent) + if answer == wx.YES: + import webbrowser + + webbrowser.open("https://github.com/boringcactus/vidslice/releases/latest") + def has_ffmpeg(): try: @@ -109,7 +125,7 @@ class VidsliceFrame(wx.Frame): """Display an About Dialog""" info = wx.adv.AboutDialogInfo() info.SetName("vidslice") - info.SetVersion("1.1") + info.SetVersion(VERSION) info.SetDescription("video manipulator wrapping youtube-dl and ffmpeg") info.SetWebSite("https://github.com/boringcactus/vidslice") @@ -130,4 +146,5 @@ if __name__ == '__main__': frm = VidsliceFrame(None, title='vidslice') app.SetTopWindow(frm) frm.Show() + check_update(frm) app.MainLoop() -- cgit v1.2.3