diff --git a/.gitignore b/.gitignore
index ab00065..3ef69f4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
config.py
+htmlconfig.py
__pycache__
*.swp
log
diff --git a/editpost.py b/editpost.py
index 7bec256..b5e964f 100644
--- a/editpost.py
+++ b/editpost.py
@@ -1,10 +1,8 @@
-import users
-import posts
import rebuild
import click
-def editpost(userID, datetime):
+def editpost(userID, datetime, config, posts, users):
post_counter = 0
user_posts = []
print("Which post do you want to edit?")
diff --git a/glogger.py b/glogger.py
index 66331cb..ebd014e 100755
--- a/glogger.py
+++ b/glogger.py
@@ -1,4 +1,17 @@
+import sys # Command line arguments
+from importlib.machinery import SourceFileLoader
+from datetime import datetime
+import newpost
+import editpost
+import rebuild
import initialise
+
+config_file_path = "config.py"
+if len(sys.argv) > 1:
+ for argument in sys.argv:
+ if argument[:9] == "--config=":
+ config_file_path = argument[9:]
+
try:
import posts
except:
@@ -10,19 +23,13 @@ except:
print("No users database")
initialise.initialise()
try:
- import config
+ config = SourceFileLoader("config", config_file_path).load_module()
if config.autogenerated == True:
print("Error: autogenerated = True")
exit()
except:
print("Please move example.config.py to config.py and edit the options to your case and then set autogenerated=False")
exit()
-import newpost
-import editpost
-import rebuild
-
-import sys # Command line arguments
-from datetime import datetime
if len(sys.argv) > 1:
for argument in sys.argv:
@@ -53,8 +60,8 @@ if user_present == True:
answer = input()
if answer == 'N' or answer == '0':
- newpost.newpost(userID, username, datetime)
+ newpost.newpost(userID, username, datetime, config, posts, users)
if answer == 'E' or answer == '1':
- editpost.editpost(userID, datetime)
+ editpost.editpost(userID, datetime, config, posts, users)
else:
print('Sorry, that account does not exist, If it should, please ask the webadmin to add this account')
diff --git a/htmlconfig.py b/htmlconfig.py
new file mode 100644
index 0000000..c06627a
--- /dev/null
+++ b/htmlconfig.py
@@ -0,0 +1,59 @@
+### General ###
+site_url = "https://deadvey.com/blog/"
+site_name = "DeaDvey's Blog"
+site_description = "Linux, tech and reviews"
+webroot = "/var/www/deadvey.com/blog/"
+date_format = "%d/%m/%Y at %H:%M" # The date that is displayed on the page
+post_seperator = "---------------------------------------------"
+posts_in_timeline = 100
+file_extension = "html"
+
+### Feeds ###
+atom = False
+rss = True
+
+### Logging ###
+logfile = "/home/max/glogger/log"
+verbose = False
+
+### Format ###
+# The syntax for this is pretty simple
+# %S - post seperator as defined by post_seperator
+# %T - Title
+# %D - Published date in the format specified by date_format
+# %E - Edited date in the format specified by date_format
+# %C - Post content
+# %L - URL Permanent link to the post
+# %U - URL the the user (poster)
+# %H - URL to the site home page /
+# %N - the username of the user (poster)
+# %R - Site wide RSS feed
+# %Y - Site Name as defined by site_name
+# %y - Site Descriptin as defined by site_description
+site_header = '''
+
%Y
+%y
+RSS Feed
+'''
+user_page_post_format = '''
+%T
+%C
+permalink
+
+'''
+post_page_post_format = '''
+Posted by %N
+%T
+Published: %D
+%C
+%N
+Published: %D
+Last Edited: %E
+'''
+timeline_post_format = '''
+%T
+%C
+permalink
+
+'''
+autogenerated = False
diff --git a/newpost.py b/newpost.py
index da84268..0cf08f1 100644
--- a/newpost.py
+++ b/newpost.py
@@ -15,7 +15,7 @@ except:
print("No users database")
import output
-def newpost(userID, username, datetime):
+def newpost(userID, username, datetime, config, posts, users):
title = input("Title: ")
content = click.edit()
content = content.replace("'", "\'")
diff --git a/parse_post.py b/parse_post.py
index bd40e7b..45b1971 100644
--- a/parse_post.py
+++ b/parse_post.py
@@ -11,6 +11,7 @@ def parse_post_format(post, post_index, username):
post = post.replace("%C", post_data["content"])
post = post.replace("%L", f"{config.site_url}/post/{post_index}.{config.file_extension}")
post = post.replace("%U", f"{config.site_url}/user/{username}.{config.file_extension}")
+ post = post.replace("%H", f"{config.site_url}/")
post = post.replace("%N", username)
return post
diff --git a/posts.py.back b/posts.py.back
new file mode 100644
index 0000000..e8e25de
--- /dev/null
+++ b/posts.py.back
@@ -0,0 +1 @@
+posts = [{'userID': 0, 'title': 'Glogger', 'content': 'So I think Glogger is finished ish,\nI made a program in python I call "glogger" and it is this, a static gemlog generator using plain text files as the database.\nI have also improved on my old blog generator by:\nI) Having a config file that allow you to edit the formatting and other details\nII) Using the "click" program that allows you to write text in your editor before it is passed on to python, maintaining any newlines and making it much nicer to edit text.\nIII) Allowing for multiple users seemlessly on one gemlog\nIV) Letting you edit previous posts and updating them straightaway\n\nI hope it works nice, the idea is to be lightweight, I also think it would be trivial to port it to a html website, I might make it general purpose, I literally think there would just need to be a file extension config in config.py.\n\nFly You High - DeaDvey\n', 'pubdate': '31032025Z160639T', 'editdate': '31032025Z160639T'}, {'userID': 0, 'title': 'The Witcher The Last Wish', 'content': '4/5\n\nI\'ve played the Witcher Games (2 and 3, planning on playing 1 at some point) so I thought I\'d play the source material.\nI enjoyed the format of the book, as a collection of short stories about the exiting adventures of Geralt, I\'ve ranked the stories in order of how much I enjoyed them:\n\nI) The Lesser Evil - I enjoyed seeing Geralt tackle with a tough decision, in both of which there is great death. His choice in the end gave him the nickname "Butcher of Blaviken"\nII) The Witcher - Named after of course Geralt, we see his skill in taking down a beast for the King of Temeria after all previous people failed, his skill with the blade is expertly introduced in this first story\nIII) The Last Wish - Geralt meets Yennefer and the name sake of the book, I found the Djinn lore unique and interesting, I thought it showed Geralt and Dandillion's friendship even better than "The Edge of the World" as you see how distressed Geralt is that Dandillion is hurt.\nIV) A Grain of Truth - A sleeping beauty like story but with a twist, Nivellan was a bit of a weird guy, but seemed generally good meaning, I enjoyed Geralt hearing a story and figuring things out from there and the mystery of the situation.\nV) The Edge of the World - The Sylvan was an interesting character and the elves where quite horrible, a good look at the friendship between Geralt and Dandillion\nVI) A Question of Price - A bit harder to follow due to the many named characters, and the idea was a bit weird, Pavetta is 15 and Duny is probably between 40 and 50 which is very weird...\nVII) Voice of Reason - This is a weird one as it\'s spread out with each bit inbetween all the other stories, and not much really happened, the fight at the end was interesting though.\n\nOverall I enjoyed the format and the interesting adventures as well as quite well introducing different facets of Gerlats character such as strength, intellegence, friendship and weaknesses.\n\nFly You High - DeaDvey\n', 'pubdate': '01042025Z192341T', 'editdate': '01042025Z192924T'}, {'userID': 0, 'title': '2 Years on the Linux desktop', 'content': "Initiation:\nI began using Linux in late November of 2022 after I heard that it can be better for programming in, I installed Linux Mint because my cousin recomended it. When I installed Linux Mint, I somehow ended up corrupting my Windows partition, which I was intending on using as a dual boot, in hindsight, I think this was a good thing as I was now sort of stuck on Linux with no quick way to just boot back into Windows if I felt like it. At first, I was using it like Windows, I was installing everything from installers off the web and finding the whole thing a bit confusing, I didn't see the benefit of using the package manager, I assumed it would be as buggy and shit as the Microsoft Store, but I was surprised, it had every program I needed on it and more. I was also attracted by the customisability of the Cinnamon desktop environment, I was blown away by small things as simple as being able to change the menu icon and add a colour picker to the panel. Eventually I learnt about installing other desktop environments, my Windows brain was confused by the fact you could have the same files and system on a seperate desktop environment, I was so used to it just being like how the creators wanted it to look. I also ended up using XMonad and i3 and getting into ricing and more customisation.\n\nDistro Hopping:\nIn early 2023 I started using Arch Linux because it sounded cool, unfortunately I accidently overwrited my Mint partition (I think there's a theme of me doing this without any backup) I did enjoy the rolling release style of Arch Linux, but I also found it confusing and things went wrong a lot that I didn't know how to fix. So then I tried OpenSUSE Tumbleweed as I heard that it had the rolling release cycle but was much stabler than Arch and more user friendly, I stayed on OpenSUSE TW for a while with little issue, one issue being that because OpenSUSE was abit more obscure, some software didn't work easily with it, meaning I had to get more comfortable with building programs from source. Around this time, I also setup an OpenSUSE Leap server on my old PC (I still have it but it's not running).\n\nNixOS:\nIn late 2023, I started using NixOS a bit, though I kept jumping between OpenSUSE and NixOS and Arch Linux every month or so. NixOS is just so awesome with it's declarativity and is so nice to use seeing as things just continue working on it forever. Every time I try to switch to something else now, I end up going back to NixOS or OpenSUSE as for me, they just work.\n\nGCSE era:\nWhen I was taking my GCSE exams in 2024 (UK secondary exams) I was trying not to use my PC too much, and mostly just used my 20 year old laptop with Puppy Linux (Lightweight) on it. I never really tinkered with Puppy much as it was mostly for productivity and getting stuff done, it had some queerness though. On Puppy, you're always logged in as a root user, and some options don't carry over when you reboot, such as WiFi conections, I also tried AntiX, but it seemed to perfom a bit worse then Puppy on my Acer Laptop.\n\nAnd that's where I am, I still swap between these three distros (OpenSUSE, NixOS, Arch) every few months, I'm currently on NixOS on my PC, OpenSUSE on my laptop and NixOS and Debian on my two servers, I think I've left Arch Linux behind, I don't really see any advantage to it over OpenSUSE or NixOS Unstable for me, I like things working, but I also like tinkering and customisation. Now that I'm doing my A Levels, I've got my PC setup without a GUI on NixOS to prevent distraction, and I mostly just do some programming and writing on it, I also have multiple laptops now, some running Nix, some on Arch and one on OpenSUSE, though this will undoubtebly change at some point, knowing me, I can rarely settle on something for too long.\n\n", 'pubdate': '08042025Z171301T', 'editdate': '08042025Z171301T'}, {'userID': 0, 'title': 'Burnt mounds and shattered rock', 'content': 'What they are:\nBurnt mounds are archeological sites, largely found in the UK.\nThey are beleived to date back to 1500 - 1000 BC, when Britain was in it\'s Bronze Age.\nBurnt mounds usually consist of "shattered rock" and burnt ground and are typically found near river, or where rivers are beleived to have flown at this point, this points to the likelyhood that water was a crucial in the usage of these, and the burnt ground evidently points to the fact that burning and fire occured at these sites.\n\nThe Shattered Stones:\nThe shattered stones show evidence of shattering due to heat, this lines up with the burnt ground present.\nThe stones are found to have "hairline cracks" across their surfaces, due to heating, and in the places where the stones have shattered, there are sharp corners and jagged edges, due to the abrasive breaking, some stones can even be ripped apart down the hairline cracks.\nIf you live near any burnt mound sites, then you can often find these stones on the site, or downstream from a site.\n\nPossible usages:\nThe two most probable usages are for\nI. Cooking\nII. Steam Saunas\nCooking seems like the go to answer here, due to the fire, however rarely is bone found around the site, which would be a clear giveaway for cooking occuring at the sites.\nOne proponent of the Steam Saunas theory is Mike Hodder, the theory is that stones where heated up on a fire and then carried into a makeshift tent (possibly using a deer antler to carry the hot stones) and placed in a bath of water from the river, the stones would boil the water and create a steamy environment within the tent.\nThis theory has been recreated in Mosely Bog and shown to work, some people describe exiting the tent as giving a feeling of being "reborn", so could Bronze Age citizens have used the Saunas a religious experience?\nIt\'s unlikely we will ever know for sure which theory is correct, or maybe both are completely wrong and it\'s something else entirely (other, less popular theories have been proposed), either way, it\'s interesting to think about the possibilities and to visit sites.\n\nFly You High - DeaDvey\n', 'pubdate': '10042025Z213804T', 'editdate': '10042025Z213804T'}]
\ No newline at end of file