|
@ -1,26 +1,14 @@ |
|
|
from flask import ( |
|
|
from flask import ( |
|
|
render_template, |
|
|
render_template, |
|
|
redirect, |
|
|
|
|
|
) |
|
|
) |
|
|
import tomli |
|
|
import tomli |
|
|
|
|
|
|
|
|
from parse_rss_feeds import parse_rss_feeds |
|
|
|
|
|
from app import create_app |
|
|
from app import create_app |
|
|
from column import Column |
|
|
from column import Column |
|
|
|
|
|
|
|
|
APP = create_app() |
|
|
APP = create_app() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@APP.route("/singlefeed") |
|
|
|
|
|
def singlefeed(): |
|
|
|
|
|
with open("columns.toml", "rb") as f: |
|
|
|
|
|
feeds_dict = tomli.load(f) |
|
|
|
|
|
feeds = feeds_dict["column"] |
|
|
|
|
|
|
|
|
|
|
|
feed = parse_rss_feeds(feeds[0]["urls"][0]) |
|
|
|
|
|
return render_template("singlefeed.html", feed=feed) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@APP.route("/") |
|
|
@APP.route("/") |
|
|
def index(): |
|
|
def index(): |
|
|
with open("columns.toml", "rb") as f: |
|
|
with open("columns.toml", "rb") as f: |
|
@ -28,13 +16,16 @@ def index(): |
|
|
columns_file = column_dict["column"] |
|
|
columns_file = column_dict["column"] |
|
|
columns = [] |
|
|
columns = [] |
|
|
for column_from_file in columns_file: |
|
|
for column_from_file in columns_file: |
|
|
entries = parse_rss_feeds(column_from_file["urls"]) |
|
|
urls = column_from_file["urls"] |
|
|
title = column_from_file["title"] |
|
|
title = column_from_file["title"] |
|
|
column = Column(title=title, entries=entries) |
|
|
column = Column(title=title, urls=urls) |
|
|
|
|
|
|
|
|
if "limit" in column_from_file: |
|
|
if "limit" in column_from_file: |
|
|
column.set_limit(column_from_file["limit"]) |
|
|
column.set_limit(column_from_file["limit"]) |
|
|
if "sort_order" in column_from_file: |
|
|
if "sort_order" in column_from_file: |
|
|
column.set_sort_order(column_from_file["sort_order"]) |
|
|
column.set_sort_order(column_from_file["sort_order"]) |
|
|
|
|
|
|
|
|
|
|
|
column.load_content_from_feeds() |
|
|
columns.append(column) |
|
|
columns.append(column) |
|
|
return render_template("index.html", columns=columns) |
|
|
return render_template("index.html", columns=columns) |
|
|
|
|
|
|
|
|