summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@gmail.com>2022-02-22 19:19:32 +0100
committerKévin Le Gouguec <kevin.legouguec@gmail.com>2022-02-22 22:40:17 +0100
commit1bb633ff40d2e3f4994f8c40d8dfd005920f3562 (patch)
tree9fe6f7ede143971d7b536ec8651fe9ba0f3aa9d9
parent34c2911036b8fc197ea309f2c34516800441916b (diff)
downloadquatuorbellefeuille.com-1bb633ff40d2e3f4994f8c40d8dfd005920f3562.tar.xz
[wip] Add channel pubDate and lastBuildDate
-rwxr-xr-xbuild-feed.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/build-feed.py b/build-feed.py
index 3e56576..fb85cab 100755
--- a/build-feed.py
+++ b/build-feed.py
@@ -1,5 +1,6 @@
#!/usr/bin/env python3
+from datetime import datetime
from sys import argv
from urllib.parse import urljoin
@@ -15,6 +16,13 @@ from helpers import (
)
+TIMEZONE = datetime.now().astimezone().tzinfo
+NOW = datetime.now(tz=TIMEZONE)
+DATE_FORMAT = '%-d %b %Y %H:%M %z'
+
+# TODO: add item pubDate
+
+
LOCALIZED_TEXT = {
'en': {
'title': 'Bellefeuille Quartet',
@@ -104,6 +112,8 @@ def main(concerts_src, feed_dst, domain):
index_url = urljoin(url, text['indexpath'])
concerts_url = urljoin(index_url, 'concerts.html')
+ now_formatted = NOW.strftime(DATE_FORMAT)
+
rss = E.rss(
E.channel(
E.title(text['title']),
@@ -113,6 +123,8 @@ def main(concerts_src, feed_dst, domain):
E.url(urljoin(url, 'images/logo.svg')),
E.link(concerts_url),
),
+ E.lastBuildDate(now_formatted),
+ E.pubDate(now_formatted),
E.language(lang),
*generate_concerts(concerts_src, concerts_url, lang),
),