AmpliPi
AmpliPi copied to clipboard
Add New Release Available endpoint
As a workaround for now you may be able to add something that queries github and amplipi for the info
import requests
# find the latest release (GitHub sorts by most recent release)
releases = requests.get('https://api.github.com/repos/micro-nova/AmpliPi/releases').json()
latest_release = None
for release in releases:
if not (release['prerelease'] or release['draft']):
latest_release = release['tag_name']
break
# compare it against the version reported by AmpliPi's API:
status = requests.get('http://amplipi.local/api').json()
current_version = status['info']['version']
if current_version < latest_release:
print('needs update')
EDIT: the code above works, but does not have any real error handling
With 0.1.9 this should be fully automatable by comparing the info.version and info.latest_release.
Here's some example code for how to do the check now in python:
import requests
status = requests.get('http://amplipi.local/api').json()
current_version = status['info']['version']
latest_release = status['info']['latest_release']
if latest_release != 'unknown' and current_version != latest_release:
print('needs update')