#!/usr/bin/env python3 import argparse import feedparser import json import subprocess import time parser = argparse.ArgumentParser() parser.add_argument('--state_file', help = 'Path to a file in which to store state.') args = parser.parse_args() k_feeds = { 'tildefriends': 'https://dev.tildefriends.net/cory/tildefriends.rss', 'erlbutt': 'https://github.com/cmoid/erlbutt/commits/main.atom', 'habitat': 'https://tildegit.org/jeremylist/habitat.rss', 'manyverse': 'https://gitlab.com/staltz/manyverse/-/commits/master?format=atom', 'ahau': 'https://gitlab.com/ahau/ahau/-/commits/master.atom', } def fix_title(entry): if entry.summary.startswith(' cutoff] if entries: text = '\n'.join([f' * [{entry[1]}] [{entry[3]}]({entry[2]})' for entry in entries]) state['last_update'] = entries[0][0] if args.state_file: content = json.dumps({'type': 'post', 'text': text, 'mentions': []}) subprocess.check_call(['out/debug/tildefriends', 'publish', '--user', 'cory', '--id', '@DnYDqFfmxdNkYQlpflF9Wkltk2HIhJ5u1MW5njKPLzM=.ed25519', '--content', content]) with open(args.state_file, 'w') as f: json.dump(state, f) else: print(text)