Add page for FF fics by wordcount, deal with spoilers in RSS feed, change wording in a few places

master
trémeur 1 year ago
parent f2e67ef6c0
commit 33a5cf09a8

@ -160,7 +160,7 @@ def commentindex(local=False):
# write header # write header
headerfooter.headerwrite("build/comments/index.html","Comments","Comments","",False,local) headerfooter.headerwrite("build/comments/index.html","Comments","Comments","",False,local)
filewrite = open("build/comments/index.html", "a") filewrite = open("build/comments/index.html", "a")
filewrite.write("<p>Comments I receive are archived on this site and linked back to the original. If you dont want your comments from other sources archived here, or if you require any changes to the presentation of your comments, <a href=\"mailto:eheu48@gmail.com\">please email me</a>. Please note, however, that this website is not indexed by search engines and the only place I really “advertise” it is Dreamwidth.</p>\n<p>You can leave comments on the relevant comment pages for each fic. If youd like notification of any reply, please leave your email address. If youd like a link from your pseudonym to a website, you can supply this as well. Ill happily link to personal websites, Dreamwidth profiles, and (at least for now) AO3 profiles; Im unlikely to include links to for-profit social media websites, Carrd, or Patreon.</p>\n<p>Comments are turned off on any fic over two years old unless its in a Final Fantasy fandom. On AO3, comments are turned off on <b>all</b> fics over two years old, unless they were written for AO3-hosted gift exchanges in 2020 or later.</p>\n") filewrite.write("<p>Comments I receive are archived on this site and linked back to the original. If you dont want your comments from other sources archived here, or if you require any changes to the presentation of your comments, <a href=\"mailto:eheu48@gmail.com\">please email me</a>. Please note, however, that this website is not indexed by search engines and the only places I really “advertise” it are Dreamwidth and, sparingly, AO3.</p>\n<p>You can leave comments on the relevant comment pages for each fic. If youd like notification of any reply, please leave your email address. If youd like a link from your pseudonym to a website, you can supply this as well. Ill happily link to personal websites, Dreamwidth profiles, and (at least for now) AO3 profiles; Im unlikely to include links to for-profit social media websites, Carrd, or Patreon.</p>\n<p>Comments are turned off on any fic over two years old unless its in a Final Fantasy fandom. On AO3, comments are left open on fics written for AO3-hosted gift exchanges that ran in 2020 or later.</p>\n")
filewrite.close() filewrite.close()
headerfooter.footerwrite("build/comments/index.html",False,local) headerfooter.footerwrite("build/comments/index.html",False,local)

@ -9,7 +9,7 @@ def fandomlist(local=False):
if os.path.exists("build/byfandom/index.html"): if os.path.exists("build/byfandom/index.html"):
os.remove("build/byfandom/index.html") os.remove("build/byfandom/index.html")
# write header # write header
headerfooter.headerwrite("build/byfandom/index.html","Fics by fandom","Fics by fandom","<p>On this page, youll find basically everything Ive ever written that is a. fanfiction and b. extant, grouped by fandom and then sorted newest to oldest; quality may vary. RPF and things I wrote before 2020 require a username and password to access.</p>",False,local) headerfooter.headerwrite("build/byfandom/index.html","Fics by fandom","Fics by fandom","<p>On this page, youll find basically everything Ive ever written that is a. fanfiction and b. extant, grouped by fandom and then sorted newest to oldest; quality may vary. Some fics, such as things I wrote before 2020, require a username and password to access.</p>",False,local)
# get list of fandoms # get list of fandoms
fandoms = [] fandoms = []
ficcount = 500 ficcount = 500

@ -187,7 +187,7 @@ def feedgen(local=False):
filewrite.write(" in this update") filewrite.write(" in this update")
filewrite.write(".") filewrite.write(".")
try: try:
filewrite.write(" " + re.sub("<[^<]+?>", "", thefile.summary)) filewrite.write(" " + re.sub("<[^<]+?>","",re.sub("<span class=\"spoiler\">.*</span>","[spoiler]",thefile.summary)))
except: except:
filewrite.write(" No summary provided.") filewrite.write(" No summary provided.")
try: try:

