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

master
trémeur 3 months ago
parent e831481733
commit 1eb36343e3

@ -53,6 +53,7 @@ def fandomlist(local=False):
fandomlist = sorted(fandomlist, key=lambda d: d["sortname"]) fandomlist = sorted(fandomlist, key=lambda d: d["sortname"])
for fandom in fandomlist: for fandom in fandomlist:
fandomfics = [] fandomfics = []
fandomwords = 0
sortfics = [] sortfics = []
# check which fics are in the fandom # check which fics are in the fandom
ficcount = 500 ficcount = 500
@ -76,11 +77,15 @@ def fandomlist(local=False):
revealed = True revealed = True
if revealed == True: if revealed == True:
if fandom["searchname"] in fileread.fandom: 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) sortfics.append(ficdict)
thefics = sorted(sortfics,key=lambda d: d["thedate"],reverse=True) thefics = sorted(sortfics,key=lambda d: d["thedate"],reverse=True)
for fic in thefics: for fic in thefics:
fandomfics.append(fic["thefic"]) fandomfics.append(fic["thefic"])
fandomwords = fandomwords + fic["totalwords"]
firstfic = fandomfics[-1] firstfic = fandomfics[-1]
if firstfic < 10: if firstfic < 10:
firstficstring = "00" + str(firstfic) firstficstring = "00" + str(firstfic)
@ -111,7 +116,7 @@ def fandomlist(local=False):
filewrite.write("<details><summary><b>" + fandom["displayname"] + "</b> (" + str(len(fandomfics)) + " fic") filewrite.write("<details><summary><b>" + fandom["displayname"] + "</b> (" + str(len(fandomfics)) + " fic")
if len(fandomfics) > 1: if len(fandomfics) > 1:
filewrite.write("s") filewrite.write("s")
filewrite.write(", " + yearstring + ")</summary>\n") filewrite.write(", " + f"{fandomwords:,}" + " total words, " + yearstring + ")</summary>\n")
filewrite.close() filewrite.close()
for fic in fandomfics: for fic in fandomfics:
makeheader.ficgen(fic,False,output,local) makeheader.ficgen(fic,False,output,local)

@ -58,7 +58,7 @@ def indexgen(local=False):
# write header # write header
headerfooter.headerwrite("build/index.html","Trés fic archive","Trés fic archive","",True,local) headerfooter.headerwrite("build/index.html","Trés fic archive","Trés fic archive","",True,local)
filewrite = open("build/index.html", "a") filewrite = open("build/index.html", "a")
filewrite.write("<p>Here is all my fanfiction! Some of it is also syndicated elsewhere, but this site is the canonical location for everything Ive written. I authorise transformative works as long as the original is linked and no financial transactions are involved.</p>\n<p>The code for this archive is available <a href=\"https://git.praze.net/tre/fic-archive\">here</a>. Commenting is switched on for most fics written at least semi-recently read about that <a href=\"") filewrite.write("<p>Here is all my fanfiction! Some of it is also syndicated elsewhere, but this site is the canonical location for everything Ive written.</p>\n<p xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:dct=\"http://purl.org/dc/terms/\"><strong>Transformative works policy:</strong> The contents of <a property=\"dct:title\" rel=\"cc:attributionURL\" href=\"https://tre.praze.net/fic\">these pages</a> are licensed under <a href=\"https://creativecommons.org/licenses/by-nc/4.0/\" target=\"_blank\" rel=\"license\" style=\"display:inline-block;\">CC BY-NC 4.0. <img style=\"height:22px!important;margin-left:3px;vertical-align:middle;\" src=\"https://mirrors.creativecommons.org/presskit/icons/cc.svg?ref=chooser-v1\" alt=\"\"><img style=\"height:22px!important;margin-left:3px;vertical-align:middle;\" src=\"https://mirrors.creativecommons.org/presskit/icons/by.svg?ref=chooser-v1\" alt=\"\"><img style=\"height:22px!important;margin-left:3px;vertical-align:middle;\" src=\"https://mirrors.creativecommons.org/presskit/icons/nc.svg?ref=chooser-v1\" alt=\"\"></a> 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.</p>\n<p>The code for this archive is available <a href=\"https://git.praze.net/tre/fic-archive\">here</a>. Commenting is switched on for most fics written at least semi-recently read about that <a href=\"")
if local: if local:
filewrite.write("comments/index.html") filewrite.write("comments/index.html")
else: else:

Loading…
Cancel
Save