Account for unrevealed exchange/challenge fics, change some wording

master
trémeur 2 years ago
parent 48534c366f
commit 6b0112dc26

@ -1,4 +1,4 @@
import os import datetime, os
from importlib import import_module from importlib import import_module
fffandoms = ["FF1","FF2","FF3","FF4","FF5","FF6","FF7","FF8","FF9","FFX","FF11","FF12","FF13","FF14","FF15"] fffandoms = ["FF1","FF2","FF3","FF4","FF5","FF6","FF7","FF8","FF9","FFX","FF11","FF12","FF13","FF14","FF15"]
@ -29,24 +29,32 @@ def charlist(local=False):
if os.path.exists("originalsmeta/" + ficcountstring + ".py"): if os.path.exists("originalsmeta/" + ficcountstring + ".py"):
ficfile = "originalsmeta." + ficcountstring ficfile = "originalsmeta." + ficcountstring
fileread = import_module(ficfile) fileread = import_module(ficfile)
if len(fileread.fandom) == 1: try:
if fandom in fileread.fandom: if fileread.revealdate > datetime.datetime.now():
try: revealed = False
thecharacters.extend(fileread.charpov) else:
except: revealed = True
pass except:
try: revealed = True
thecharacters.extend(fileread.charmain) if revealed == True:
except: if len(fileread.fandom) == 1:
pass if fandom in fileread.fandom:
try: try:
thecharacters.extend(fileread.charsecondary) thecharacters.extend(fileread.charpov)
except: except:
pass pass
try: try:
thecharacters.extend(fileread.charmention) thecharacters.extend(fileread.charmain)
except: except:
pass pass
try:
thecharacters.extend(fileread.charsecondary)
except:
pass
try:
thecharacters.extend(fileread.charmention)
except:
pass
thecharacters = sorted(list(dict.fromkeys(thecharacters))) thecharacters = sorted(list(dict.fromkeys(thecharacters)))
for character in thecharacters: for character in thecharacters:
if character != "OCs": if character != "OCs":
@ -74,28 +82,36 @@ def charlist(local=False):
if os.path.exists("originalsmeta/" + ficcountstring + ".py"): if os.path.exists("originalsmeta/" + ficcountstring + ".py"):
countfile = "originalsmeta." + ficcountstring countfile = "originalsmeta." + ficcountstring
fileread = import_module(countfile) fileread = import_module(countfile)
if searchfandom in fileread.fandom: try:
# append to lists if fileread.revealdate > datetime.datetime.now():
try: revealed = False
if character in fileread.charpov: else:
povcount.append(ficcount) revealed = True
except: except:
pass revealed = True
try: if revealed == True:
if character in fileread.charmain: if searchfandom in fileread.fandom:
maincount.append(ficcount) # append to lists
except: try:
pass if character in fileread.charpov:
try: povcount.append(ficcount)
if character in fileread.charsecondary: except:
secondarycount.append(ficcount) pass
except: try:
pass if character in fileread.charmain:
try: maincount.append(ficcount)
if character in fileread.charmention: except:
mentioncount.append(ficcount) pass
except: try:
pass if character in fileread.charsecondary:
secondarycount.append(ficcount)
except:
pass
try:
if character in fileread.charmention:
mentioncount.append(ficcount)
except:
pass
# write details element # write details element
output = "build/ff/characters/index.html" output = "build/ff/characters/index.html"
filewrite = open(output, "a") filewrite = open(output, "a")

@ -25,12 +25,20 @@ def eventlist(local=False):
ficfile = "originalsmeta." + ficcountstring ficfile = "originalsmeta." + ficcountstring
fileread = import_module(ficfile) fileread = import_module(ficfile)
try: try:
events.append({"name":fileread.eventname,"location":fileread.eventlocation,"sortname":fileread.eventname.lower()}) if fileread.revealdate > datetime.datetime.now():
revealed = False
else:
revealed = True
except: except:
revealed = True
if revealed == True:
try: try:
events.append({"name":fileread.eventname,"location":"","sortname":fileread.eventname.lower()}) events.append({"name":fileread.eventname,"location":fileread.eventlocation,"sortname":fileread.eventname.lower()})
except: except:
pass try:
events.append({"name":fileread.eventname,"location":"","sortname":fileread.eventname.lower()})
except:
pass
newlist = [] newlist = []
for event in events: for event in events:
if event not in newlist: if event not in newlist:
@ -53,10 +61,18 @@ def eventlist(local=False):
countfile = "originalsmeta." + ficcountstring countfile = "originalsmeta." + ficcountstring
fileread = import_module(countfile) fileread = import_module(countfile)
try: try:
if fileread.eventname == theevent: if fileread.revealdate > datetime.datetime.now():
evententries.append({"ficno":ficcount,"year":(fileread.datewords[0])["date"].year,"fandom":fileread.fandom}) revealed = False
else:
revealed = True
except: except:
pass revealed = True
if revealed == True:
try:
if fileread.eventname == theevent:
evententries.append({"ficno":ficcount,"year":(fileread.datewords[0])["date"].year,"fandom":fileread.fandom})
except:
pass
eventfandoms = [] eventfandoms = []
for entry in evententries: for entry in evententries:
eventfandoms.extend(entry["fandom"]) eventfandoms.extend(entry["fandom"])

@ -26,8 +26,12 @@ def feedgen(local=False):
if os.path.exists("originalsmeta/" + ficcountstring + ".py"): if os.path.exists("originalsmeta/" + ficcountstring + ".py"):
ficfile = "originalsmeta." + ficcountstring ficfile = "originalsmeta." + ficcountstring
fileread = import_module(ficfile) fileread = import_module(ficfile)
for instalment in fileread.datewords: try:
datelist.append(instalment["date"]) if fileread.revealdate <= datetime.datetime.now():
datelist.append(fileread.revealdate)
except:
for instalment in fileread.datewords:
datelist.append(instalment["date"])
elif os.path.exists("translationsmeta/" + ficcountstring + ".py"): elif os.path.exists("translationsmeta/" + ficcountstring + ".py"):
ficfile = "translationsmeta." + ficcountstring ficfile = "translationsmeta." + ficcountstring
fileread = import_module(ficfile) fileread = import_module(ficfile)
@ -52,10 +56,16 @@ def feedgen(local=False):
if os.path.exists("originalsmeta/" + ficcountstring + ".py"): if os.path.exists("originalsmeta/" + ficcountstring + ".py"):
ficfile = "originalsmeta." + ficcountstring ficfile = "originalsmeta." + ficcountstring
fileread = import_module(ficfile) fileread = import_module(ficfile)
for instalment in fileread.datewords: try:
if instalment["date"] == date: if fileread.revealdate <= datetime.datetime.now():
if targetfile == 0: if fileread.revealdate == date:
targetfile = ficfile if targetfile == 0:
targetfile = ficfile
except:
for instalment in fileread.datewords:
if instalment["date"] == date:
if targetfile == 0:
targetfile = ficfile
elif os.path.exists("translationsmeta/" + ficcountstring + ".py"): elif os.path.exists("translationsmeta/" + ficcountstring + ".py"):
transfile = "translationsmeta." + ficcountstring transfile = "translationsmeta." + ficcountstring
transread = import_module(transfile) transread = import_module(transfile)
@ -69,8 +79,12 @@ def feedgen(local=False):
thefile = import_module(targetfile) thefile = import_module(targetfile)
filewrite = open("build/feed.xml", "a") filewrite = open("build/feed.xml", "a")
filewrite.write("<item>\n<title>") filewrite.write("<item>\n<title>")
if (thefile.datewords[0])["date"] != date: try:
filewrite.write("Updated: ") if thefile.revealdate == True:
pass
except:
if (thefile.datewords[0])["date"] != date:
filewrite.write("Updated: ")
filewrite.write("Fic " + ficcountstring) filewrite.write("Fic " + ficcountstring)
if thefile.language == "fr": if thefile.language == "fr":
filewrite.write (" (French)") filewrite.write (" (French)")
@ -150,7 +164,7 @@ def feedgen(local=False):
filewrite.write(futuredate.strftime("%a, %-d %b %Y")) filewrite.write(futuredate.strftime("%a, %-d %b %Y"))
filewrite.write(" 00:00:00 UT</pubDate>\n<link>") filewrite.write(" 00:00:00 UT</pubDate>\n<link>")
if local: if local:
filewrite.write("/home/mdd/Documents/drive/proj/fic-archive/build/masterlist") filewrite.write("/home/mdd/Documents/drive/proj/fic-archive/build/masterlist/index.html")
else: else:
filewrite.write("https://tre.praze.net/fic/masterlist") filewrite.write("https://tre.praze.net/fic/masterlist")
filewrite.write("#fic" + ficcountstring + "</link>\n<guid isPermaLink=\"false\">praze-fic-" + ficcountstring) filewrite.write("#fic" + ficcountstring + "</link>\n<guid isPermaLink=\"false\">praze-fic-" + ficcountstring)

