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,6 +29,14 @@ 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)
try:
if fileread.revealdate > datetime.datetime.now():
revealed = False
else:
revealed = True
except:
revealed = True
if revealed == True:
if len(fileread.fandom) == 1: if len(fileread.fandom) == 1:
if fandom in fileread.fandom: if fandom in fileread.fandom:
try: try:
@ -74,6 +82,14 @@ 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)
try:
if fileread.revealdate > datetime.datetime.now():
revealed = False
else:
revealed = True
except:
revealed = True
if revealed == True:
if searchfandom in fileread.fandom: if searchfandom in fileread.fandom:
# append to lists # append to lists
try: try:

@ -24,6 +24,14 @@ def eventlist(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)
try:
if fileread.revealdate > datetime.datetime.now():
revealed = False
else:
revealed = True
except:
revealed = True
if revealed == True:
try: try:
events.append({"name":fileread.eventname,"location":fileread.eventlocation,"sortname":fileread.eventname.lower()}) events.append({"name":fileread.eventname,"location":fileread.eventlocation,"sortname":fileread.eventname.lower()})
except: except:
@ -52,6 +60,14 @@ def eventlist(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)
try:
if fileread.revealdate > datetime.datetime.now():
revealed = False
else:
revealed = True
except:
revealed = True
if revealed == True:
try: try:
if fileread.eventname == theevent: if fileread.eventname == theevent:
evententries.append({"ficno":ficcount,"year":(fileread.datewords[0])["date"].year,"fandom":fileread.fandom}) evententries.append({"ficno":ficcount,"year":(fileread.datewords[0])["date"].year,"fandom":fileread.fandom})

@ -26,6 +26,10 @@ 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)
try:
if fileread.revealdate <= datetime.datetime.now():
datelist.append(fileread.revealdate)
except:
for instalment in fileread.datewords: for instalment in fileread.datewords:
datelist.append(instalment["date"]) datelist.append(instalment["date"])
elif os.path.exists("translationsmeta/" + ficcountstring + ".py"): elif os.path.exists("translationsmeta/" + ficcountstring + ".py"):
@ -52,6 +56,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)
try:
if fileread.revealdate <= datetime.datetime.now():
if fileread.revealdate == date:
if targetfile == 0:
targetfile = ficfile
except:
for instalment in fileread.datewords: for instalment in fileread.datewords:
if instalment["date"] == date: if instalment["date"] == date:
if targetfile == 0: if targetfile == 0:
@ -69,6 +79,10 @@ 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>")
try:
if thefile.revealdate == True:
pass
except:
if (thefile.datewords[0])["date"] != date: if (thefile.datewords[0])["date"] != date:
filewrite.write("Updated: ") filewrite.write("Updated: ")
filewrite.write("Fic " + ficcountstring) filewrite.write("Fic " + ficcountstring)
@ -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:

