- Read in fandom name substitutions from a central location
- Modify template to get rid of unused fields - CSS tweaks
This commit is contained in:
parent
fb5e797988
commit
089a0143f6
5 changed files with 32 additions and 81 deletions
10
fandomsedit.py
Normal file
10
fandomsedit.py
Normal file
|
@ -0,0 +1,10 @@
|
|||
render = {"FF15":"Final Fantasy XV",
|
||||
"FF16":"Final Fantasy XVI",
|
||||
"FF4":"Final Fantasy IV",
|
||||
"FF6":"Final Fantasy VI",
|
||||
"FF7":"Final Fantasy VII",
|
||||
"FF8":"Final Fantasy VIII",
|
||||
"FF9":"Final Fantasy IX",
|
||||
"FFX":"Final Fantasy X",
|
||||
"LOTR":"Lord Of The Rings",
|
||||
"Phan":"YouTube RPF"}
|
23
new.py
23
new.py
|
@ -1,9 +1,10 @@
|
|||
import datetime,os
|
||||
from importlib import import_module
|
||||
from bs4 import BeautifulSoup
|
||||
import fandomsedit
|
||||
|
||||
def classgen(string):
|
||||
return string.replace(" ","").replace("#","").replace("-","").replace("ç","c").replace("’","").replace("é","e").replace("(","").replace(")","").replace(":","").lower()
|
||||
return string.replace(" ","").replace("#","").replace("-","").replace("ç","c").replace("’","").replace("É","E").replace("é","e").replace("(","").replace(")","").replace(":","").lower()
|
||||
|
||||
def stringno(theno):
|
||||
if theno < 10:
|
||||
|
@ -57,24 +58,8 @@ while ficcount > 0:
|
|||
ficdict["completion"] = "complete"
|
||||
ficdict["fandoms"] = []
|
||||
for fandom in fileread.fandom:
|
||||
if fandom == "FF15":
|
||||
ficdict["fandoms"].append("Final Fantasy XV")
|
||||
elif fandom == "FF16":
|
||||
ficdict["fandoms"].append("Final Fantasy XVI")
|
||||
elif fandom == "FF4":
|
||||
ficdict["fandoms"].append("Final Fantasy IV")
|
||||
elif fandom == "FF6":
|
||||
ficdict["fandoms"].append("Final Fantasy VI")
|
||||
elif fandom == "FF7":
|
||||
ficdict["fandoms"].append("Final Fantasy VII")
|
||||
elif fandom == "FF8":
|
||||
ficdict["fandoms"].append("Final Fantasy VIII")
|
||||
elif fandom == "FF9":
|
||||
ficdict["fandoms"].append("Final Fantasy IX")
|
||||
elif fandom == "FFX":
|
||||
ficdict["fandoms"].append("Final Fantasy X")
|
||||
elif fandom == "LOTR":
|
||||
ficdict["fandoms"].append("Lord Of The Rings")
|
||||
if fandom in fandomsedit.render:
|
||||
ficdict["fandoms"].append(fandomsedit.render[fandom])
|
||||
else:
|
||||
ficdict["fandoms"].append(fandom)
|
||||
ficlist.append(ficdict)
|
||||
|
|
|
@ -8,43 +8,22 @@ datewords = [{"date":datetime.datetime(YYYY,M,D),"words":}]
|
|||
# revealdate = datetime.datetime(YYYY,M,D)
|
||||
# approxdate = ""
|
||||
status = "complete" # incomplete, abandoned
|
||||
rating = "" # g, t, m, e
|
||||
# ratingreason = ""
|
||||
fandom = [""]
|
||||
# fandomtext = ""
|
||||
# charpov = [""]
|
||||
# charmain = [""]
|
||||
# charsecondary = [""]
|
||||
# charmention = [""]
|
||||
# charmention = [""] # not really needed but keep it maybe
|
||||
# ship = [""]
|
||||
genre = [""]
|
||||
# warnings = ""
|
||||
genre = [""] # ship category comes first, 1 more is displayed
|
||||
warnstring = 9000000000 # 9 is a dummy; then sex (0–3), death, mental health, bigotry, vomiting, consent, underage, incest, amputation (all others being 0–2)
|
||||
time = ""
|
||||
location = [""]
|
||||
# locationtext = ""
|
||||
# summary = ""
|
||||
# notes = ""
|
||||
# event = "" # challenge (including fests; anything without a specific prompt), ao3exchange, exchange, prompt
|
||||
# eventlocation = "" # dwcomm, dwjournal, ljjournal
|
||||
# eventname = ""
|
||||
# eventdeets = "" # probably not needed unless it’s robotsoup
|
||||
# eventfrequency = "" # "annual" or some custom value like "summer 2022 round" – or can leave
|
||||
# prompt = ""
|
||||
# recip = ""
|
||||
# recippseud = ""
|
||||
# recipsite = "" # ao3, dw, tumblr
|
||||
locked = False
|
||||
# ao3slug =
|
||||
# ao3locked =
|
||||
html = True
|
||||
pdf = True
|
||||
epub = True
|
||||
# fedislug = ""
|
||||
# comments = [{"site":"", # ao3, dw, lj, discord
|
||||
# "registered":, # True or False, not required for discord
|
||||
# "username":"", # leave out if it’s a dw/lj anon
|
||||
# "pseud":"", # optional, ao3 only
|
||||
# "date":datetime.datetime(),
|
||||
# "link":"",
|
||||
# "text":""}]
|
||||
|
|
53
stats.py
53
stats.py
|
@ -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")
|
||||
|
|
|
@ -7,5 +7,3 @@ original =
|
|||
datewords = [{"date":datetime.datetime(YYYY,M,D),"words":}]
|
||||
status = "complete" # incomplete, abandoned
|
||||
summary = ""
|
||||
ao3slug =
|
||||
# comments = [] # see originalsmeta/template.py for format
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue