Commit f6743658 authored by berumuron's avatar berumuron
Browse files

Generate update for feeds based on last article

parent 4d969ab9
......@@ -4,9 +4,6 @@ import os
import sys
import distutils.dir_util
import locale
import datetime
import pytz
import boop.boopfeed as boopfeed
import boop.environment as environment
......@@ -122,30 +119,27 @@ def main(environment):
site_url = configuration["SITE_URL"]
site_uuid = configuration["SITE_UUID"]
site_title = configuration["SITE_TITLE"]
site_timezone = configuration["SITE_TIMEZONE"]
timezone = pytz.timezone(site_timezone)
current_datetime =
feed_dirpath = os.path.join(output_path, "feeds")
if len(articles) > 0:
# Build the main Atom feed
feed = boopfeed.Atom()
"title": site_title,
"self_link": f"{site_url}feeds/all.atom.xml",
"self_link": f"{site_url}feeds/{feed_filename}",
"site_link": site_url,
"id": f"urn:uuid:{site_uuid}",
"updated": current_datetime,
"updated": articles[0].update() or articles[0].date(),
utils.add_articles_to_feed(feed, articles)
# And write it on the filesystem
feed_filepath = os.path.join(feed_dirpath, "all.atom.xml")
print(f"Written feed: {site_url}feeds/all.atom.xml")
print(f"Written feed: {site_url}feeds/{feed_filename}")
# Now, build the feeds for series (same process)
for serie, serie_articles in articles_by_series.items():
......@@ -159,12 +153,11 @@ def main(environment):
"self_link": f"{site_url}feeds/{feed_filename}",
"site_link": serie.url(),
"id": f"urn:uuid:{serie.uuid()}",
"updated": current_datetime,
"updated": serie_articles[0].update() or serie_articles[0].date(),
utils.add_articles_to_feed(feed, serie_articles)
# And write it on the filesystem
print(f"Written feed: {site_url}feeds/{feed_filename}")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment