diff --git a/README.md b/README.md
index 5d4d749..942e9e1 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@ This is a [PESOS](https://indieweb.org/PESOS) style website maker.
## work in progress.
* download and parse rss only on startup not on every index.html download
-* make sort_order types
+* make sort_order types done
* sort_order options are: default(same order as rss), reverse, random, chronological, reverse-chronological.
* make limits to amount of entries. done
* make category filter.
diff --git a/app.py b/app.py
index 401b94d..b135b42 100644
--- a/app.py
+++ b/app.py
@@ -1,6 +1,6 @@
import os
from flask import Flask
-
+import flask_apscheduler
# from flask_sqlalchemy import SQLAlchemy
# db = SQLAlchemy()
# migrate = Migrate()
@@ -8,9 +8,16 @@ from flask import Flask
def create_app():
APP = Flask(__name__)
+ scheduler = flask_apscheduler.APScheduler()
+ scheduler.api_enabled = False
+ scheduler.init_app(APP)
+ scheduler.start()
# APP.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///data/crunk_data.db"
# APP.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = True
# db.init_app(APP)
# migrate.init_app(APP, db, render_as_batch=True)
-
+ @scheduler.task("interval", id="update", minutes=10)
+ def update():
+ print("Updating the RSS feeds!")
+
return APP
diff --git a/column.py b/column.py
index 6d0101d..cd2fda1 100644
--- a/column.py
+++ b/column.py
@@ -1,5 +1,6 @@
import random
from datetime import datetime
+from time import mktime
from parse_rss_feeds import parse_rss_feeds
@@ -29,17 +30,13 @@ class Column:
return
if self.sort_order.lower() == "chronological":
entrylist.sort(
- key=lambda x: datetime.strptime(
- x[1][1], "%a, %d %b %Y %H:%M:%S %z"
- )
+ key=lambda x: datetime.fromtimestamp(mktime(x[1][1]))
)
self.entries = dict(entrylist)
return
if self.sort_order.lower() == "reverse-chronological":
entrylist.sort(
- key=lambda x: datetime.strptime(
- x[1][1], "%a, %d %b %Y %H:%M:%S %z"
- )
+ key=lambda x: datetime.fromtimestamp(mktime(x[1][1]))
)
entrylist.reverse()
self.entries = dict(entrylist)
diff --git a/columns.toml b/columns.toml
index 23d10ce..d51ed2d 100644
--- a/columns.toml
+++ b/columns.toml
@@ -1,10 +1,20 @@
[[column]]
urls = ["https://varia.zone/logs/x-y/feed.rss.xml","https://varia.zone/logs/x-y-protocols/feed.rss.xml"]
title = "code"
-limit = 40
+limit = 5
sort_order = "random"
[[column]]
-urls = ["https://post.lurk.org/@cmos4040.rss","https://post.lurk.org/tags/radio.rss"]
+urls = ["https://post.lurk.org/@cmos4040.rss"]
title = "circulations"
+sort_order = "reverse"
+
+[[column]]
+urls = ["https://post.lurk.org/tags/radio.rss"]
+title = "radio"
sort_order = "reverse-chronological"
+
+[[column]]
+urls = ["https://post.lurk.org/tags/forth.rss"]
+title = "forth"
+sort_order = "chronological"
diff --git a/parse_rss_feeds.py b/parse_rss_feeds.py
index 824ae8d..6306883 100644
--- a/parse_rss_feeds.py
+++ b/parse_rss_feeds.py
@@ -14,7 +14,7 @@ def _parse_single_rss_feed(url, entries):
entries[title] = []
entrylist = entries[title]
entrylist.append(entry.description)
- entrylist.append(entry.published)
+ entrylist.append(entry.published_parsed)
return entries
diff --git a/start.py b/start.py
index e25e339..e7c5170 100644
--- a/start.py
+++ b/start.py
@@ -1,7 +1,5 @@
-from flask import (
- render_template,
-)
import tomli
+from flask import render_template
from app import create_app
from column import Column
@@ -13,6 +11,7 @@ APP = create_app()
def index():
with open("columns.toml", "rb") as f:
column_dict = tomli.load(f)
+
columns_file = column_dict["column"]
columns = []
for column_from_file in columns_file:
diff --git a/static/css/base.css b/static/css/base.css
index 2ffafba..33bf07a 100644
--- a/static/css/base.css
+++ b/static/css/base.css
@@ -1,12 +1,14 @@
body {
text-rendering: optimizelegibility;
-moz-text-size-adjust: none;
+ margin: 0px;
}
.crunkcolumns {
display: grid;
grid-auto-flow: column;
- grid-gap: 10px;
- grid-template-columns: repeat(auto-fill, 350px);
+ grid-gap: 1px;
+ grid-template-columns: repeat(auto-fill, 336px);
+ margin-left: 6px;
}
.feed {
@@ -15,7 +17,7 @@ body {
.feeditem {
display: flex;
- width: 350px;
+ width: 336px;
position: relative;
flex-direction: column;
box-sizing: border-box;
diff --git a/static/css/template.css b/static/css/template.css
new file mode 100644
index 0000000..a7b5396
--- /dev/null
+++ b/static/css/template.css
@@ -0,0 +1 @@
+/* copy and adjust from base.css */
diff --git a/templates/base.html b/templates/base.html
index 8e5c2de..190c7c8 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -5,6 +5,7 @@