From b59e1f434a6a0dbad6c66fef4eed2f47687500e3 Mon Sep 17 00:00:00 2001 From: daniel-Jones Date: Sat, 11 Nov 2017 10:23:39 +1100 Subject: added waifu generation. good god i wish this was real. --- generatesite.py | 22 ++++++++++++++++++---- settings.cfg | 5 +++++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/generatesite.py b/generatesite.py index a0a5834..a7b0321 100644 --- a/generatesite.py +++ b/generatesite.py @@ -146,12 +146,26 @@ def generateanime(): replace(outdir + "/" + animedir + "/index.html", "{CONTENT}", content); replace(outdir + "/" + animedir + "/index.html", "{TIME}", strftime("%Y-%m-%d %H:%M:%S", gmtime())); +def generatewaifus(): + template = cfg.get("output", "template"); + outdir = cfg.get("output", "dir"); + waifussrc = cfg.get("waifus", "src"); + waifusdir = cfg.get("waifus", "dir"); + print("generating {}/{}/index.html from {}".format(outdir, waifusdir, waifussrc)); + copyfile(template, outdir + "/" + waifusdir + "/index.html"); + with open(waifussrc, "r") as contentfile: + content = contentfile.read(); + replace(outdir + "/" + waifusdir + "/index.html", "{TITLE}", cfg.get("waifus", "title")); + replace(outdir + "/" + waifusdir + "/index.html", "{INFO}", cfg.get("waifus", "header")); + replace(outdir + "/" + waifusdir + "/index.html", "{CONTENT}", content); + replace(outdir + "/" + waifusdir + "/index.html", "{TIME}", strftime("%Y-%m-%d %H:%M:%S", gmtime())); if __name__ == "__main__": cfg = configparser.ConfigParser(); cfg.read("settings.cfg"); os.makedirs(cfg.get("output", "dir"), exist_ok=True); - generateindex(); - generateblog(); - generateportfolio(); - generateanime(); + generateindex(); # index + generateblog(); # blog with individual pages + generateportfolio(); # portfolio + generateanime(); # anime recommendations + generatewaifus(); # my waifus diff --git a/settings.cfg b/settings.cfg index b433d7d..a6a1297 100644 --- a/settings.cfg +++ b/settings.cfg @@ -22,3 +22,8 @@ title = anime header =

Anime I recommend

dir = viewings src = content/viewings/index.txt +[waifus] +title = waifus +header =

My waifus, not yours

All other waifus are literal trash +dir = waifus +src = content/waifus/index.txt -- cgit v1.2.3