@ -36,6 +36,14 @@ def ficgen(ficno,unique=False,output="output.html",local=False):
transread = import_module(translationfile) transread = import_module(translationfile)
except: except:
pass pass
try:
if fileread.revealdate > datetime.datetime.now():
revealed = False
else:
revealed = True
except:
revealed = True
if revealed == True:
# write to output file # write to output file
filewrite = open(output, "a") filewrite = open(output, "a")
filewrite.write("<div class=\"fic\"") filewrite.write("<div class=\"fic\"")
@ -390,11 +398,14 @@ def ficgen(ficno,unique=False,output="output.html",local=False):
filewrite.write("href=\"/fic/files/") filewrite.write("href=\"/fic/files/")
filewrite.write(ficnostring + ".epub\">EPUB</a></li>\n") filewrite.write(ficnostring + ".epub\">EPUB</a></li>\n")
# write ao3 link if there is one # write ao3 link if there is one
try:
if fileread.ao3slug: if fileread.ao3slug:
filewrite.write("<li class=\"ao3link\"><a ") filewrite.write("<li class=\"ao3link\"><a ")
if fileread.locked: if fileread.locked:
filewrite.write("class=\"locked\" ") filewrite.write("class=\"locked\" ")
filewrite.write("href=\"https://archiveofourown.org/works/" + str(fileread.ao3slug) + "\">AO3</a></li>\n") filewrite.write("href=\"https://archiveofourown.org/works/" + str(fileread.ao3slug) + "\">AO3</a></li>\n")
except:
pass
# determine if comments page # determine if comments page
if any(item in fffandoms for item in fileread.fandom): if any(item in fffandoms for item in fileread.fandom):
filewrite.write("<li class=\"prazelink\"><a href=\"") filewrite.write("<li class=\"prazelink\"><a href=\"")
@ -498,11 +509,14 @@ def ficgen(ficno,unique=False,output="output.html",local=False):
filewrite.write("href=\"/fic/files/") filewrite.write("href=\"/fic/files/")
filewrite.write(translationstring + ".epub\">EPUB</a></li>\n") filewrite.write(translationstring + ".epub\">EPUB</a></li>\n")
# write ao3 link if there is one # write ao3 link if there is one
try:
if fileread.ao3slug: if fileread.ao3slug:
filewrite.write("<li class=\"ao3link\"><a ") filewrite.write("<li class=\"ao3link\"><a ")
if fileread.locked: if fileread.locked:
filewrite.write("class=\"locked\" ") filewrite.write("class=\"locked\" ")
filewrite.write("href=\"https://archiveofourown.org/works/" + str(transread.ao3slug) + "\">AO3</a></li>\n") filewrite.write("href=\"https://archiveofourown.org/works/" + str(transread.ao3slug) + "\">AO3</a></li>\n")
except:
pass
# determine if comments page required # determine if comments page required
if any(item in fffandoms for item in fileread.fandom): if any(item in fffandoms for item in fileread.fandom):
filewrite.write("<li class=\"prazelink\"><a href=\"") filewrite.write("<li class=\"prazelink\"><a href=\"")

@ -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,6 +29,14 @@ 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)
try:
if fileread.revealdate > datetime.datetime.now():
revealed = False
else:
revealed = True
except:
revealed = True
if revealed == True:
if len(fileread.fandom) == 1: if len(fileread.fandom) == 1:
if fandom in fileread.fandom: if fandom in fileread.fandom:
try: try:
@ -62,6 +70,14 @@ 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)
try:
if fileread.revealdate > datetime.datetime.now():
revealed = False
else:
revealed = True
except:
revealed = True
if revealed == True:
if searchfandom in fileread.fandom: if searchfandom in fileread.fandom:
# append to lists # append to lists
try: try:

@ -230,6 +230,14 @@ def yeargen(local=False):
else: else:
fileread = False fileread = False
if fileread: if fileread:
try:
if fileread.revealdate > datetime.datetime.now():
revealed = False
else:
revealed = True
except:
revealed = True
if revealed == True:
for date in fileread.datewords: for date in fileread.datewords:
yearlist.append(date["date"].year) yearlist.append(date["date"].year)
yearlist = sorted(list(dict.fromkeys(yearlist))) yearlist = sorted(list(dict.fromkeys(yearlist)))
@ -267,6 +275,14 @@ def yeargen(local=False):
else: else:
fileread = False fileread = False
if fileread: if fileread:
try:
if fileread.revealdate > datetime.datetime.now():
revealed = False
else:
revealed = True
except:
revealed = True
if revealed == True:
for date in fileread.datewords: for date in fileread.datewords:
if (date["date"]).year == year: if (date["date"]).year == year:
allfics.append(ficcountstring) allfics.append(ficcountstring)
@ -281,6 +297,14 @@ def yeargen(local=False):
else: else:
fileread = False fileread = False
if fileread: if fileread:
try:
if fileread.revealdate > datetime.datetime.now():
revealed = False
else:
revealed = True
except:
revealed = True
if revealed == True:
try: try:
fandom = fileread.fandom fandom = fileread.fandom
event = fileread.event event = fileread.event
@ -514,6 +538,14 @@ def yeargen(local=False):
else: else:
fileread = False fileread = False
if fileread: if fileread:
try:
if fileread.revealdate > datetime.datetime.now():
revealed = False
else:
revealed = True
except:
revealed = True
if revealed == True:
for datewords in fileread.datewords: for datewords in fileread.datewords:
if datewords["date"] == thedate: if datewords["date"] == thedate:
thewords = datewords["words"] thewords = datewords["words"]

Loading…
Cancel
Save