@ -9,7 +9,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! Its also archived at AO3 under the name <span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://archiveofourown.org/users/ovely/profile\"><img src=\"https://p.dreamwidth.org/b164c54b26e4/-/archiveofourown.org/favicon.ico\" alt=\"[archiveofourown.org profile]\" width=\"16\" height=\"16\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\" /></a><a href=\"https://archiveofourown.org/users/ovely/pseuds/ovely\"><b>ovely</b></a></span>.</p>\n<p>Ive recently implemented comments read about that <a href=\"") filewrite.write("<p>Here is all my fanfiction! Much of it is also archived at AO3 under the name <span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://archiveofourown.org/users/ovely/profile\"><img src=\"https://p.dreamwidth.org/b164c54b26e4/-/archiveofourown.org/favicon.ico\" alt=\"[archiveofourown.org profile]\" width=\"16\" height=\"16\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\" /></a><a href=\"https://archiveofourown.org/users/ovely/pseuds/ovely\"><b>ovely</b></a></span>.</p>\n<p>Ive recently implemented comments read about that <a href=\"")
if local: if local:
filewrite.write("comments/index.html") filewrite.write("comments/index.html")
else: else:

@ -35,377 +35,379 @@ def ficgen(ficno,unique=False,output="output.html",local=False):
translationfile = "translationsmeta." + translationstring translationfile = "translationsmeta." + translationstring
transread = import_module(translationfile) transread = import_module(translationfile)
except: except:
pass pass
# write to output file
filewrite = open(output, "a")
filewrite.write("<div class=\"fic\"")
# give the div an id if requested
if unique:
filewrite.write(" id=\"fic" + ficnostring + "\"")
filewrite.write(">\n<h1><span class=\"ficno\">" + ficnostring)
# write ficno including translation if there is one
try: try:
filewrite.write("/" + translationstring) if fileread.revealdate > datetime.datetime.now():
revealed = False
else:
revealed = True
except: except:
pass revealed = True
filewrite.write("</span>") if revealed == True:
# write title if requested # write to output file
if fileread.showtitle: filewrite = open(output, "a")
filewrite.write(" <span class=\"fictitle\">" + fileread.title) filewrite.write("<div class=\"fic\"")
# give the div an id if requested
if unique:
filewrite.write(" id=\"fic" + ficnostring + "\"")
filewrite.write(">\n<h1><span class=\"ficno\">" + ficnostring)
# write ficno including translation if there is one
try: try:
if transread.showtitle: filewrite.write("/" + translationstring)
filewrite.write("/" + transread.title)
except: except:
pass pass
filewrite.write("</span>") filewrite.write("</span>")
else: # write title if requested
try: if fileread.showtitle:
if transread.showtitle: filewrite.write(" <span class=\"fictitle\">" + fileread.title)
filewrite.write(" <span class=\"fictitle\">" + transread.title)
except:
pass
if fileread.status == "abandoned":
filewrite.write(" <span class=\"abandoned\"></span>")
filewrite.write("</h1>\n<ul class=\"ficmeta\">\n<li class=\"ficdate\">")
# write date, date range if ranged or translation
if fileread.status == "incomplete":
filewrite.write((fileread.datewords[0])["date"].strftime("%-d %B %Y") + "")
else:
try:
if transread.status == "incomplete":
filewrite.write((fileread.datewords[0])["date"].strftime("%-d %B %Y") + "")
else:
if fileread.translation:
if (transread.datewords[-1])["date"].year == (fileread.datewords[0])["date"].year:
if (transread.datewords[-1])["date"].month == (fileread.datewords[0])["date"].month:
if (transread.datewords[-1])["date"].date == (fileread.datewords[0])["date"].date:
filewrite.write((fileread.datewords[0])["date"].strftime("%-d %B %Y"))
else:
filewrite.write((fileread.datewords[0])["date"].strftime("%-d") + "" + (transread.datewords[-1])["date"].strftime("%-d %B %Y"))
else:
filewrite.write((fileread.datewords[0])["date"].strftime("%-d %B") + "" + (transread.datewords[-1])["date"].strftime("%-d %B %Y"))
else:
filewrite.write((fileread.datewords[0])["date"].strftime("%-d %B %Y") + "" + (transread.datewords[-1])["date"].strftime("%-d %B %Y"))
except:
try:
filewrite.write(fileread.approxdate)
except:
if (fileread.datewords[0])["date"].year == (fileread.datewords[-1])["date"].year:
if (fileread.datewords[0])["date"].month == (fileread.datewords[-1])["date"].month:
if (fileread.datewords[0])["date"] == (fileread.datewords[-1])["date"]:
filewrite.write((fileread.datewords[-1])["date"].strftime("%-d %B %Y"))
else:
filewrite.write((fileread.datewords[0])["date"].strftime("%-d") + "" + (fileread.datewords[-1])["date"].strftime("%-d %B %Y"))
else:
filewrite.write((fileread.datewords[0])["date"].strftime("%-d %B") + "" + (fileread.datewords[-1])["date"].strftime("%-d %B %Y"))
else:
filewrite.write((fileread.datewords[0])["date"].strftime("%-d %B %Y") + "" + (fileread.datewords[-1])["date"].strftime("%-d %B %Y"))
# write wordcount
sumwords = 0
for instalment in fileread.datewords:
sumwords = sumwords + instalment["words"]
filewrite.write("</li>\n<li class=\"wordcount\">" + str(sumwords))
transwords = 0
try:
for instalment in transread.datewords:
transwords = transwords + instalment["words"]
filewrite.write(" + " + str(transwords))
except:
pass
# write rating
filewrite.write("</li>\n<li class=\"rating\"><span class=\"" + fileread.rating + "\">")
# write reason for rating if there is one
try:
filewrite.write(" (" + fileread.ratingreason + ")")
except:
pass
filewrite.write("</span></li>\n<li class=\"fandom\">")
# write fandom
try:
filewrite.write(fileread.fandomtext)
except:
filewrite.write("/".join(fileread.fandom))
filewrite.write("</li>\n")
# write characters in pov, main, secondary categories, if they exist
try:
filewrite.write("<li class=\"characters\">" + fileread.charactertext + "</li>\n")
except:
try:
filewrite.write("<li class=\"characters\">" + ", ".join(fileread.charpov))
try: try:
filewrite.write(", " + ", ".join(fileread.charmain)) if transread.showtitle:
filewrite.write("/" + transread.title)
except: except:
pass pass
filewrite.write("</span>")
else:
try: try:
filewrite.write(", " + "<small>" + ", ".join(fileread.charsecondary) + "</small>") if transread.showtitle:
filewrite.write(" <span class=\"fictitle\">" + transread.title)
except: except:
pass pass
filewrite.write("</li>\n") if fileread.status == "abandoned":
except: filewrite.write(" <span class=\"abandoned\"></span>")
filewrite.write("</h1>\n<ul class=\"ficmeta\">\n<li class=\"ficdate\">")
# write date, date range if ranged or translation
if fileread.status == "incomplete":
filewrite.write((fileread.datewords[0])["date"].strftime("%-d %B %Y") + "")
else:
try: try:
filewrite.write("<li class=\"characters\">" + ", ".join(fileread.charmain)) if transread.status == "incomplete":
try: filewrite.write((fileread.datewords[0])["date"].strftime("%-d %B %Y") + "")
filewrite.write(", " + "<small>" + ", ".join(fileread.charsecondary) + "</small>") else:
except: if fileread.translation:
pass if (transread.datewords[-1])["date"].year == (fileread.datewords[0])["date"].year:
filewrite.write("</li>\n") if (transread.datewords[-1])["date"].month == (fileread.datewords[0])["date"].month:
if (transread.datewords[-1])["date"].date == (fileread.datewords[0])["date"].date:
filewrite.write((fileread.datewords[0])["date"].strftime("%-d %B %Y"))
else:
filewrite.write((fileread.datewords[0])["date"].strftime("%-d") + "" + (transread.datewords[-1])["date"].strftime("%-d %B %Y"))
else:
filewrite.write((fileread.datewords[0])["date"].strftime("%-d %B") + "" + (transread.datewords[-1])["date"].strftime("%-d %B %Y"))
else:
filewrite.write((fileread.datewords[0])["date"].strftime("%-d %B %Y") + "" + (transread.datewords[-1])["date"].strftime("%-d %B %Y"))
except: except:
try: try:
filewrite.write("<li class=\"characters\">" + ", ".join(fileread.charsecondary) + "</li>\n") filewrite.write(fileread.approxdate)
except: except:
pass if (fileread.datewords[0])["date"].year == (fileread.datewords[-1])["date"].year:
# write genre if (fileread.datewords[0])["date"].month == (fileread.datewords[-1])["date"].month:
filewrite.write("<li class=\"genre\">" + ", ".join(fileread.genre) + "</li>\n") if (fileread.datewords[0])["date"] == (fileread.datewords[-1])["date"]:
# write warnings if they exist filewrite.write((fileread.datewords[-1])["date"].strftime("%-d %B %Y"))
try: else:
filewrite.write("<li class=\"warnings\">" + fileread.warnings + "</li>\n") filewrite.write((fileread.datewords[0])["date"].strftime("%-d") + "" + (fileread.datewords[-1])["date"].strftime("%-d %B %Y"))
except: else:
pass filewrite.write((fileread.datewords[0])["date"].strftime("%-d %B") + "" + (fileread.datewords[-1])["date"].strftime("%-d %B %Y"))
# write point in canon if there is one else:
try: filewrite.write((fileread.datewords[0])["date"].strftime("%-d %B %Y") + "" + (fileread.datewords[-1])["date"].strftime("%-d %B %Y"))
filewrite.write("<li class=\"time\">" + fileread.time + "</li>\n") # write wordcount
except: sumwords = 0
pass for instalment in fileread.datewords:
# write locations if there are any sumwords = sumwords + instalment["words"]
try: filewrite.write("</li>\n<li class=\"wordcount\">" + str(sumwords))
filewrite.write("<li class=\"location\">" + fileread.locationtext + "</li>\n") transwords = 0
except:
try: try:
filewrite.write("<li class=\"location\">" + ", ".join(fileread.location) + "</li>\n") for instalment in transread.datewords:
transwords = transwords + instalment["words"]
filewrite.write(" + " + str(transwords))
except: except:
pass pass
filewrite.write("</ul>\n") # write rating
# write summary if there is one filewrite.write("</li>\n<li class=\"rating\"><span class=\"" + fileread.rating + "\">")
try: # write reason for rating if there is one
if transread.language == "en": try:
filewrite.write(" (" + fileread.ratingreason + ")")
except:
pass
filewrite.write("</span></li>\n<li class=\"fandom\">")
# write fandom
try:
filewrite.write(fileread.fandomtext)
except:
filewrite.write("/".join(fileread.fandom))
filewrite.write("</li>\n")
# write characters in pov, main, secondary categories, if they exist
try:
filewrite.write("<li class=\"characters\">" + fileread.charactertext + "</li>\n")
except:
try: try:
filewrite.write("<p class=\"summary\">" + transread.summary) filewrite.write("<li class=\"characters\">" + ", ".join(fileread.charpov))
try:
filewrite.write(" " + fileread.summary + "</p>\n")
except:
filewrite.write("</p>\n")
except:
try: try:
filewrite.write("<p class=\"summary\">" + fileread.summary + "</p>\n") filewrite.write(", " + ", ".join(fileread.charmain))
except: except:
pass pass
elif transread.language == "fr":
try:
filewrite.write("<p class=\"summary\">" + fileread.summary)
try: try:
filewrite.write(" " + transread.summary + "</p>\n") filewrite.write(", " + "<small>" + ", ".join(fileread.charsecondary) + "</small>")
except: except:
filewrite.write("</p>\n") pass
filewrite.write("</li>\n")
except: except:
try: try:
filewrite.write("<p class=\"summary\">" + transread.summary + "</p>\n") filewrite.write("<li class=\"characters\">" + ", ".join(fileread.charmain))
try:
filewrite.write(", " + "<small>" + ", ".join(fileread.charsecondary) + "</small>")
except:
pass
filewrite.write("</li>\n")
except: except:
pass try:
except: filewrite.write("<li class=\"characters\">" + ", ".join(fileread.charsecondary) + "</li>\n")
except:
pass
# write genre
filewrite.write("<li class=\"genre\">" + ", ".join(fileread.genre) + "</li>\n")
# write warnings if they exist
try: try:
filewrite.write("<p class=\"summary\">" + fileread.summary + "</p>\n") filewrite.write("<li class=\"warnings\">" + fileread.warnings + "</li>\n")
except: except:
pass pass
# set up notes paragraph if required # write point in canon if there is one
if (fileread.datewords[0])["date"].year < 2011:
juvenilia = True
else:
juvenilia = False
try:
if fileread.notes:
filewrite.write("<p class=\"note\">")
except:
try: try:
if fileread.event: filewrite.write("<li class=\"time\">" + fileread.time + "</li>\n")
filewrite.write("<p class=\"note\">")
except: except:
if juvenilia: pass
filewrite.write("<p class=\"note\">") # write locations if there are any
# if juvenilia, add age
if juvenilia:
age = relativedelta((fileread.datewords[0])["date"], datetime.datetime(1993,6,28)).years
filewrite.write("Age at time of writing: " + str(age) + ".")
try: try:
if fileread.notes: filewrite.write("<li class=\"location\">" + fileread.locationtext + "</li>\n")
filewrite.write(" ")
except: except:
pass
# write event details if there are any
try:
if fileread.eventname == "fail-fandomanon":
filewrite.write("In response to prompt at <span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://fail-fandomanon.dreamwidth.org/profile\"><img src=\"https://www.dreamwidth.org/img/silk/identity/community.png\" alt=\"[community profile]\" width=\"17\" height=\"17\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a href=\"https://fail-fandomanon.dreamwidth.org/\"><b>fail_fandomanon</b></a></span>: <i>" + fileread.prompt + "</i>.")
try: try:
if fileread.notes: filewrite.write("<li class=\"location\">" + ", ".join(fileread.location) + "</li>\n")
filewrite.write(" ")
except: except:
pass pass
elif fileread.eventname == "robotsoup": filewrite.write("</ul>\n")
filewrite.write("Written for <span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://kalloway.dreamwidth.org/profile\"><img src=\"https://www.dreamwidth.org/img/silk/identity/user.png\" alt=\"[personal profile]\" width=\"17\" height=\"17\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a href=\"https://kalloway.dreamwidth.org/\"><b>kalloway</b></a></span>s " + fileread.eventdeets + " fest.") # write summary if there is one
try:
if transread.language == "en":
try:
filewrite.write("<p class=\"summary\">" + transread.summary)
try:
filewrite.write(" " + fileread.summary + "</p>\n")
except:
filewrite.write("</p>\n")
except:
try:
filewrite.write("<p class=\"summary\">" + fileread.summary + "</p>\n")
except:
pass
elif transread.language == "fr":
try:
filewrite.write("<p class=\"summary\">" + fileread.summary)
try:
filewrite.write(" " + transread.summary + "</p>\n")
except:
filewrite.write("</p>\n")
except:
try:
filewrite.write("<p class=\"summary\">" + transread.summary + "</p>\n")
except:
pass
except:
try: try:
if fileread.notes: filewrite.write("<p class=\"summary\">" + fileread.summary + "</p>\n")
filewrite.write(" ")
except: except:
pass pass
# set up notes paragraph if required
if (fileread.datewords[0])["date"].year < 2011:
juvenilia = True
else: else:
filewrite.write("Written for ") juvenilia = False
try:
if fileread.notes:
filewrite.write("<p class=\"note\">")
except:
try: try:
if fileread.eventlocation == "dwcomm": if fileread.event:
filewrite.write("<span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://" + fileread.eventname.replace("_","-") + ".dreamwidth.org/profile\"><img src=\"https://www.dreamwidth.org/img/silk/identity/community.png\" alt=\"[community profile]\" width=\"17\" height=\"17\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a href=\"https://" + fileread.eventname.replace("_","-") + ".dreamwidth.org/\"><b>" + fileread.eventname.replace("-","_") + "</b></a></span>") filewrite.write("<p class=\"note\">")
elif fileread.eventlocation == "dwjournal":
filewrite.write("<span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://" + fileread.eventname.replace("_","-") + ".dreamwidth.org/profile\"><img src=\"https://www.dreamwidth.org/img/silk/identity/user.png\" alt=\"[personal profile]\" width=\"17\" height=\"17\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a href=\"https://"+ fileread.eventname.replace("_","-") + ".dreamwidth.org/\"><b>" + fileread.eventname.replace("-","_")+ "</b></a></span>")
elif fileread.eventlocation == "ljjournal":
filewrite.write("<span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://" + fileread.eventname.replace("_","-") + ".livejournal.com/profile\"><img src=\"https://www.dreamwidth.org/img/external/lj-userinfo.gif\" alt=\"[personal profile]\" width=\"17\" height=\"17\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a href=\"https://"+ fileread.eventname.replace("_","-") + ".livejournal.com/\"><b>" + fileread.eventname.replace("-","_")+ "</b></a></span>")
except: except:
if fileread.eventname == "Semaine de la fic française": if juvenilia:
filewrite.write("<i>Semaine de la fic française</i>") filewrite.write("<p class=\"note\">")
else: # if juvenilia, add age
filewrite.write(fileread.eventname) if juvenilia:
age = relativedelta((fileread.datewords[0])["date"], datetime.datetime(1993,6,28)).years
filewrite.write("Age at time of writing: " + str(age) + ".")
try: try:
if fileread.eventfrequency == "annual": if fileread.notes:
filewrite.write(" " + str((fileread.datewords[0])["date"].year)) filewrite.write(" ")
else:
filewrite.write(" " + fileread.eventfrequency)
except: except:
pass pass
if fileread.event == "prompt": # write event details if there are any
filewrite.write(", in response to ") try:
try: if fileread.eventname == "fail-fandomanon":
if fileread.recip: filewrite.write("In response to prompt at <span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://fail-fandomanon.dreamwidth.org/profile\"><img src=\"https://www.dreamwidth.org/img/silk/identity/community.png\" alt=\"[community profile]\" width=\"17\" height=\"17\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a href=\"https://fail-fandomanon.dreamwidth.org/\"><b>fail_fandomanon</b></a></span>: <i>" + fileread.prompt + "</i>.")
try:
if fileread.recipsite == "dw":
filewrite.write("<span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://" + fileread.recip.replace("_","-") + ".dreamwidth.org/profile\"><img src=\"https://www.dreamwidth.org/img/silk/identity/user.png\" alt=\"[personal profile]\" width=\"17\" height=\"17\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a href=\"https://"+ fileread.recip.replace("_","-") + ".dreamwidth.org/\"><b>" + fileread.recip.replace("-","_") + "</b></a></span>")
elif fileread.recipsite == "ao3":
try:
if fileread.recippseud:
filewrite.write("<span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://archiveofourown.org/users/" + fileread.recip + "/profile\"><img src=\"https://p.dreamwidth.org/b164c54b26e4/-/archiveofourown.org/favicon.ico\" alt=\"[archiveofourown.org profile]\" width=\"16\" height=\"16\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a href=\"https://archiveofourown.org/users/"+ fileread.recip + "/pseuds/" + fileread.recippseud.replace(" ","%20") + "\"><b>" + fileread.recippseud + " (" + fileread.recip + ")</b></a></span>")
except:
filewrite.write("<span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://archiveofourown.org/users/" + fileread.recip + "/profile\"><img src=\"https://p.dreamwidth.org/b164c54b26e4/-/archiveofourown.org/favicon.ico\" alt=\"[archiveofourown.org profile]\" width=\"16\" height=\"16\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a href=\"https://archiveofourown.org/users/"+ fileread.recip + "\"><b>" + fileread.recip + "</b></a></span>")
elif fileread.recipsite == "tumblr":
filewrite.write("<span style=\"white-space: nowrap;\"><a href=\"https://" + fileread.recip + ".tumblr.com\"><img src=\"https://www.tumblr.com/favicon.ico\" alt=\"[tumblr.com profile]\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\" width=\"16\" height=\"16\"></a><a href=\"https://" + fileread.recip + ".tumblr.com\"><b>" + fileread.recip + "</b></a></span>")
except:
filewrite.write(fileread.recip)
filewrite.write("s ")
except:
pass
filewrite.write("prompt, <i>" + fileread.prompt + "</i>.")
try: try:
if fileread.notes: if fileread.notes:
filewrite.write(" ") filewrite.write(" ")
except: except:
pass pass
elif fileread.event == "exchange" or fileread.event == "ao3exchange": elif fileread.eventname == "robotsoup":
filewrite.write(", a gift for ") filewrite.write("Written for <span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://kalloway.dreamwidth.org/profile\"><img src=\"https://www.dreamwidth.org/img/silk/identity/user.png\" alt=\"[personal profile]\" width=\"17\" height=\"17\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a href=\"https://kalloway.dreamwidth.org/\"><b>kalloway</b></a></span>s " + fileread.eventdeets + " fest.")
try:
if fileread.recipsite == "dw":
filewrite.write("<span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://" + fileread.recip.replace("_","-") + ".dreamwidth.org/profile\"><img src=\"https://www.dreamwidth.org/img/silk/identity/user.png\" alt=\"[personal profile]\" width=\"17\" height=\"17\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a href=\"https://"+ fileread.recip.replace("_","-") + ".dreamwidth.org/\"><b>" + fileread.recip.replace("-","_") + "</b></a></span>")
elif fileread.recipsite == "ao3":
try:
if fileread.recippseud:
filewrite.write("<span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://archiveofourown.org/users/" + fileread.recip + "/profile\"><img src=\"https://p.dreamwidth.org/b164c54b26e4/-/archiveofourown.org/favicon.ico\" alt=\"[archiveofourown.org profile]\" width=\"16\" height=\"16\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a href=\"https://archiveofourown.org/users/"+ fileread.recip + "/pseuds/" + fileread.recippseud.replace(" ","%20") + "\"><b>" + fileread.recippseud + " (" + fileread.recip + ")</b></a></span>")
except:
filewrite.write("<span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://archiveofourown.org/users/" + fileread.recip + "/profile\"><img src=\"https://p.dreamwidth.org/b164c54b26e4/-/archiveofourown.org/favicon.ico\" alt=\"[archiveofourown.org profile]\" width=\"16\" height=\"16\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a href=\"https://archiveofourown.org/users/" + fileread.recip + "\"><b>" + fileread.recip + "</b></a></span>")
elif fileread.recipsite == "tumblr":
filewrite.write("<span style=\"white-space: nowrap;\"><a href=\"https://" + fileread.recip + ".tumblr.com\"><img src=\"https://www.tumblr.com/favicon.ico\" alt=\"[tumblr.com profile]\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\" width=\"16\" height=\"16\"></a><a href=\"https://" + fileread.recip + ".tumblr.com\"><b>" + fileread.recip + "</b></a></span>")
except:
filewrite.write(fileread.recip)
filewrite.write(".")
try: try:
if fileread.notes: if fileread.notes:
filewrite.write(" ") filewrite.write(" ")
except: except:
pass pass
else: else:
filewrite.write(".") filewrite.write("Written for ")
try: try:
if fileread.notes: if fileread.eventlocation == "dwcomm":
filewrite.write(" ") filewrite.write("<span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://" + fileread.eventname.replace("_","-") + ".dreamwidth.org/profile\"><img src=\"https://www.dreamwidth.org/img/silk/identity/community.png\" alt=\"[community profile]\" width=\"17\" height=\"17\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a href=\"https://" + fileread.eventname.replace("_","-") + ".dreamwidth.org/\"><b>" + fileread.eventname.replace("-","_") + "</b></a></span>")
elif fileread.eventlocation == "dwjournal":
filewrite.write("<span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://" + fileread.eventname.replace("_","-") + ".dreamwidth.org/profile\"><img src=\"https://www.dreamwidth.org/img/silk/identity/user.png\" alt=\"[personal profile]\" width=\"17\" height=\"17\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a href=\"https://"+ fileread.eventname.replace("_","-") + ".dreamwidth.org/\"><b>" + fileread.eventname.replace("-","_")+ "</b></a></span>")
elif fileread.eventlocation == "ljjournal":
filewrite.write("<span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://" + fileread.eventname.replace("_","-") + ".livejournal.com/profile\"><img src=\"https://www.dreamwidth.org/img/external/lj-userinfo.gif\" alt=\"[personal profile]\" width=\"17\" height=\"17\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a href=\"https://"+ fileread.eventname.replace("_","-") + ".livejournal.com/\"><b>" + fileread.eventname.replace("-","_")+ "</b></a></span>")
except:
if fileread.eventname == "Semaine de la fic française":
filewrite.write("<i>Semaine de la fic française</i>")
else:
filewrite.write(fileread.eventname)
try:
if fileread.eventfrequency == "annual":
filewrite.write(" " + str((fileread.datewords[0])["date"].year))
else:
filewrite.write(" " + fileread.eventfrequency)
except: except:
pass pass
except: if fileread.event == "prompt":
pass filewrite.write(", in response to ")
# write notes if there are any try:
try: if fileread.recip:
filewrite.write(fileread.notes + "</p>\n") try:
except: if fileread.recipsite == "dw":
filewrite.write("<span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://" + fileread.recip.replace("_","-") + ".dreamwidth.org/profile\"><img src=\"https://www.dreamwidth.org/img/silk/identity/user.png\" alt=\"[personal profile]\" width=\"17\" height=\"17\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a href=\"https://"+ fileread.recip.replace("_","-") + ".dreamwidth.org/\"><b>" + fileread.recip.replace("-","_") + "</b></a></span>")
elif fileread.recipsite == "ao3":
try:
if fileread.recippseud:
filewrite.write("<span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://archiveofourown.org/users/" + fileread.recip + "/profile\"><img src=\"https://p.dreamwidth.org/b164c54b26e4/-/archiveofourown.org/favicon.ico\" alt=\"[archiveofourown.org profile]\" width=\"16\" height=\"16\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a href=\"https://archiveofourown.org/users/"+ fileread.recip + "/pseuds/" + fileread.recippseud.replace(" ","%20") + "\"><b>" + fileread.recippseud + " (" + fileread.recip + ")</b></a></span>")
except:
filewrite.write("<span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://archiveofourown.org/users/" + fileread.recip + "/profile\"><img src=\"https://p.dreamwidth.org/b164c54b26e4/-/archiveofourown.org/favicon.ico\" alt=\"[archiveofourown.org profile]\" width=\"16\" height=\"16\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a href=\"https://archiveofourown.org/users/"+ fileread.recip + "\"><b>" + fileread.recip + "</b></a></span>")
elif fileread.recipsite == "tumblr":
filewrite.write("<span style=\"white-space: nowrap;\"><a href=\"https://" + fileread.recip + ".tumblr.com\"><img src=\"https://www.tumblr.com/favicon.ico\" alt=\"[tumblr.com profile]\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\" width=\"16\" height=\"16\"></a><a href=\"https://" + fileread.recip + ".tumblr.com\"><b>" + fileread.recip + "</b></a></span>")
except:
filewrite.write(fileread.recip)
filewrite.write("s ")
except:
pass
filewrite.write("prompt, <i>" + fileread.prompt + "</i>.")
try:
if fileread.notes:
filewrite.write(" ")
except:
pass
elif fileread.event == "exchange" or fileread.event == "ao3exchange":
filewrite.write(", a gift for ")
try:
if fileread.recipsite == "dw":
filewrite.write("<span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://" + fileread.recip.replace("_","-") + ".dreamwidth.org/profile\"><img src=\"https://www.dreamwidth.org/img/silk/identity/user.png\" alt=\"[personal profile]\" width=\"17\" height=\"17\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a href=\"https://"+ fileread.recip.replace("_","-") + ".dreamwidth.org/\"><b>" + fileread.recip.replace("-","_") + "</b></a></span>")
elif fileread.recipsite == "ao3":
try:
if fileread.recippseud:
filewrite.write("<span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://archiveofourown.org/users/" + fileread.recip + "/profile\"><img src=\"https://p.dreamwidth.org/b164c54b26e4/-/archiveofourown.org/favicon.ico\" alt=\"[archiveofourown.org profile]\" width=\"16\" height=\"16\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a href=\"https://archiveofourown.org/users/"+ fileread.recip + "/pseuds/" + fileread.recippseud.replace(" ","%20") + "\"><b>" + fileread.recippseud + " (" + fileread.recip + ")</b></a></span>")
except:
filewrite.write("<span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://archiveofourown.org/users/" + fileread.recip + "/profile\"><img src=\"https://p.dreamwidth.org/b164c54b26e4/-/archiveofourown.org/favicon.ico\" alt=\"[archiveofourown.org profile]\" width=\"16\" height=\"16\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\"></a><a href=\"https://archiveofourown.org/users/" + fileread.recip + "\"><b>" + fileread.recip + "</b></a></span>")
elif fileread.recipsite == "tumblr":
filewrite.write("<span style=\"white-space: nowrap;\"><a href=\"https://" + fileread.recip + ".tumblr.com\"><img src=\"https://www.tumblr.com/favicon.ico\" alt=\"[tumblr.com profile]\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\" width=\"16\" height=\"16\"></a><a href=\"https://" + fileread.recip + ".tumblr.com\"><b>" + fileread.recip + "</b></a></span>")
except:
filewrite.write(fileread.recip)
filewrite.write(".")
try:
if fileread.notes:
filewrite.write(" ")
except:
pass
else:
filewrite.write(".")
try:
if fileread.notes:
filewrite.write(" ")
except:
pass
except:
pass
# write notes if there are any
try: try:
if fileread.event: filewrite.write(fileread.notes + "</p>\n")
filewrite.write("</p>\n")
except: except:
if juvenilia: try:
filewrite.write("</p>\n") if fileread.event:
filewrite.write("<ul class=\"ficlinks") filewrite.write("</p>\n")
# specify language if necessary except:
try: if juvenilia:
if fileread.translation: filewrite.write("</p>\n")
if fileread.language == "en": filewrite.write("<ul class=\"ficlinks")
filewrite.write(" english") # specify language if necessary
elif fileread.language == "fr": try:
filewrite.write (" french") if fileread.translation:
except: if fileread.language == "en":
pass filewrite.write(" english")
filewrite.write("\">\n") elif fileread.language == "fr":
# write html link if there is one filewrite.write (" french")
if fileread.html: except:
filewrite.write("<li class=\"prazelink\"><a ") pass
if fileread.locked: filewrite.write("\">\n")
filewrite.write("class=\"locked\" href=\"") # write html link if there is one
if local: if fileread.html:
filewrite.write("/home/mdd/Documents/drive/proj/fic-archive/build/secret/") filewrite.write("<li class=\"prazelink\"><a ")
else: if fileread.locked:
filewrite.write("/fic/secret/") filewrite.write("class=\"locked\" href=\"")
else: if local:
if local: filewrite.write("/home/mdd/Documents/drive/proj/fic-archive/build/secret/")
filewrite.write("href=\"/home/mdd/Documents/drive/proj/fic-archive/build/files/") else:
else: filewrite.write("/fic/secret/")
filewrite.write("href=\"/fic/files/")
filewrite.write(ficnostring + ".html\">HTML</a></li>\n")
# write pdf link if there is one
if fileread.pdf:
filewrite.write("<li class=\"prazelink\"><a ")
if fileread.locked:
filewrite.write("class=\"locked\" href=\"")
if local:
filewrite.write("/home/mdd/Documents/drive/proj/fic-archive/build/secret/")
else:
filewrite.write("/fic/secret/")
else:
if local:
filewrite.write("href=\"/home/mdd/Documents/drive/proj/fic-archive/build/files/")
else: else:
filewrite.write("href=\"/fic/files/") if local:
filewrite.write(ficnostring + ".pdf\">PDF</a></li>\n") filewrite.write("href=\"/home/mdd/Documents/drive/proj/fic-archive/build/files/")
# write epub link if there is one else:
if fileread.epub: filewrite.write("href=\"/fic/files/")
filewrite.write("<li class=\"prazelink\"><a ") filewrite.write(ficnostring + ".html\">HTML</a></li>\n")
if fileread.locked: # write pdf link if there is one
filewrite.write("class=\"locked\" href=\"") if fileread.pdf:
if local: filewrite.write("<li class=\"prazelink\"><a ")
filewrite.write("/home/mdd/Documents/drive/proj/fic-archive/build/secret/") if fileread.locked:
filewrite.write("class=\"locked\" href=\"")
if local:
filewrite.write("/home/mdd/Documents/drive/proj/fic-archive/build/secret/")
else:
filewrite.write("/fic/secret/")
else: else:
filewrite.write("/fic/secret/") if local:
else: filewrite.write("href=\"/home/mdd/Documents/drive/proj/fic-archive/build/files/")
if local: else:
filewrite.write("href=\"/home/mdd/Documents/drive/proj/fic-archive/build/files/") filewrite.write("href=\"/fic/files/")
filewrite.write(ficnostring + ".pdf\">PDF</a></li>\n")
# write epub link if there is one
if fileread.epub:
filewrite.write("<li class=\"prazelink\"><a ")
if fileread.locked:
filewrite.write("class=\"locked\" href=\"")
if local:
filewrite.write("/home/mdd/Documents/drive/proj/fic-archive/build/secret/")
else:
filewrite.write("/fic/secret/")
else: else:
filewrite.write("href=\"/fic/files/") if local:
filewrite.write(ficnostring + ".epub\">EPUB</a></li>\n") filewrite.write("href=\"/home/mdd/Documents/drive/proj/fic-archive/build/files/")
# write ao3 link if there is one else:
if fileread.ao3slug: filewrite.write("href=\"/fic/files/")
filewrite.write("<li class=\"ao3link\"><a ") filewrite.write(ficnostring + ".epub\">EPUB</a></li>\n")
if fileread.locked: # write ao3 link if there is one
filewrite.write("class=\"locked\" ") try:
filewrite.write("href=\"https://archiveofourown.org/works/" + str(fileread.ao3slug) + "\">AO3</a></li>\n") if fileread.ao3slug:
# determine if comments page filewrite.write("<li class=\"ao3link\"><a ")
if any(item in fffandoms for item in fileread.fandom): if fileread.locked:
filewrite.write("<li class=\"prazelink\"><a href=\"") filewrite.write("class=\"locked\" ")
if local: filewrite.write("href=\"https://archiveofourown.org/works/" + str(fileread.ao3slug) + "\">AO3</a></li>\n")
filewrite.write("/home/mdd/Documents/drive/proj/fic-archive/build/comments/" + ficnostring + "/index.html") except:
else: pass
filewrite.write("/fic/comments/" + ficnostring) # determine if comments page
filewrite.write("\">comments</a></li>\n") if any(item in fffandoms for item in fileread.fandom):
else:
timeelapsed = datetime.datetime.now() - (fileread.datewords[-1])["date"]
if timeelapsed.days < 730:
filewrite.write("<li class=\"prazelink\"><a href=\"") filewrite.write("<li class=\"prazelink\"><a href=\"")
if local: if local:
filewrite.write("/home/mdd/Documents/drive/proj/fic-archive/build/comments/" + ficnostring + "/index.html") filewrite.write("/home/mdd/Documents/drive/proj/fic-archive/build/comments/" + ficnostring + "/index.html")
@ -413,15 +415,35 @@ def ficgen(ficno,unique=False,output="output.html",local=False):
filewrite.write("/fic/comments/" + ficnostring) filewrite.write("/fic/comments/" + ficnostring)
filewrite.write("\">comments</a></li>\n") filewrite.write("\">comments</a></li>\n")
else: else:
try: timeelapsed = datetime.datetime.now() - (fileread.datewords[-1])["date"]
if fileread.event == "ao3exchange" and (fileread.datewords[0])["date"].year > 2019: if timeelapsed.days < 730:
filewrite.write("<li class=\"prazelink\"><a href=\"") filewrite.write("<li class=\"prazelink\"><a href=\"")
if local: if local:
filewrite.write("/home/mdd/Documents/drive/proj/fic-archive/build/comments/" + ficnostring + "/index.html") filewrite.write("/home/mdd/Documents/drive/proj/fic-archive/build/comments/" + ficnostring + "/index.html")
else:
filewrite.write("/fic/comments/" + ficnostring)
filewrite.write("\">comments</a></li>\n")
else: else:
filewrite.write("/fic/comments/" + ficnostring)
filewrite.write("\">comments</a></li>\n")
else:
try:
if fileread.event == "ao3exchange" and (fileread.datewords[0])["date"].year > 2019:
filewrite.write("<li class=\"prazelink\"><a href=\"")
if local:
filewrite.write("/home/mdd/Documents/drive/proj/fic-archive/build/comments/" + ficnostring + "/index.html")
else:
filewrite.write("/fic/comments/" + ficnostring)
filewrite.write("\">comments</a></li>\n")
else:
try:
if fileread.comments:
filewrite.write("<li class=\"prazelink\"><a href=\"")
if local:
filewrite.write("/home/mdd/Documents/drive/proj/fic-archive/build/comments/" + ficnostring + "/index.html")
else:
filewrite.write("/fic/comments/" + ficnostring)
filewrite.write("\">comments</a></li>\n")
except:
pass
except:
try: try:
if fileread.comments: if fileread.comments:
filewrite.write("<li class=\"prazelink\"><a href=\"") filewrite.write("<li class=\"prazelink\"><a href=\"")
@ -432,88 +454,71 @@ def ficgen(ficno,unique=False,output="output.html",local=False):
filewrite.write("\">comments</a></li>\n") filewrite.write("\">comments</a></li>\n")
except: except:
pass pass
except: filewrite.write("</ul>\n")
try: # write links for translation if required
if fileread.comments: try:
filewrite.write("<li class=\"prazelink\"><a href=\"") if fileread.translation:
if transread.language == "en":
filewrite.write("<ul class=\"ficlinks english")
elif transread.language == "fr":
filewrite.write("<ul class=\"ficlinks french")
filewrite.write("\">\n")
# write html link if there is one
if fileread.html:
filewrite.write("<li class=\"prazelink\"><a ")
if fileread.locked:
filewrite.write("class=\"locked\" href=\"")
if local: if local:
filewrite.write("/home/mdd/Documents/drive/proj/fic-archive/build/comments/" + ficnostring + "/index.html") filewrite.write("/home/mdd/Documents/drive/proj/fic-archive/build/secret/")
else: else:
filewrite.write("/fic/comments/" + ficnostring) filewrite.write("/fic/secret/")
filewrite.write("\">comments</a></li>\n")
except:
pass
filewrite.write("</ul>\n")
# write links for translation if required
try:
if fileread.translation:
if transread.language == "en":
filewrite.write("<ul class=\"ficlinks english")
elif transread.language == "fr":
filewrite.write("<ul class=\"ficlinks french")
filewrite.write("\">\n")
# write html link if there is one
if fileread.html:
filewrite.write("<li class=\"prazelink\"><a ")
if fileread.locked:
filewrite.write("class=\"locked\" href=\"")
if local:
filewrite.write("/home/mdd/Documents/drive/proj/fic-archive/build/secret/")
else: else:
filewrite.write("/fic/secret/") if local:
else: filewrite.write("href=\"/home/mdd/Documents/drive/proj/fic-archive/build/files/")
if local: else:
filewrite.write("href=\"/home/mdd/Documents/drive/proj/fic-archive/build/files/") filewrite.write("href=\"/fic/files/")
else: filewrite.write(translationstring + ".html\">HTML</a></li>\n")
filewrite.write("href=\"/fic/files/") # write pdf link if there is one
filewrite.write(translationstring + ".html\">HTML</a></li>\n") if fileread.pdf:
# write pdf link if there is one filewrite.write("<li class=\"prazelink\"><a ")
if fileread.pdf: if fileread.locked:
filewrite.write("<li class=\"prazelink\"><a ") filewrite.write("class=\"locked\" href=\"")
if fileread.locked: if local:
filewrite.write("class=\"locked\" href=\"") filewrite.write("/home/mdd/Documents/drive/proj/fic-archive/build/secret/")
if local: else:
filewrite.write("/home/mdd/Documents/drive/proj/fic-archive/build/secret/") filewrite.write("/fic/secret/")
else:
filewrite.write("/fic/secret/")
else:
if local:
filewrite.write("href=\"/home/mdd/Documents/drive/proj/fic-archive/build/files/")
else:
filewrite.write("href=\"/fic/files/")
filewrite.write(translationstring + ".pdf\">PDF</a></li>\n")
# write epub link if there is one
if fileread.epub:
filewrite.write("<li class=\"prazelink\"><a ")
if fileread.locked:
filewrite.write("class=\"locked\" href=\"")
if local:
filewrite.write("/home/mdd/Documents/drive/proj/fic-archive/build/secret/")
else: else:
filewrite.write("/fic/secret/") if local:
else: filewrite.write("href=\"/home/mdd/Documents/drive/proj/fic-archive/build/files/")
if local: else:
filewrite.write("href=\"/home/mdd/Documents/drive/proj/fic-archive/build/files/") filewrite.write("href=\"/fic/files/")
filewrite.write(translationstring + ".pdf\">PDF</a></li>\n")
# write epub link if there is one
if fileread.epub:
filewrite.write("<li class=\"prazelink\"><a ")
if fileread.locked:
filewrite.write("class=\"locked\" href=\"")
if local:
filewrite.write("/home/mdd/Documents/drive/proj/fic-archive/build/secret/")
else:
filewrite.write("/fic/secret/")
else: else:
filewrite.write("href=\"/fic/files/") if local:
filewrite.write(translationstring + ".epub\">EPUB</a></li>\n") filewrite.write("href=\"/home/mdd/Documents/drive/proj/fic-archive/build/files/")
# write ao3 link if there is one else:
if fileread.ao3slug: filewrite.write("href=\"/fic/files/")
filewrite.write("<li class=\"ao3link\"><a ") filewrite.write(translationstring + ".epub\">EPUB</a></li>\n")
if fileread.locked: # write ao3 link if there is one
filewrite.write("class=\"locked\" ") try:
filewrite.write("href=\"https://archiveofourown.org/works/" + str(transread.ao3slug) + "\">AO3</a></li>\n") if fileread.ao3slug:
# determine if comments page required filewrite.write("<li class=\"ao3link\"><a ")
if any(item in fffandoms for item in fileread.fandom): if fileread.locked:
filewrite.write("<li class=\"prazelink\"><a href=\"") filewrite.write("class=\"locked\" ")
if local: filewrite.write("href=\"https://archiveofourown.org/works/" + str(transread.ao3slug) + "\">AO3</a></li>\n")
filewrite.write("/home/mdd/Documents/drive/proj/fic-archive/build/comments/" + translationstring + "/index.html") except:
else: pass
filewrite.write("/fic/comments/" + translationstring) # determine if comments page required
filewrite.write("\">comments</a></li>\n") if any(item in fffandoms for item in fileread.fandom):
else:
timeelapsed = datetime.datetime.now() - (transread.datewords[-1])["date"]
if timeelapsed.days < 730:
filewrite.write("<li class=\"prazelink\"><a href=\"") filewrite.write("<li class=\"prazelink\"><a href=\"")
if local: if local:
filewrite.write("/home/mdd/Documents/drive/proj/fic-archive/build/comments/" + translationstring + "/index.html") filewrite.write("/home/mdd/Documents/drive/proj/fic-archive/build/comments/" + translationstring + "/index.html")
@ -521,18 +526,27 @@ def ficgen(ficno,unique=False,output="output.html",local=False):
filewrite.write("/fic/comments/" + translationstring) filewrite.write("/fic/comments/" + translationstring)
filewrite.write("\">comments</a></li>\n") filewrite.write("\">comments</a></li>\n")
else: else:
try: timeelapsed = datetime.datetime.now() - (transread.datewords[-1])["date"]
if transread.comments: if timeelapsed.days < 730:
filewrite.write("<li class=\"prazelink\"><a href=\"") filewrite.write("<li class=\"prazelink\"><a href=\"")
if local: if local:
filewrite.write("/home/mdd/Documents/drive/proj/fic-archive/build/comments/" + translationstring + "/index.html") filewrite.write("/home/mdd/Documents/drive/proj/fic-archive/build/comments/" + translationstring + "/index.html")
else: else:
filewrite.write("/fic/comments/" + translationstring) filewrite.write("/fic/comments/" + translationstring)
filewrite.write("\">comments</a></li>\n") filewrite.write("\">comments</a></li>\n")
except: else:
pass try:
filewrite.write("</ul>\n") if transread.comments:
except: filewrite.write("<li class=\"prazelink\"><a href=\"")
pass if local:
filewrite.write("</div>\n") filewrite.write("/home/mdd/Documents/drive/proj/fic-archive/build/comments/" + translationstring + "/index.html")
filewrite.close() else:
filewrite.write("/fic/comments/" + translationstring)
filewrite.write("\">comments</a></li>\n")
except:
pass
filewrite.write("</ul>\n")
except:
pass
filewrite.write("</div>\n")
filewrite.close()

