- Read in fandom name substitutions from a central location

- Modify template to get rid of unused fields
- CSS tweaks
This commit is contained in:
mez 2025-07-21 20:10:52 +01:00
parent fb5e797988
commit 089a0143f6
5 changed files with 32 additions and 81 deletions

View file

@ -1,5 +1,6 @@
import datetime,os
import datetime,os,random
from importlib import import_module
import fandomsedit
def stringno(theno):
if theno < 10:
@ -31,24 +32,8 @@ while ficcount > 0:
for datewords in fileread.datewords:
yearslist.append(datewords["date"].year)
for fandom in fileread.fandom:
if fandom == "FF15":
fandomslist.append("Final Fantasy XV")
elif fandom == "FF16":
fandomslist.append("Final Fantasy XVI")
elif fandom == "FF4":
fandomslist.append("Final Fantasy IV")
elif fandom == "FF6":
fandomslist.append("Final Fantasy VI")
elif fandom == "FF7":
fandomslist.append("Final Fantasy VII")
elif fandom == "FF8":
fandomslist.append("Final Fantasy VIII")
elif fandom == "FF9":
fandomslist.append("Final Fantasy IX")
elif fandom == "FFX":
fandomslist.append("Final Fantasy X")
elif fandom == "LOTR":
fandomslist.append("Lord Of The Rings")
if fandom in fandomsedit.render:
fandomslist.append(fandomsedit.render[fandom])
else:
fandomslist.append(fandom)
@ -119,24 +104,8 @@ while ficcount > 0:
if goahead == True:
if len(fileread.fandom) > 1:
ficfandom = "Crossovers"
elif fileread.fandom[0] == "FF15":
ficfandom = "Final Fantasy XV"
elif fileread.fandom[0] == "FF16":
ficfandom = "Final Fantasy XVI"
elif fileread.fandom[0] == "FF4":
ficfandom = "Final Fantasy IV"
elif fileread.fandom[0] == "FF6":
ficfandom = "Final Fantasy VI"
elif fileread.fandom[0] == "FF7":
ficfandom = "Final Fantasy VII"
elif fileread.fandom[0] == "FF8":
ficfandom = "Final Fantasy VIII"
elif fileread.fandom[0] == "FF9":
ficfandom = "Final Fantasy IX"
elif fileread.fandom[0] == "FFX":
ficfandom = "Final Fantasy X"
elif fileread.fandom[0] == "LOTR":
ficfandom = "Lord Of The Rings"
elif fileread.fandom[0] in fandomsedit.render:
ficfandom = fandomsedit.render[fileread.fandom[0]]
else:
ficfandom = fileread.fandom[0]
try:
@ -439,16 +408,22 @@ for yearstats in full:
if challengefics > 1:
statspage.write("s")
statspage.write(", " + str(f'{yearstats["challengewords"]:,}') + " words</span></td>\n")
else:
statspage.write("<td style=\"--size:0\"></td>\n")
if exchangefics > 0:
statspage.write("<td style=\"--size:" + str(round(yearstats["exchangewords"] / yearwords,5)) + ";\"><span class=\"data\">" + str(yearstats["exchangewords"]) + " words</span><span class=\"tooltip\">Exchanges: " + str(exchangefics) + " fic")
if exchangefics > 1:
statspage.write("s")
statspage.write(", " + str(f'{yearstats["exchangewords"]:,}') + " words</span></td>\n")
else:
statspage.write("<td style=\"--size:0\"></td>\n")
if promptfics > 0:
statspage.write("<td style=\"--size:" + str(round(yearstats["promptwords"] / yearwords,5)) + ";\"><span class=\"data\">" + str(yearstats["promptwords"]) + " words</span><span class=\"tooltip\">Prompt events: " + str(promptfics) + " fic")
if promptfics > 1:
statspage.write("s")
statspage.write(", " + str(f'{yearstats["promptwords"]:,}') + " words</span></td>\n")
else:
statspage.write("<td style=\"--size:0\"></td>\n")
statspage.write("</tr>\n")
statspage.write("</table>\n")
@ -481,6 +456,10 @@ for yearstats in full:
yearfandoms.append(yearfandomdict)
yearfandoms = sorted(yearfandoms, key=lambda d: d["words"],reverse=True)
statspage.write("<tr>\n<th scope=\"row\">" + str(yearstats["year"]) + "</th>\n")
extra = random.randint(0,8)
while extra > -1:
statspage.write("<td style=\"--size:0\"></td>")
extra -= 1
for fandom in yearfandoms:
if fandom["words"] > 0:
statspage.write("<td style=\"--size:" + str(round(fandom["words"] / yearwords,5)) + ";\"><span class=\"data\">" + str(fandom["words"]) + " words</span><span class=\"tooltip\">" + fandom["name"] + ": " + str(len(fandom["fics"])) + " fic")