AmpliPi icon indicating copy to clipboard operation
AmpliPi copied to clipboard

Add New Release Available endpoint

Open linknum23 opened this issue 3 years ago • 1 comments

linknum23 avatar May 05 '22 21:05 linknum23

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

linknum23 avatar May 12 '22 21:05 linknum23

With 0.1.9 this should be fully automatable by comparing the info.version and info.latest_release.

linknum23 avatar Sep 20 '22 19:09 linknum23

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')

linknum23 avatar Sep 20 '22 19:09 linknum23