commit
4815c84be6
45
app/app.py
45
app/app.py
@ -25,6 +25,7 @@ DEV = int(config['NETWORK']['DEV'])
|
|||||||
|
|
||||||
MUSIC_API_TOKEN = config['AUTH']['MUSIC_API_TOKEN']
|
MUSIC_API_TOKEN = config['AUTH']['MUSIC_API_TOKEN']
|
||||||
MUSIC_API_URL = config['NETWORK']['MUSIC_API_URL']
|
MUSIC_API_URL = config['NETWORK']['MUSIC_API_URL']
|
||||||
|
statuses = {}
|
||||||
|
|
||||||
def get_posts(category_filter : str | None = None) -> list[Post]:
|
def get_posts(category_filter : str | None = None) -> list[Post]:
|
||||||
post_files = glob.glob(f'{POSTS_FOLDER}/*')
|
post_files = glob.glob(f'{POSTS_FOLDER}/*')
|
||||||
@ -58,13 +59,36 @@ def get_posts(category_filter : str | None = None) -> list[Post]:
|
|||||||
|
|
||||||
return reversed(ordered_posts)
|
return reversed(ordered_posts)
|
||||||
|
|
||||||
def get_status() -> str:
|
def read_status_file() -> dict:
|
||||||
with open(STATUS_FILE, 'r', encoding='utf-8') as file:
|
with open(STATUS_FILE, 'r', encoding='utf-8') as file:
|
||||||
statuses = file.readlines()
|
data = file.readlines()
|
||||||
|
|
||||||
status = random.randint(0, len(statuses) - 1)
|
result = {}
|
||||||
|
current_key = None
|
||||||
|
for line in data:
|
||||||
|
if line[0] == '#':
|
||||||
|
|
||||||
return markdown.markdown(statuses[status])
|
# Empty Key-Value pairs will cause errors
|
||||||
|
if current_key:
|
||||||
|
if not result[current_key]:
|
||||||
|
result.pop(current_key)
|
||||||
|
|
||||||
|
current_key = line.replace('#', '').strip()
|
||||||
|
result[current_key] = []
|
||||||
|
elif not (line == '\n'):
|
||||||
|
result[current_key].append(line)
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
def get_status() -> str:
|
||||||
|
keys = list(statuses.keys())
|
||||||
|
|
||||||
|
selected_key = keys[random.randint(0, len(keys) - 1)]
|
||||||
|
section: list = statuses[selected_key]
|
||||||
|
|
||||||
|
selected_status = section[random.randint(0, len(section) - 1)]
|
||||||
|
|
||||||
|
return f'<div title="{selected_key}">{markdown.markdown(selected_status)}</div>'
|
||||||
|
|
||||||
# Main Page
|
# Main Page
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
@ -82,6 +106,16 @@ def index():
|
|||||||
|
|
||||||
return flask.render_template('index.html', posts=post_bodies, status=status)
|
return flask.render_template('index.html', posts=post_bodies, status=status)
|
||||||
|
|
||||||
|
# Posts
|
||||||
|
@app.route('/post/<string:post_name>')
|
||||||
|
def post(post_name: str):
|
||||||
|
|
||||||
|
for post in get_posts():
|
||||||
|
if post.title.replace(' ', '-') == post_name:
|
||||||
|
return flask.render_template('index.html', posts=[post.body], status=get_status())
|
||||||
|
|
||||||
|
flask.abort(404)
|
||||||
|
|
||||||
# Games Page
|
# Games Page
|
||||||
@app.route('/games/')
|
@app.route('/games/')
|
||||||
def games():
|
def games():
|
||||||
@ -231,6 +265,9 @@ def album_square(user_id, rows : int):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
|
statuses = read_status_file()
|
||||||
|
|
||||||
if DEV:
|
if DEV:
|
||||||
app.run(port=PORT)
|
app.run(port=PORT)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@ -8,6 +8,8 @@ class Post:
|
|||||||
date : datetime.datetime
|
date : datetime.datetime
|
||||||
body : str
|
body : str
|
||||||
file : str
|
file : str
|
||||||
|
title : str
|
||||||
|
url : str
|
||||||
|
|
||||||
def __init__(self, file_path):
|
def __init__(self, file_path):
|
||||||
self.file = file_path
|
self.file = file_path
|
||||||
@ -17,9 +19,11 @@ class Post:
|
|||||||
|
|
||||||
self.category = lines[1].split(":")[1].strip()
|
self.category = lines[1].split(":")[1].strip()
|
||||||
self.author = lines[2].split(":")[1].strip()
|
self.author = lines[2].split(":")[1].strip()
|
||||||
|
self.title = lines[6][2:-1]
|
||||||
|
self.url = '/post/' + self.title.replace(' ', '-')
|
||||||
|
|
||||||
date = lines[3].split(":")[1].strip()
|
date = lines[3].split(":")[1].strip()
|
||||||
self.date = datetime.datetime.strptime(date, "%d-%m-%Y")
|
self.date = datetime.datetime.strptime(date, "%d-%m-%Y")
|
||||||
|
|
||||||
self.body = markdown.markdown(''.join(lines[6:]))
|
self.body = markdown.markdown(f'# [{self.title}]({self.url})\n' + ''.join(lines[7:]))
|
||||||
|
|
||||||
|
|||||||
@ -1,40 +1,112 @@
|
|||||||
Catchy Right?
|
# Project Moon
|
||||||
Everybody's lazy when they're tired
|
Needles
|
||||||
|
Sally forth Rocinante!
|
||||||
|
The multitude tightens its hold.
|
||||||
|
|
||||||
|
# Misc
|
||||||
|
Check out [NEUPINK](https://neupink.bandcamp.com/album/swordflower-hills-killer-2)!
|
||||||
|
Solar Sect of Mystic Wisdom
|
||||||
|
~ Nuclear Fusion
|
||||||
|
His name really is Tim.
|
||||||
|
Just wait until you see the 1 in 1000 message.
|
||||||
|
I'm open to suggestions on how to improve the look of the website
|
||||||
As long as there is delusion, there is hope
|
As long as there is delusion, there is hope
|
||||||
It's 510.
|
It's 510.
|
||||||
|
Catchy Right?
|
||||||
|
|
||||||
|
## TV / Movie Quotes
|
||||||
|
|
||||||
|
# Monogatari
|
||||||
|
I don't know everything, I only know what I know.
|
||||||
|
|
||||||
|
## Song Lyrics
|
||||||
|
|
||||||
|
# I’m in Your Mind by King Gizzard & The Lizard Wizard
|
||||||
|
Everybody's lazy when they're tired
|
||||||
|
|
||||||
|
# Straws In The Wind by King Gizzard & The Lizard Wizard
|
||||||
Mindful of the weary inkling that is lurking
|
Mindful of the weary inkling that is lurking
|
||||||
Mortal traffic lights signaling when to stay or go
|
Mortal traffic lights signaling when to stay or go
|
||||||
|
|
||||||
|
# Automation by King Gizzard & The Lizard Wizard
|
||||||
Cyber surgeon, Javascript person
|
Cyber surgeon, Javascript person
|
||||||
|
|
||||||
|
# Gilgamesh by King Gizzard & The Lizard Wizard
|
||||||
Bone-dried swamplands swallow me
|
Bone-dried swamplands swallow me
|
||||||
House of dust, land of bone
|
House of dust, land of bone
|
||||||
I ate dirt, I drank stone
|
I ate dirt, I drank stone
|
||||||
Come on, snake, punish me
|
Come on, snake, punish me
|
||||||
|
|
||||||
|
# The Dripping Tap by King Gizzard & The Lizard Wizard
|
||||||
Drip, drip from the tap, don't slip on the drip
|
Drip, drip from the tap, don't slip on the drip
|
||||||
His name really is Tim.
|
|
||||||
Just wait until you see the 1 in 1000 message.
|
# Face to Face by Daft Punk
|
||||||
I'm open to suggestions on how to improve the look of the website
|
|
||||||
Open the curtains
|
|
||||||
Don't miss a moment of this experiment
|
|
||||||
Needles
|
|
||||||
Sally forth Rocinante!
|
|
||||||
The multitude tightens its hold.
|
|
||||||
It's amazing what you'll find face to face
|
It's amazing what you'll find face to face
|
||||||
It's not hard to go the distance / When you finally get involved face to face
|
It's not hard to go the distance / When you finally get involved face to face
|
||||||
|
|
||||||
|
# Touch by Daft Punk
|
||||||
A tourist in a dream / A visitor, it seems / A half-forgotten song / Where do I belong?
|
A tourist in a dream / A visitor, it seems / A half-forgotten song / Where do I belong?
|
||||||
|
|
||||||
|
# Magenta Mountian by King Gizzard & The Lizard Wizard
|
||||||
What do you mean ... You can't see it?
|
What do you mean ... You can't see it?
|
||||||
I don't believe you / your eyes deceive you / better check yourself in
|
I don't believe you / your eyes deceive you / better check yourself in
|
||||||
You will say I'm crazy / I will go on my way 'cause it's what I need
|
You will say I'm crazy / I will go on my way 'cause it's what I need
|
||||||
I'd cross a thousand seas just to prove I'm not mad
|
I'd cross a thousand seas just to prove I'm not mad
|
||||||
I thought I saw a statue blink, and a bird with no head, Land on a golden thread, I rub my eyes, What am I saying? There's nothing there
|
I thought I saw a statue blink, and a bird with no head, Land on a golden thread, I rub my eyes, What am I saying? There's nothing there
|
||||||
Solar Sect of Mystic Wisdom
|
|
||||||
~ Nuclear Fusion
|
# Armor-clad Faith by NAOKI, Arc System Works
|
||||||
Check out [NEUPINK](https://neupink.bandcamp.com/album/swordflower-hills-killer-2)!
|
|
||||||
<<<<<<< HEAD
|
|
||||||
I'm a fool, I know nothing / I take the role of a silly clown
|
I'm a fool, I know nothing / I take the role of a silly clown
|
||||||
All I do is embrace the wounded soul
|
All I do is embrace the wounded soul
|
||||||
|
|
||||||
|
# Love the Subhuman Self by AISHA, Jamison Boaz, Arc System Works (Guilty Gear Strive)
|
||||||
So carry on, love the subhuman self
|
So carry on, love the subhuman self
|
||||||
Break yourself inside out
|
Break yourself inside out, she told me
|
||||||
|
|
||||||
|
# Symphony by NAOKI, Arc System Works (Guilty Gear Strive)
|
||||||
We're just a quirky note in the symphony
|
We're just a quirky note in the symphony
|
||||||
=======
|
|
||||||
|
# White Whale by Shadow Academy
|
||||||
So, silent tide / Tell me which face do I show the world / And which one do I hide?
|
So, silent tide / Tell me which face do I show the world / And which one do I hide?
|
||||||
>>>>>>> main
|
|
||||||
|
# Intrasport by King Gizzard & The Lizard Wizard
|
||||||
|
Dreams that sew me up like sleeping with a needle
|
||||||
|
Those feelings that I had are building up to something
|
||||||
|
I feel a schism in the rhythm, now I'm running
|
||||||
|
My hair is liquifying
|
||||||
|
My taste buds are igniting
|
||||||
|
|
||||||
|
# Set by King Gizzard & The Lizard Wizard
|
||||||
|
Cut the cord, kill the king and reset
|
||||||
|
Squeezing day into night with supernatural pressure
|
||||||
|
Right eye is the sun and left the moon's light
|
||||||
|
|
||||||
|
# Swan Song by King Gizzard & The Lizard Wizard
|
||||||
|
Score the music // Of your essence
|
||||||
|
Stars fall from their lofty places
|
||||||
|
Earth has been put through her paces
|
||||||
|
Cosmic surgeons cut the cable
|
||||||
|
Make a new world if you're able
|
||||||
|
|
||||||
|
# String Theocracy by Mili
|
||||||
|
Open the curtains
|
||||||
|
Don't miss a moment of this experiment
|
||||||
|
If you're going to replace me // At least have the audacity to kill me thoroughly
|
||||||
|
What's the color of the electric sheep you see?
|
||||||
|
Maybe we're all cold machines
|
||||||
|
|
||||||
|
# Change by King Gizzard & The Lizard Wizard
|
||||||
|
We're changing pace // Higher stakes
|
||||||
|
So called heroes wearing fake capes
|
||||||
|
Buildings that you know // People come and go // Are a certain way
|
||||||
|
And then you get the news that obliterates your view // Amputate your truths // The signifiance has changed
|
||||||
|
Hospital inane // Meaningless and grey // But lie within the walls and the signifiance will change
|
||||||
|
What would it take for us to change the game? // Maybe our existence is signifiance in vain
|
||||||
|
|
||||||
|
# Candles by King Gizzard & The Lizard Wizard
|
||||||
|
This little man is too hot to handle // Set the funeral on fire with the candles
|
||||||
|
Praying to the gods at the top of a mountian // Better throwing all your pennies in a fountian
|
||||||
|
My little heart, as cold as a morgue // Let the weight of it drop like an iceberg
|
||||||
|
|
||||||
|
# Presumptuous by King Gizzard & The Lizard Wizard
|
||||||
|
Eggshell, landmine, stepping stones // Kindred spirits at a crossroads
|
||||||
|
The world we built is on a tilt // Bottled up inside and filled with guilt
|
||||||
|
|||||||
@ -2,6 +2,9 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<body>
|
<body>
|
||||||
<a href="/">home</a>
|
<a href="/">home</a>
|
||||||
|
<p>
|
||||||
|
This is just a little page where I post stuff I write. I was kind of unsure if I wanted this stuff out here but I think to those who know me it could serve as an interesting view into some thoughts that I don't often express elsewhere.
|
||||||
|
</p>
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
{% for work in works %}
|
{% for work in works %}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user