Simplify Python script (#71)

This commit is contained in:
Bas Nijholt 2021-01-04 20:27:29 +01:00 committed by GitHub
parent 00352c8c4e
commit b49feaa906
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -84,21 +84,18 @@ msg "Getting URL for latest Home Assistant disk image..."
RELEASE_EXT=vmdk.gz
URL=$(cat<<EOF | python3
import requests
url = 'https://api.github.com/repos/home-assistant/operating-system/releases'
url = "https://api.github.com/repos/home-assistant/operating-system/releases"
r = requests.get(url).json()
if 'message' in r:
if "message" in r:
exit()
for release in r:
if release['prerelease']:
if release["prerelease"]:
continue
for asset in release['assets']:
if asset['name'].endswith('$RELEASE_EXT'):
global image_url
image_url = asset['browser_download_url']
break
if 'image_url' in globals():
for asset in release["assets"]:
if asset["name"].endswith("$RELEASE_EXT"):
image_url = asset["browser_download_url"]
print(image_url)
break
exit()
EOF
)
if [ -z "$URL" ]; then