Better update handling
Info.txt will not be created when installing manually. As a result, any dependency of info.txt will backfire. This approach switches from Info.txt to release.txt. Info.txt is depreceated now as it is no longer required.
This commit is contained in:
parent
7e34b70f88
commit
59ac74c194
@ -282,15 +282,25 @@ def calibrate_display(no_of_cycles):
|
||||
epaper.sleep()
|
||||
|
||||
def check_for_updates():
|
||||
with open(path+'Info.txt','r') as file:
|
||||
with open(path+'release.txt','r') as file:
|
||||
lines = file.readlines()
|
||||
installed_release = 'v'+lines[2].rstrip().split(' ')[1]
|
||||
installed_release = lines[0].rstrip()
|
||||
|
||||
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:
|
||||
|
||||
def get_id(version):
|
||||
if not version.startswith('v'):
|
||||
print('incorrect release format!')
|
||||
v = ''.join(version.split('v')[1].split('.'))
|
||||
if len(v) == 2:
|
||||
v += '0'
|
||||
return int(v)
|
||||
|
||||
if get_id(installed_release) < get_id(latest_release):
|
||||
print('New update available!. Please update to the latest version')
|
||||
print('current release:', installed_release, 'new version:', latest_release)
|
||||
else:
|
||||
print('You are using the latest version of the Inky-Calendar software:', end = ' ')
|
||||
print(installed_release)
|
||||
|
Loading…
Reference in New Issue
Block a user