@ -6,6 +6,7 @@ import feed
import characters import characters
import ships import ships
import events import events
import wordcount
import indexgen import indexgen
import verifygen import verifygen
import statsgen import statsgen
@ -29,6 +30,7 @@ if __name__ == "__main__":
characters.charlist(True) characters.charlist(True)
ships.shiplist(True) ships.shiplist(True)
events.eventlist(True) events.eventlist(True)
wordcount.bywords(True)
indexgen.indexgen(True) indexgen.indexgen(True)
verifygen.verifygen(True) verifygen.verifygen(True)
statsgen.yeargen(True) statsgen.yeargen(True)
@ -41,6 +43,7 @@ if __name__ == "__main__":
characters.charlist() characters.charlist()
ships.shiplist() ships.shiplist()
events.eventlist() events.eventlist()
wordcount.bywords()
indexgen.indexgen() indexgen.indexgen()
verifygen.verifygen() verifygen.verifygen()
statsgen.yeargen() statsgen.yeargen()

@ -37,7 +37,12 @@ def indexgen(local=False):
filewrite.write("ff/ships/index.html") filewrite.write("ff/ships/index.html")
else: else:
filewrite.write("/fic/ff/ships") filewrite.write("/fic/ff/ships")
filewrite.write("\">by ship</a></li>\n</ul>\n</div>\n<div class=\"fic\">\n<h2><a href=\"") filewrite.write("\">by ship</a></li>\n<li><a href=\"")
if local:
filewrite.write("ff/bywords/index.html")
else:
filewrite.write("/fic/ff/bywords")
filewrite.write("\">by length</a></li>\n</ul>\n</div>\n<div class=\"fic\">\n<h2><a href=\"")
if local: if local:
filewrite.write("events/index.html") filewrite.write("events/index.html")
else: else:

@ -13,7 +13,7 @@ def listgen(local=False):
if os.path.exists("build/masterlist/index.html"): if os.path.exists("build/masterlist/index.html"):
os.remove("build/masterlist/index.html") os.remove("build/masterlist/index.html")
# write header # write header
headerfooter.headerwrite("build/masterlist/index.html","Masterlist","Fic masterlist","<p>On this page, from newest to oldest, youll find basically everything Ive ever written that is a. fanfiction and b. extant; quality may vary. RPF and things I wrote before 2020 require a username and password to access.</p>",False,local) headerfooter.headerwrite("build/masterlist/index.html","Masterlist","Fic masterlist","<p>On this page, from newest to oldest, youll find basically everything Ive ever written that is a. fanfiction and b. extant; quality may vary. Some fics, such as things I wrote before 2020, require a username and password to access.</p>",False,local)
# write fic divs # write fic divs
ficcount = 500 ficcount = 500
while ficcount > 0: while ficcount > 0:

@ -0,0 +1,54 @@
import datetime, os
from importlib import import_module
fffandoms = ["FF1","FF2","FF3","FF4","FF5","FF6","FF7","FF8","FF9","FFX","FF11","FF12","FF13","FF14","FF15","FF16"]
import makeheader
import headerfooter
def bywords(local=False):
# delete existing file
if os.path.exists("build/ff/bywords/index.html"):
os.remove("build/ff/bywords/index.html")
# write header
headerfooter.headerwrite("build/ff/bywords/index.html","FF fics by word count","FF fics by word count","<p>On this page, my FF fics are sorted from longest to shortest. (Fics with translations are listed according to the wordcount of the original version; the wordcount for the translation is normally pretty close to this.)</p>",False,local)
# iterate through fandoms
ficlist = []
ficcount = 500
while ficcount > 0:
ficcount -= 1
if ficcount < 10:
ficcountstring = "00" + str(ficcount)
elif ficcount < 100:
ficcountstring = "0" + str(ficcount)
else:
ficcountstring = str(ficcount)
if os.path.exists("originalsmeta/" + ficcountstring + ".py"):
ficfile = "originalsmeta." + ficcountstring
fileread = import_module(ficfile)
try:
if fileread.revealdate > datetime.datetime.now():
revealed = False
else:
revealed = True
except:
revealed = True
if revealed == True:
fffic = False
for fandom in fileread.fandom:
if fandom in fffandoms:
fffic = True
if fffic == True:
sumwords = 0
for instalment in fileread.datewords:
sumwords = sumwords + instalment["words"]
ficlist.append({"ficno":ficcount,"length":sumwords})
ficlist = sorted(ficlist, key=lambda d: d["length"],reverse=True)
# write fic headers
for fic in ficlist:
makeheader.ficgen(fic["ficno"],False,"build/ff/bywords/index.html",local)
# write footer
headerfooter.footerwrite("build/ff/bywords/index.html",False,local)
if __name__ == "__main__":
bywords(True)
Loading…
Cancel
Save