33 lines
694 B
Python
Executable File
33 lines
694 B
Python
Executable File
#!/usr/bin/env python
|
|
import json
|
|
import sys
|
|
|
|
import feedparser
|
|
|
|
URLs_FILE = './urls.json'
|
|
CACHE_FILE = './cache.json'
|
|
exit_code = 0
|
|
|
|
with open(URLs_FILE, 'r') as fh:
|
|
URLs = json.load(fh)
|
|
|
|
try:
|
|
with open(CACHE_FILE, 'r') as fh:
|
|
releases = json.load(fh)
|
|
except:
|
|
releases = {}
|
|
|
|
for name, url in URLs.items():
|
|
url = '/'.join([url, 'releases.atom'])
|
|
d = feedparser.parse(url)
|
|
latest_version = d.entries[0].title
|
|
if latest_version != releases.get(name):
|
|
print(f'New version for {name} ({url}): {latest_version}')
|
|
exit_code = 1
|
|
releases[name] = latest_version
|
|
|
|
with open(CACHE_FILE, 'w') as fh:
|
|
json.dump(releases, fh)
|
|
|
|
sys.exit(exit_code)
|