update opml generator

This commit is contained in:
Aine 2024-03-31 12:51:14 +03:00
parent e9047f97fc
commit 844e93816a
No known key found for this signature in database
GPG key ID: 34969C908CCA2804
2 changed files with 12 additions and 30 deletions

View file

@ -8,7 +8,7 @@ parser = argparse.ArgumentParser(description='Extracts release feeds from roles'
parser.add_argument('root_dir', help='Root dir which to traverse recursively for defaults/main.yml roles files')
parser.add_argument('action', help='Pass "check" to list roles with missing feeds or "dump" to dump an OPML file')
args = parser.parse_args()
if args.action not in ['check', 'dump', 'hookshot']:
if args.action not in ['check', 'dump']:
sys.exit('Error: possible arguments are "check" or "dump"')
excluded_paths = [
@ -71,30 +71,21 @@ def validate_url(text):
def format_feeds_from_git_repos(git_repos):
feeds = {
'ansible': {
'text': 'ansible',
'title': 'ansible',
'type': 'rss',
'htmlUrl': 'https://pypi.org/project/ansible/#history',
'xmlUrl': 'https://pypi.org/rss/project/ansible/releases.xml'
},
'ansible-core': {
'text': 'ansible-core',
'title': 'ansible-core',
'type': 'rss',
'htmlUrl': 'https://pypi.org/project/ansible-core/#history',
'xmlUrl': 'https://pypi.org/rss/project/ansible-core/releases.xml'
}
}
feeds = {}
for role, git_repos in git_repos.items():
for idx, git_repo in enumerate(git_repos):
if 'github' in git_repo:
atomFilePath = git_repo.replace('.git', '') + '/releases.atom'
elif ('gitlab' in git_repo or 'mau.dev' in git_repo):
atomFilePath = git_repo.replace('.git', '') + '/-/tags?format=atom'
elif 'git.zx2c4.com' in git_repo:
elif 'git.zx2c4.com' in git_repo: # cgit
atomFilePath = git_repo + '/atom/'
elif 'framagit.org' in git_repo: # gitlab
atomFilePath = git_repo.replace('.git', '') + '/-/tags?format=atom'
elif 'git.osgeo.org' in git_repo: # gitea
atomFilePath = git_repo.replace('.git', '') + '.atom'
elif 'dev.funkwhale.audio' in git_repo: # gitlab
atomFilePath = git_repo.replace('.git', '') + '/-/tags?format=atom'
else:
print('Unrecognized git repository: %s' % git_repo)
continue
@ -137,14 +128,6 @@ def dump_opml_file_from_feeds(feeds):
tree.write(file_name, encoding = 'UTF-8', xml_declaration = True)
print('Generated %s' % file_name)
def dump_hookshot_commands(feeds):
file_name = 'releases.hookshot.txt'
f = open(file_name, 'w')
for role, feed_dict in feeds.items():
f.write('!hookshot feed %s %s\n' % (feed_dict['xmlUrl'], role))
f.close()
print('Generated %s' % file_name)
if __name__ == '__main__':
file_paths = get_roles_files_from_dir(root_dir=args.root_dir)
break_on_missing = args.action == 'check'
@ -153,5 +136,3 @@ if __name__ == '__main__':
if args.action == 'dump':
dump_opml_file_from_feeds(feeds)
if args.action == 'hookshot':
dump_hookshot_commands(feeds)

View file

@ -5,8 +5,6 @@
</head>
<body>
<outline text="adguard_home" title="adguard_home" type="rss" htmlUrl="https://github.com/AdguardTeam/AdguardHome" xmlUrl="https://github.com/AdguardTeam/AdguardHome/releases.atom" />
<outline text="ansible" title="ansible" type="rss" htmlUrl="https://pypi.org/project/ansible/#history" xmlUrl="https://pypi.org/rss/project/ansible/releases.xml" />
<outline text="ansible-core" title="ansible-core" type="rss" htmlUrl="https://pypi.org/project/ansible-core/#history" xmlUrl="https://pypi.org/rss/project/ansible-core/releases.xml" />
<outline text="apisix_dashboard" title="apisix_dashboard" type="rss" htmlUrl="https://github.com/apache/apisix-dashboard" xmlUrl="https://github.com/apache/apisix-dashboard/releases.atom" />
<outline text="apisix_gateway" title="apisix_gateway" type="rss" htmlUrl="https://github.com/apache/apisix" xmlUrl="https://github.com/apache/apisix/releases.atom" />
<outline text="appsmith" title="appsmith" type="rss" htmlUrl="https://github.com/appsmithorg/appsmith" xmlUrl="https://github.com/appsmithorg/appsmith/releases.atom" />
@ -22,6 +20,7 @@
<outline text="exim_relay" title="exim_relay" type="rss" htmlUrl="https://github.com/devture/exim-relay" xmlUrl="https://github.com/devture/exim-relay/releases.atom" />
<outline text="focalboard" title="focalboard" type="rss" htmlUrl="https://github.com/mattermost/focalboard" xmlUrl="https://github.com/mattermost/focalboard/releases.atom" />
<outline text="freshrss" title="freshrss" type="rss" htmlUrl="https://github.com/freshrss/freshrss" xmlUrl="https://github.com/freshrss/freshrss/releases.atom" />
<outline text="funkwhale" title="funkwhale" type="rss" htmlUrl="https://dev.funkwhale.audio/funkwhale/funkwhale" xmlUrl="https://dev.funkwhale.audio/funkwhale/funkwhale/-/tags?format=atom" />
<outline text="grafana" title="grafana" type="rss" htmlUrl="https://github.com/grafana/grafana" xmlUrl="https://github.com/grafana/grafana/releases.atom" />
<outline text="healthchecks" title="healthchecks" type="rss" htmlUrl="https://github.com/healthchecks/healthchecks" xmlUrl="https://github.com/healthchecks/healthchecks/releases.atom" />
<outline text="infisical" title="infisical" type="rss" htmlUrl="https://github.com/Infisical/infisical" xmlUrl="https://github.com/Infisical/infisical/releases.atom" />
@ -34,6 +33,7 @@
<outline text="linkding" title="linkding" type="rss" htmlUrl="https://github.com/sissbruecker/linkding" xmlUrl="https://github.com/sissbruecker/linkding/releases.atom" />
<outline text="loki" title="loki" type="rss" htmlUrl="https://github.com/grafana/loki" xmlUrl="https://github.com/grafana/loki/releases.atom" />
<outline text="miniflux" title="miniflux" type="rss" htmlUrl="https://github.com/miniflux/v2" xmlUrl="https://github.com/miniflux/v2/releases.atom" />
<outline text="mobilizon" title="mobilizon" type="rss" htmlUrl="https://framagit.org/framasoft/mobilizon/" xmlUrl="https://framagit.org/framasoft/mobilizon//-/tags?format=atom" />
<outline text="mongodb" title="mongodb" type="rss" htmlUrl="https://github.com/mongodb/mongo" xmlUrl="https://github.com/mongodb/mongo/releases.atom" />
<outline text="n8n" title="n8n" type="rss" htmlUrl="https://github.com/n8n-io/n8n" xmlUrl="https://github.com/n8n-io/n8n/releases.atom" />
<outline text="navidrome" title="navidrome" type="rss" htmlUrl="https://github.com/navidrome/navidrome" xmlUrl="https://github.com/navidrome/navidrome/releases.atom" />
@ -41,6 +41,7 @@
<outline text="outline" title="outline" type="rss" htmlUrl="https://github.com/outline/outline" xmlUrl="https://github.com/outline/outline/releases.atom" />
<outline text="owncast" title="owncast" type="rss" htmlUrl="https://github.com/owncast/owncast" xmlUrl="https://github.com/owncast/owncast/releases.atom" />
<outline text="peertube" title="peertube" type="rss" htmlUrl="https://github.com/Chocobozzz/PeerTube" xmlUrl="https://github.com/Chocobozzz/PeerTube/releases.atom" />
<outline text="postgis" title="postgis" type="rss" htmlUrl="https://git.osgeo.org/gitea/postgis/postgis" xmlUrl="https://git.osgeo.org/gitea/postgis/postgis.atom" />
<outline text="postgres" title="postgres" type="rss" htmlUrl="https://github.com/postgres/postgres" xmlUrl="https://github.com/postgres/postgres/releases.atom" />
<outline text="postgres_backup" title="postgres_backup" type="rss" htmlUrl="https://github.com/prodrigestivill/docker-postgres-backup-local" xmlUrl="https://github.com/prodrigestivill/docker-postgres-backup-local/releases.atom" />
<outline text="prometheus" title="prometheus" type="rss" htmlUrl="https://github.com/prometheus/prometheus" xmlUrl="https://github.com/prometheus/prometheus/releases.atom" />