@ -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; on AO3, theyre available behind the login wall.</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. RPF and things I wrote before 2020 require a username and password to access; if theyre on AO3, theyre available behind the login wall.</p>",False,local)
# write fic divs # write fic divs
ficcount = 500 ficcount = 500
while ficcount > 0: while ficcount > 0:

@ -5,6 +5,7 @@ showtitle = False
language = "en" language = "en"
# translation = # translation =
datewords = [{"date":datetime.datetime(YYYY,M,D),"words":}] datewords = [{"date":datetime.datetime(YYYY,M,D),"words":}]
# revealdate = datetime.datetime(YYYY,M,D)
# approxdate = "" # approxdate = ""
status = "complete" # incomplete, abandoned status = "complete" # incomplete, abandoned
rating = "" # g, t, m, e rating = "" # g, t, m, e

@ -1,4 +1,4 @@
import os import datetime, os
from importlib import import_module from importlib import import_module
fffandoms = ["FF1","FF2","FF3","FF4","FF5","FF6","FF7","FF8","FF9","FFX","FF11","FF12","FF13","FF14","FF15"] fffandoms = ["FF1","FF2","FF3","FF4","FF5","FF6","FF7","FF8","FF9","FFX","FF11","FF12","FF13","FF14","FF15"]
@ -29,12 +29,20 @@ def shiplist(local=False):
if os.path.exists("originalsmeta/" + ficcountstring + ".py"): if os.path.exists("originalsmeta/" + ficcountstring + ".py"):
ficfile = "originalsmeta." + ficcountstring ficfile = "originalsmeta." + ficcountstring
fileread = import_module(ficfile) fileread = import_module(ficfile)
if len(fileread.fandom) == 1: try:
if fandom in fileread.fandom: if fileread.revealdate > datetime.datetime.now():
try: revealed = False
theships.extend(fileread.ship) else:
except: revealed = True
pass except:
revealed = True
if revealed == True:
if len(fileread.fandom) == 1:
if fandom in fileread.fandom:
try:
theships.extend(fileread.ship)
except:
pass
for ship in theships: for ship in theships:
if ship == None: if ship == None:
theships.remove(ship) theships.remove(ship)
@ -62,15 +70,23 @@ def shiplist(local=False):
if os.path.exists("originalsmeta/" + ficcountstring + ".py"): if os.path.exists("originalsmeta/" + ficcountstring + ".py"):
countfile = "originalsmeta." + ficcountstring countfile = "originalsmeta." + ficcountstring
fileread = import_module(countfile) fileread = import_module(countfile)
if searchfandom in fileread.fandom: try:
# append to lists if fileread.revealdate > datetime.datetime.now():
try: revealed = False
if fileread.ship[0] == ship: else:
maincount.append(ficcount) revealed = True
elif ship in fileread.ship: except:
secondarycount.append(ficcount) revealed = True
except: if revealed == True:
pass if searchfandom in fileread.fandom:
# append to lists
try:
if fileread.ship[0] == ship:
maincount.append(ficcount)
elif ship in fileread.ship:
secondarycount.append(ficcount)
except:
pass
# write details element # write details element
output = "build/ff/ships/index.html" output = "build/ff/ships/index.html"
filewrite = open(output, "a") filewrite = open(output, "a")

