From 1eb36343e3c87b40282577d59d3956ce68d5f325 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?tr=C3=A9meur?= Date: Sun, 22 Sep 2024 09:55:14 +0100 Subject: [PATCH] Add CC licence to index page, add wordcounts to fandom list --- fandoms.py | 9 +++++++-- indexgen.py | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/fandoms.py b/fandoms.py index 6ba8046..681ca10 100644 --- a/fandoms.py +++ b/fandoms.py @@ -53,6 +53,7 @@ def fandomlist(local=False): fandomlist = sorted(fandomlist, key=lambda d: d["sortname"]) for fandom in fandomlist: fandomfics = [] + fandomwords = 0 sortfics = [] # check which fics are in the fandom ficcount = 500 @@ -76,11 +77,15 @@ def fandomlist(local=False): revealed = True if revealed == True: if fandom["searchname"] in fileread.fandom: - ficdict = {"thefic":ficcount,"thedate":(fileread.datewords[-1])["date"]} + sumwords = 0 + for instalment in fileread.datewords: + sumwords = sumwords + instalment["words"] + ficdict = {"thefic":ficcount,"thedate":(fileread.datewords[-1])["date"],"totalwords":sumwords} sortfics.append(ficdict) thefics = sorted(sortfics,key=lambda d: d["thedate"],reverse=True) for fic in thefics: fandomfics.append(fic["thefic"]) + fandomwords = fandomwords + fic["totalwords"] firstfic = fandomfics[-1] if firstfic < 10: firstficstring = "00" + str(firstfic) @@ -111,7 +116,7 @@ def fandomlist(local=False): filewrite.write("
" + fandom["displayname"] + " (" + str(len(fandomfics)) + " fic") if len(fandomfics) > 1: filewrite.write("s") - filewrite.write(", " + yearstring + ")\n") + filewrite.write(", " + f"{fandomwords:,}" + " total words, " + yearstring + ")\n") filewrite.close() for fic in fandomfics: makeheader.ficgen(fic,False,output,local) diff --git a/indexgen.py b/indexgen.py index d9b5161..0db08cd 100644 --- a/indexgen.py +++ b/indexgen.py @@ -58,7 +58,7 @@ def indexgen(local=False): # write header headerfooter.headerwrite("build/index.html","Tré’s fic archive","Tré’s fic archive","",True,local) filewrite = open("build/index.html", "a") - filewrite.write("

Here is all my fanfiction! Some of it is also syndicated elsewhere, but this site is the canonical location for everything I’ve written. I authorise transformative works as long as the original is linked and no financial transactions are involved.

\n

The code for this archive is available here. Commenting is switched on for most fics written at least semi-recently – read about that Here is all my fanfiction! Some of it is also syndicated elsewhere, but this site is the canonical location for everything I’ve written.

\n

Transformative works policy: The contents of these pages are licensed under CC BY-NC 4.0. \"\"\"\"\"\" In other words, transformative works are permitted as long as there is a clearly visible hyperlink to the original and no financial transactions are involved.

\n

The code for this archive is available here. Commenting is switched on for most fics written at least semi-recently – read about that