mirror of
https://github.com/tiyn/container-critique.git
synced 2025-04-01 23:57:49 +02:00
src: added rss
This commit is contained in:
parent
61aa869b93
commit
65c5ff76bc
@ -55,6 +55,8 @@ def entry(ident):
|
||||
abort(404)
|
||||
|
||||
|
||||
@app.route("/feed")
|
||||
@app.route("/rss")
|
||||
@app.route("/feed.xml")
|
||||
@app.route("/rss.xml")
|
||||
def feed():
|
||||
|
@ -1,3 +1,4 @@
|
||||
import config
|
||||
from database import Database
|
||||
|
||||
db = Database()
|
||||
@ -113,4 +114,26 @@ def get_rss_string():
|
||||
Returns:
|
||||
string: rss-string of everything that is in the ENTRY_DIR.
|
||||
"""
|
||||
return ""
|
||||
content_string = ""
|
||||
entries = db.get_entries()
|
||||
if entries is None:
|
||||
return ""
|
||||
entries.reverse()
|
||||
for entry in entries:
|
||||
ident = entry[0]
|
||||
title = entry[1]
|
||||
year = entry[2]
|
||||
text = entry[3]
|
||||
rating = entry[4]
|
||||
username = db.get_user_by_id(entry[5])[1]
|
||||
reviewed = entry[6]
|
||||
content_string += "<item>\n"
|
||||
content_string += "<title>" + title + "(" + year + ") " + str(rating) + "/100 </title>\n"
|
||||
content_string += "<guid>" + config.WEBSITE + \
|
||||
"/index.html#" + str(ident) + "</guid>\n"
|
||||
content_string += "<pubDate>" + reviewed + "</pubDate>\n"
|
||||
content_string += "<description>"
|
||||
content_string += text
|
||||
content_string += "</description>\n"
|
||||
content_string += "</item>\n"
|
||||
return content_string
|
||||
|
Loading…
x
Reference in New Issue
Block a user