Skip to content

Commit

Permalink
Update checker
Browse files Browse the repository at this point in the history
  • Loading branch information
cittyinthecloud committed May 20, 2018
1 parent 8539f32 commit 7d74820
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
16 changes: 15 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,27 @@
import tempfile
import os
import logging

import requests

app = Flask(__name__)
modspath = Path.cwd()/"mods"
logging.basicConfig(filename='fDDMEPlayer.log', filemode='w', level=logging.INFO, format="[%(levelname)s|%(levelno)s] (%(funcName)s) %(message)s")

addmodgui = None

VERSION_URL="https://raw.githubusercontent.com/famous1622/fDDMEPlayer/master/version"

def checkVersion():
r = requests.get(VERSION_URL)
try:
r.raise_for_status()
except requests.exceptions.HTTPError as e:
logging.warning("Update check failed :( {0}".format(e))
else:
with open("version") as fp:
if fp.read() != r.text:
print("New version {0} available! Please download this from https://github.com/famous1622/fDDMEPlayer".format(r.text.strip()))

def findParent(names, path):
for root, dirs, files in os.walk(path):
for name in names:
Expand Down Expand Up @@ -121,5 +134,6 @@ def quitprogram():
print("Press enter to continue...")
input()
raise SystemExit
checkVersion()
print("Open your web brower to localhost:5000")
app.run(threaded=False)
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
appjar
flask
python-slugify

requests
1 change: 1 addition & 0 deletions update.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pip install -r requirements.txt
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.1
v0.1.1

0 comments on commit 7d74820

Please sign in to comment.