diff --git a/build/ff/bywords/.gitkeep b/build/ff/bywords/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/commentpage.py b/commentpage.py index 0290b6c..6cabf0d 100644 --- a/commentpage.py +++ b/commentpage.py @@ -160,7 +160,7 @@ def commentindex(local=False): # write header headerfooter.headerwrite("build/comments/index.html","Comments","Comments","",False,local) filewrite = open("build/comments/index.html", "a") - filewrite.write("

Comments I receive are archived on this site and linked back to the original. If you don’t want your comments from other sources archived here, or if you require any changes to the presentation of your comments, please email me. Please note, however, that this website is not indexed by search engines and the only place I really “advertise” it is Dreamwidth.

\n

You can leave comments on the relevant comment pages for each fic. If you’d like notification of any reply, please leave your email address. If you’d like a link from your pseudonym to a website, you can supply this as well. I’ll happily link to personal websites, Dreamwidth profiles, and (at least for now) AO3 profiles; I’m unlikely to include links to for-profit social media websites, Carrd, or Patreon.

\n

Comments are turned off on any fic over two years old unless it’s in a Final Fantasy fandom. On AO3, comments are turned off on all fics over two years old, unless they were written for AO3-hosted gift exchanges in 2020 or later.

\n") + filewrite.write("

Comments I receive are archived on this site and linked back to the original. If you don’t want your comments from other sources archived here, or if you require any changes to the presentation of your comments, please email me. 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.

\n

You can leave comments on the relevant comment pages for each fic. If you’d like notification of any reply, please leave your email address. If you’d like a link from your pseudonym to a website, you can supply this as well. I’ll happily link to personal websites, Dreamwidth profiles, and (at least for now) AO3 profiles; I’m unlikely to include links to for-profit social media websites, Carrd, or Patreon.

\n

Comments are turned off on any fic over two years old unless it’s 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.

\n") filewrite.close() headerfooter.footerwrite("build/comments/index.html",False,local) diff --git a/fandoms.py b/fandoms.py index 8cae1f7..9134e00 100644 --- a/fandoms.py +++ b/fandoms.py @@ -9,7 +9,7 @@ def fandomlist(local=False): if os.path.exists("build/byfandom/index.html"): os.remove("build/byfandom/index.html") # write header - headerfooter.headerwrite("build/byfandom/index.html","Fics by fandom","Fics by fandom","

On this page, you’ll find basically everything I’ve 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.

",False,local) + headerfooter.headerwrite("build/byfandom/index.html","Fics by fandom","Fics by fandom","

On this page, you’ll find basically everything I’ve 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.

",False,local) # get list of fandoms fandoms = [] ficcount = 500 diff --git a/feed.py b/feed.py index 96e42dd..b753439 100644 --- a/feed.py +++ b/feed.py @@ -187,7 +187,7 @@ def feedgen(local=False): filewrite.write(" in this update") filewrite.write(".") try: - filewrite.write(" " + re.sub("<[^<]+?>", "", thefile.summary)) + filewrite.write(" " + re.sub("<[^<]+?>","",re.sub(".*","[spoiler]",thefile.summary))) except: filewrite.write(" No summary provided.") try: diff --git a/generate.py b/generate.py index 18b93e4..29d9b94 100644 --- a/generate.py +++ b/generate.py @@ -6,6 +6,7 @@ import feed import characters import ships import events +import wordcount import indexgen import verifygen import statsgen @@ -29,6 +30,7 @@ if __name__ == "__main__": characters.charlist(True) ships.shiplist(True) events.eventlist(True) + wordcount.bywords(True) indexgen.indexgen(True) verifygen.verifygen(True) statsgen.yeargen(True) @@ -41,6 +43,7 @@ if __name__ == "__main__": characters.charlist() ships.shiplist() events.eventlist() + wordcount.bywords() indexgen.indexgen() verifygen.verifygen() statsgen.yeargen() diff --git a/indexgen.py b/indexgen.py index 8b98ce1..8918a71 100644 --- a/indexgen.py +++ b/indexgen.py @@ -37,7 +37,12 @@ def indexgen(local=False): filewrite.write("ff/ships/index.html") else: filewrite.write("/fic/ff/ships") - filewrite.write("\">by ship\n\n\n
\n

by ship\n
  • by length
  • \n\n

    \n
    \n

    On this page, from newest to oldest, you’ll find basically everything I’ve 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.

    ",False,local) + headerfooter.headerwrite("build/masterlist/index.html","Masterlist","Fic masterlist","

    On this page, from newest to oldest, you’ll find basically everything I’ve 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.

    ",False,local) # write fic divs ficcount = 500 while ficcount > 0: diff --git a/wordcount.py b/wordcount.py new file mode 100644 index 0000000..6c47779 --- /dev/null +++ b/wordcount.py @@ -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","

    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.)

    ",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)