Add CC licence to index page, add wordcounts to fandom list

This commit is contained in:
mez 2024-09-22 09:55:14 +01:00
parent e831481733
commit 1eb36343e3
2 changed files with 8 additions and 3 deletions

View file

@ -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("<details><summary><b>" + fandom["displayname"] + "</b> (" + str(len(fandomfics)) + " fic")
if len(fandomfics) > 1:
filewrite.write("s")
filewrite.write(", " + yearstring + ")</summary>\n")
filewrite.write(", " + f"{fandomwords:,}" + " total words, " + yearstring + ")</summary>\n")
filewrite.close()
for fic in fandomfics:
makeheader.ficgen(fic,False,output,local)