def reset_feeds(): feeds = get_all(feeds_db, {}) items = get_all(items_db, {}) links = {} for item in items: links[item["link"]] = True for feed in feeds: feed_link = feed["feed_link"] fd, err = discover_feed(feed_link) if err == None: entries = fd.entries items = convert_items(entries, feed["key"]) update_new(items, links)
def feed_list_handler(): try: list = get_all(feeds_db, {}) for l in list: l["id"] = l.pop("key") return list except: return "Failed to fetch feeds."
def folder_list_handler(): try: list = get_all(folders_db, {}) for l in list: l["id"] = l.pop("key") return list except: raise HTTPException(status_code=400, detail="Failed to fetch folders.")
def reset_feed_errors(): feed_errors = get_all(feed_errors_db, {}) for err in feed_errors: feed_errors_db.delete(err["key"]) return True
def feed_errors_handler(): try: errors = get_all(errors_db, {}) return errors except: raise HTTPException(status_code=400, detail="Failed to fetch errors")