Browse Source

rename feed.rss to feed.rss.xml

master
manetta 3 years ago
parent
commit
2d0391c5e5
  1. 10
      LogBot/logbot.py
  2. 2
      LogBot/template.html
  3. 4
      LogBot/template.rss

10
LogBot/logbot.py

@ -107,13 +107,13 @@ class Logbot(Bot):
folder_name = self.db[message.room]["folder"]
if "@" in folder_name: # hacky
folder_name = self._parse_room_name(folder_name)
feed_path = os.path.join(self.output, folder_name, "feed.rss")
feed_path = os.path.join(self.output, folder_name, "feed.rss.xml")
date = datetime.now()
template = jinja2.Template(open("template.rss").read()) # self.feedtemplate would be useful to have in the conf
with open(feed_path, "w") as out:
feed = template.render(
log_path=os.path.join("https://vvvvvvaria.org/logs/", folder_name, "index.html"), # hardcoding the url now, self.baseurl would be helpful to have in the conf
feed_path=os.path.join("https://vvvvvvaria.org/logs/", folder_name, "feed.rss"), # hardcoding the url again
feed_path=os.path.join("https://vvvvvvaria.org/logs/", folder_name, "feed.rss.xml"), # hardcoding the url again
title=self.db[message.room]["title"],
db=self.db[message.room],
date=date.strftime("%a, %d %b %Y %H:%M:%S +0100") # timezone is hardcoded now
@ -132,17 +132,17 @@ class Logbot(Bot):
new_key = str(int(keys[-1]) + 1)
if media_post:
self.db[message.room]["messages"][new_key] = {}
self.db[message.room]["messages"][new_key]['post'] = media_post
self.db[message.room]["messages"][new_key]['post'] = bleach.clean(media_post)
self.db[message.room]["messages"][new_key]['date'] = date
self.db[message.room]["messages"][new_key]['media'] = {}
self.db[message.room]["messages"][new_key]['media']['type'] = media_type
self.db[message.room]["messages"][new_key]['media']['url'] = os.path.join("https://vvvvvvaria.org/logs/", media_url)
self.db[message.room]["messages"][new_key]['media']['size'] = media_size
self.db[message.room]["messages"][new_key]['date'] = date
else:
post = message.content.replace("@add ", "")
post = self._href_wrap(post)
self.db[message.room]["messages"][new_key] = {}
self.db[message.room]["messages"][new_key]['post'] = post
self.db[message.room]["messages"][new_key]['post'] = bleach.clean(post)
self.db[message.room]["messages"][new_key]['date'] = date
self.db._dumps()

2
LogBot/template.html

@ -8,7 +8,7 @@
</head>
<body>
<h1>{{ title }}</h1>
(Follow this log: <a href="./feed.rss">RSS</a>)
(Follow this log: <a href="./feed.rss.xml">RSS</a>)
<div id="container">
{% for num in sorted_numbering | reverse %}
<div id="{{ num }}" class="post">

4
LogBot/template.rss

@ -11,7 +11,9 @@
<title>{{ title }} #{{ x }}</title>
<link>{{ log_path }}#{{ x }}</link>
<guid>{{ log_path }}#{{ x }}</guid>
<description><![CDATA[{{ post.post }}]]></description>
<description><![CDATA[
{{ post.post }}
]]></description>
{% if 'media' in post %}<enclosure url="{{ post.media.url }}" length="{{ post.media.size }}" type="{{ post.media.type }}" />{% endif %}
<dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">LogBot</dc:creator>
<pubDate>{{ post.date }}</pubDate>

Loading…
Cancel
Save