@ -230,9 +230,17 @@ def yeargen(local=False):
else: else:
fileread = False fileread = False
if fileread: if fileread:
for date in fileread.datewords: try:
yearlist.append(date["date"].year) if fileread.revealdate > datetime.datetime.now():
yearlist = sorted(list(dict.fromkeys(yearlist))) revealed = False
else:
revealed = True
except:
revealed = True
if revealed == True:
for date in fileread.datewords:
yearlist.append(date["date"].year)
yearlist = sorted(list(dict.fromkeys(yearlist)))
for year in yearlist: for year in yearlist:
yearpath = "build/stats/" + str(year) yearpath = "build/stats/" + str(year)
if not os.path.isdir(yearpath): if not os.path.isdir(yearpath):
@ -267,9 +275,17 @@ def yeargen(local=False):
else: else:
fileread = False fileread = False
if fileread: if fileread:
for date in fileread.datewords: try:
if (date["date"]).year == year: if fileread.revealdate > datetime.datetime.now():
allfics.append(ficcountstring) revealed = False
else:
revealed = True
except:
revealed = True
if revealed == True:
for date in fileread.datewords:
if (date["date"]).year == year:
allfics.append(ficcountstring)
allfics = sorted(list(dict.fromkeys(allfics))) allfics = sorted(list(dict.fromkeys(allfics)))
for fic in allfics: for fic in allfics:
if os.path.exists("originalsmeta/" + fic + ".py"): if os.path.exists("originalsmeta/" + fic + ".py"):
@ -282,41 +298,49 @@ def yeargen(local=False):
fileread = False fileread = False
if fileread: if fileread:
try: try:
fandom = fileread.fandom if fileread.revealdate > datetime.datetime.now():
event = fileread.event revealed = False
eventname = fileread.eventname else:
try: revealed = True
eventlocation = fileread.eventlocation
except:
eventlocation = False
except: except:
revealed = True
if revealed == True:
try: try:
if fileread.original: fandom = fileread.fandom
theorig = "originalsmeta." + str(fileread.original) event = fileread.event
origfile = import_module(theorig) eventname = fileread.eventname
try: try:
fandom = origfile.fandom eventlocation = fileread.eventlocation
event = origfile.event except:
eventname = origfile.eventname eventlocation = False
except:
try:
if fileread.original:
theorig = "originalsmeta." + str(fileread.original)
origfile = import_module(theorig)
try: try:
eventlocation = fileread.eventlocation fandom = origfile.fandom
event = origfile.event
eventname = origfile.eventname
try:
eventlocation = fileread.eventlocation
except:
eventlocation = False
except: except:
event = False
eventname = False
eventlocation = False eventlocation = False
except: except:
event = False event = False
eventname = False eventname = False
eventlocation = False eventlocation = False
except: ficwords = 0
event = False for dateword in fileread.datewords:
eventname = False if (dateword["date"]).year == year:
eventlocation = False ficwords = (dateword["words"])
ficwords = 0 ficdict = {"number":fic,"words":ficwords,"fandom":fandom,"event":event,"eventname":eventname,"eventlocation":eventlocation,"date":dateword["date"]}
for dateword in fileread.datewords: ficdeets.append(ficdict)
if (dateword["date"]).year == year: datesplit.append(ficdict)
ficwords = (dateword["words"])
ficdict = {"number":fic,"words":ficwords,"fandom":fandom,"event":event,"eventname":eventname,"eventlocation":eventlocation,"date":dateword["date"]}
ficdeets.append(ficdict)
datesplit.append(ficdict)
combinedeets = [] combinedeets = []
for fic in ficdeets: for fic in ficdeets:
if combinedeets == []: if combinedeets == []:
@ -514,25 +538,33 @@ def yeargen(local=False):
else: else:
fileread = False fileread = False
if fileread: if fileread:
for datewords in fileread.datewords: try:
if datewords["date"] == thedate: if fileread.revealdate > datetime.datetime.now():
thewords = datewords["words"] revealed = False
fic["words"] = thewords else:
ficlogged = False revealed = True
if monthcombine == []: except:
if ficlogged == False: revealed = True
ficlogged = True if revealed == True:
monthcombine.append(fic) for datewords in fileread.datewords:
else: if datewords["date"] == thedate:
thewords = datewords["words"]
fic["words"] = thewords
ficlogged = False ficlogged = False
for newfic in monthcombine: if monthcombine == []:
if ficlogged == False: if ficlogged == False:
if fic["number"] == newfic["number"]: ficlogged = True
if (fic["date"]).month == (newfic["date"]).month: monthcombine.append(fic)
ficlogged = True else:
newfic["words"] += fic["words"] ficlogged = False
if ficlogged == False: for newfic in monthcombine:
monthcombine.append(fic) if ficlogged == False:
if fic["number"] == newfic["number"]:
if (fic["date"]).month == (newfic["date"]).month:
ficlogged = True
newfic["words"] += fic["words"]
if ficlogged == False:
monthcombine.append(fic)
jan = {"fics":[],"words":0} jan = {"fics":[],"words":0}
feb = {"fics":[],"words":0} feb = {"fics":[],"words":0}
mar = {"fics":[],"words":0} mar = {"fics":[],"words":0}

Loading…
Cancel
Save