diff --git a/app/app.py b/app/app.py index a28e1e1..a7e1217 100644 --- a/app/app.py +++ b/app/app.py @@ -1,6 +1,8 @@ +import os import glob import configparser import random +import datetime import requests import flask @@ -15,6 +17,7 @@ CONFIG_PATH = "./config.ini" config = configparser.ConfigParser() config.read(CONFIG_PATH) +WRITING_FOLDER = 'static/writing/' POSTS_FOLDER = config['POSTS']['POSTS_FOLDER'] STATUS_FILE = config['STATUS']['STATUS_FILE'] PORT = int(config['NETWORK']['PORT']) @@ -161,6 +164,31 @@ def programming(): return flask.render_template('programming.html', posts=post_bodies, status=status) +@app.route('/writing/') +def writing(): + + works = [] + + # Get all works in writing folder + files = glob.glob(WRITING_FOLDER + '*') + + for path in files: + + date: str = datetime.datetime.fromtimestamp(os.path.getctime(path)).strftime("%B %d, %Y") + name: str = path.split('/')[-1] + + works.append({ + 'date' : date, + 'name' : name, + 'path' : path + }) + + return flask.render_template('writing.html', works=works) + + + + + # About Page @app.route('/about/') def about(): diff --git a/app/static/writing.html b/app/static/writing.html deleted file mode 100644 index 44de92c..0000000 --- a/app/static/writing.html +++ /dev/null @@ -1,9 +0,0 @@ - - - - home -
-
- Scream March 27th, 2024 - - \ No newline at end of file diff --git a/app/templates/about.html b/app/templates/about.html index a2663fc..ce7774c 100644 --- a/app/templates/about.html +++ b/app/templates/about.html @@ -18,6 +18,7 @@ Music
Motion Picture
Programming
+ Writing
About diff --git a/app/templates/games.html b/app/templates/games.html index d023f8b..0ffded7 100644 --- a/app/templates/games.html +++ b/app/templates/games.html @@ -18,6 +18,7 @@ Music
Motion Picture
Programming
+ Writing
About diff --git a/app/templates/index.html b/app/templates/index.html index 51412b8..def98bd 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -18,7 +18,7 @@ Music
Motion Picture
Programming
- Writing
+ Writing
About diff --git a/app/templates/motion-pictures.html b/app/templates/motion-pictures.html index 459f655..87d36f9 100644 --- a/app/templates/motion-pictures.html +++ b/app/templates/motion-pictures.html @@ -18,6 +18,7 @@ Music
Motion Picture
Programming
+ Writing
About diff --git a/app/templates/music.html b/app/templates/music.html index f2c0fcf..5ea89f3 100644 --- a/app/templates/music.html +++ b/app/templates/music.html @@ -18,6 +18,7 @@ Music
Motion Picture
Programming
+ Writing
About diff --git a/app/templates/programming.html b/app/templates/programming.html index 2d42ceb..d146ccd 100644 --- a/app/templates/programming.html +++ b/app/templates/programming.html @@ -18,6 +18,7 @@ Music
Motion Picture
Programming
+ Writing
About diff --git a/app/templates/writing.html b/app/templates/writing.html new file mode 100644 index 0000000..09df245 --- /dev/null +++ b/app/templates/writing.html @@ -0,0 +1,11 @@ + + + + home +
+
+ {% for work in works %} + {{ work.name }} {{ work.date }} + {% endfor %} + + \ No newline at end of file