From cd0b6541a3bfe0f332c09dda734ab71ec54a9eb4 Mon Sep 17 00:00:00 2001 From: Ace Date: Wed, 12 Feb 2020 16:23:44 +0100 Subject: [PATCH] Added function to check for software updates --- settings/configuration.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/settings/configuration.py b/settings/configuration.py index 1f5327d..63e80b2 100644 --- a/settings/configuration.py +++ b/settings/configuration.py @@ -16,6 +16,7 @@ from pytz import timezone import os from glob import glob import importlib +import subprocess as subp """Set the image background colour and text colour""" background_colour = 'white' @@ -279,3 +280,17 @@ def calibrate_display(no_of_cycles): print('-----------Calibration complete----------') epaper.sleep() + +def check_for_updates(): + with open(path+'Info.txt','r') as file: + lines = file.readlines() + installed_release = 'v'+lines[2].rstrip().split(' ')[1] + temp = subp.check_output(['curl','-s','https://github.com/aceisace/Inky-Calendar/releases/latest']) + latest_release_url = str(temp).split('"')[1] + latest_release = latest_release_url.split('/tag/')[1] + if installed_release == latest_release: + print('You are using the latest version of the Inky-Calendar software:', end = ' ') + print(installed_release) + else: + print('New update available!. Please update to the latest version') + print('current release:', installed_release, 'new version:', latest_release)