Initial commit

This commit is contained in:
Lucas Verney 2024-11-18 20:09:06 +01:00
commit 0334a78ad5
5 changed files with 44 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
cache.json
.venv

4
README.md Normal file
View File

@ -0,0 +1,4 @@
Github notifier
===============
Quick and dirty script to be run in crontask with chronic and send email notifications about new Github releases for tracked software.

32
notifier.py Executable file
View File

@ -0,0 +1,32 @@
#!/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)

1
requirements.txt Normal file
View File

@ -0,0 +1 @@
feedparser

5
urls.json Normal file
View File

@ -0,0 +1,5 @@
{
"Gitea": "https://github.com/go-gitea/gitea/",
"Roundcube": "https://github.com/roundcube/roundcubemail/",
"Navidrome": "https://github.com/navidrome/navidrome/"
}