|
|
@ -2,16 +2,249 @@ import datetime
|
|
|
|
from importlib import import_module
|
|
|
|
from importlib import import_module
|
|
|
|
from dateutil.relativedelta import relativedelta
|
|
|
|
from dateutil.relativedelta import relativedelta
|
|
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
Remove test file
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fffandoms = ["FF1","FF2","FF3","FF4","FF5","FF6","FF7","FF8","FF9","FFX","FF11","FF12","FF13","FF14","FF15","FF16"]
|
|
|
|
fffandoms = ["FF1","FF2","FF3","FF4","FF5","FF6","FF7","FF8","FF9","FFX","FF11","FF12","FF13","FF14","FF15","FF16"]
|
|
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
Code to generate the fic header div
|
|
|
|
Code to generate the fic header div
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def linkgen(ficno,output="output.html",local=False):
|
|
|
|
|
|
|
|
# convert to three-digit number
|
|
|
|
|
|
|
|
if ficno < 10:
|
|
|
|
|
|
|
|
ficnostring = "00" + str(ficno)
|
|
|
|
|
|
|
|
elif ficno < 100:
|
|
|
|
|
|
|
|
ficnostring = "0" + str(ficno)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
ficnostring = str(ficno)
|
|
|
|
|
|
|
|
# open the file
|
|
|
|
|
|
|
|
ficfile = "originalsmeta." + ficnostring
|
|
|
|
|
|
|
|
fileread = import_module(ficfile)
|
|
|
|
|
|
|
|
# open translation file if there is one
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
if fileread.translation:
|
|
|
|
|
|
|
|
if fileread.translation < 10:
|
|
|
|
|
|
|
|
translationstring = "00" + str(fileread.translation)
|
|
|
|
|
|
|
|
elif fileread.translation < 100:
|
|
|
|
|
|
|
|
translationstring = "0" + str(fileread.translation)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
translationstring = str(fileread.translation)
|
|
|
|
|
|
|
|
translationfile = "translationsmeta." + translationstring
|
|
|
|
|
|
|
|
transread = import_module(translationfile)
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
filewrite = open(output, "a")
|
|
|
|
|
|
|
|
filewrite.write("<ul class=\"ficlinks")
|
|
|
|
|
|
|
|
# specify language if necessary
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
if fileread.translation:
|
|
|
|
|
|
|
|
if fileread.language == "en":
|
|
|
|
|
|
|
|
filewrite.write(" english")
|
|
|
|
|
|
|
|
elif fileread.language == "fr":
|
|
|
|
|
|
|
|
filewrite.write (" french")
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
|
|
|
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(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:
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
|
|
|
if local:
|
|
|
|
|
|
|
|
filewrite.write("href=\"/home/mdd/Documents/drive/proj/fic-archive/build/files/")
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
filewrite.write("href=\"/fic/files/")
|
|
|
|
|
|
|
|
filewrite.write(ficnostring + ".epub\">EPUB</a></li>\n")
|
|
|
|
|
|
|
|
# write ao3 link if there is one
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
if fileread.ao3slug:
|
|
|
|
|
|
|
|
filewrite.write("<li class=\"ao3link\"><a ")
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
if fileread.ao3locked:
|
|
|
|
|
|
|
|
filewrite.write("class=\"locked\" ")
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
if fileread.locked:
|
|
|
|
|
|
|
|
filewrite.write("class=\"locked\" ")
|
|
|
|
|
|
|
|
filewrite.write("href=\"https://archiveofourown.org/works/" + str(fileread.ao3slug) + "\">AO3</a></li>\n")
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
# determine if comments page
|
|
|
|
|
|
|
|
if any(item in fffandoms for item in fileread.fandom):
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
|
|
|
timeelapsed = datetime.datetime.now() - (fileread.datewords[-1])["date"]
|
|
|
|
|
|
|
|
if timeelapsed.days < 730:
|
|
|
|
|
|
|
|
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.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:
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
|
|
|
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 + ".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:
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
|
|
|
if local:
|
|
|
|
|
|
|
|
filewrite.write("href=\"/home/mdd/Documents/drive/proj/fic-archive/build/files/")
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
filewrite.write("href=\"/fic/files/")
|
|
|
|
|
|
|
|
filewrite.write(translationstring + ".epub\">EPUB</a></li>\n")
|
|
|
|
|
|
|
|
# write ao3 link if there is one
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
if fileread.ao3slug:
|
|
|
|
|
|
|
|
filewrite.write("<li class=\"ao3link\"><a ")
|
|
|
|
|
|
|
|
if fileread.locked:
|
|
|
|
|
|
|
|
filewrite.write("class=\"locked\" ")
|
|
|
|
|
|
|
|
filewrite.write("href=\"https://archiveofourown.org/works/" + str(transread.ao3slug) + "\">AO3</a></li>\n")
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
# determine if comments page required
|
|
|
|
|
|
|
|
if any(item in fffandoms for item in fileread.fandom):
|
|
|
|
|
|
|
|
filewrite.write("<li class=\"prazelink\"><a href=\"")
|
|
|
|
|
|
|
|
if local:
|
|
|
|
|
|
|
|
filewrite.write("/home/mdd/Documents/drive/proj/fic-archive/build/comments/" + translationstring + "/index.html")
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
filewrite.write("/fic/comments/" + translationstring)
|
|
|
|
|
|
|
|
filewrite.write("\">comments</a></li>\n")
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
timeelapsed = datetime.datetime.now() - (transread.datewords[-1])["date"]
|
|
|
|
|
|
|
|
if timeelapsed.days < 730:
|
|
|
|
|
|
|
|
filewrite.write("<li class=\"prazelink\"><a href=\"")
|
|
|
|
|
|
|
|
if local:
|
|
|
|
|
|
|
|
filewrite.write("/home/mdd/Documents/drive/proj/fic-archive/build/comments/" + translationstring + "/index.html")
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
filewrite.write("/fic/comments/" + translationstring)
|
|
|
|
|
|
|
|
filewrite.write("\">comments</a></li>\n")
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
if transread.comments:
|
|
|
|
|
|
|
|
filewrite.write("<li class=\"prazelink\"><a href=\"")
|
|
|
|
|
|
|
|
if local:
|
|
|
|
|
|
|
|
filewrite.write("/home/mdd/Documents/drive/proj/fic-archive/build/comments/" + translationstring + "/index.html")
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
filewrite.write("/fic/comments/" + translationstring)
|
|
|
|
|
|
|
|
filewrite.write("\">comments</a></li>\n")
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
filewrite.write("</ul>\n")
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
def ficgen(ficno,unique=False,output="output.html",local=False):
|
|
|
|
def ficgen(ficno,unique=False,output="output.html",local=False):
|
|
|
|
# convert to three-digit number
|
|
|
|
# convert to three-digit number
|
|
|
|
if ficno < 10:
|
|
|
|
if ficno < 10:
|
|
|
@ -350,216 +583,8 @@ def ficgen(ficno,unique=False,output="output.html",local=False):
|
|
|
|
except:
|
|
|
|
except:
|
|
|
|
if juvenilia:
|
|
|
|
if juvenilia:
|
|
|
|
filewrite.write("</p>\n")
|
|
|
|
filewrite.write("</p>\n")
|
|
|
|
filewrite.write("<ul class=\"ficlinks")
|
|
|
|
filewrite.close()
|
|
|
|
# specify language if necessary
|
|
|
|
linkgen(ficno,output,local)
|
|
|
|
try:
|
|
|
|
filewrite = open(output, "a")
|
|
|
|
if fileread.translation:
|
|
|
|
|
|
|
|
if fileread.language == "en":
|
|
|
|
|
|
|
|
filewrite.write(" english")
|
|
|
|
|
|
|
|
elif fileread.language == "fr":
|
|
|
|
|
|
|
|
filewrite.write (" french")
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
|
|
|
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(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:
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
|
|
|
if local:
|
|
|
|
|
|
|
|
filewrite.write("href=\"/home/mdd/Documents/drive/proj/fic-archive/build/files/")
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
filewrite.write("href=\"/fic/files/")
|
|
|
|
|
|
|
|
filewrite.write(ficnostring + ".epub\">EPUB</a></li>\n")
|
|
|
|
|
|
|
|
# write ao3 link if there is one
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
if fileread.ao3slug:
|
|
|
|
|
|
|
|
filewrite.write("<li class=\"ao3link\"><a ")
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
if fileread.ao3locked:
|
|
|
|
|
|
|
|
filewrite.write("class=\"locked\" ")
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
if fileread.locked:
|
|
|
|
|
|
|
|
filewrite.write("class=\"locked\" ")
|
|
|
|
|
|
|
|
filewrite.write("href=\"https://archiveofourown.org/works/" + str(fileread.ao3slug) + "\">AO3</a></li>\n")
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
# determine if comments page
|
|
|
|
|
|
|
|
if any(item in fffandoms for item in fileread.fandom):
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
|
|
|
timeelapsed = datetime.datetime.now() - (fileread.datewords[-1])["date"]
|
|
|
|
|
|
|
|
if timeelapsed.days < 730:
|
|
|
|
|
|
|
|
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.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:
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
|
|
|
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 + ".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:
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
|
|
|
if local:
|
|
|
|
|
|
|
|
filewrite.write("href=\"/home/mdd/Documents/drive/proj/fic-archive/build/files/")
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
filewrite.write("href=\"/fic/files/")
|
|
|
|
|
|
|
|
filewrite.write(translationstring + ".epub\">EPUB</a></li>\n")
|
|
|
|
|
|
|
|
# write ao3 link if there is one
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
if fileread.ao3slug:
|
|
|
|
|
|
|
|
filewrite.write("<li class=\"ao3link\"><a ")
|
|
|
|
|
|
|
|
if fileread.locked:
|
|
|
|
|
|
|
|
filewrite.write("class=\"locked\" ")
|
|
|
|
|
|
|
|
filewrite.write("href=\"https://archiveofourown.org/works/" + str(transread.ao3slug) + "\">AO3</a></li>\n")
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
# determine if comments page required
|
|
|
|
|
|
|
|
if any(item in fffandoms for item in fileread.fandom):
|
|
|
|
|
|
|
|
filewrite.write("<li class=\"prazelink\"><a href=\"")
|
|
|
|
|
|
|
|
if local:
|
|
|
|
|
|
|
|
filewrite.write("/home/mdd/Documents/drive/proj/fic-archive/build/comments/" + translationstring + "/index.html")
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
filewrite.write("/fic/comments/" + translationstring)
|
|
|
|
|
|
|
|
filewrite.write("\">comments</a></li>\n")
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
timeelapsed = datetime.datetime.now() - (transread.datewords[-1])["date"]
|
|
|
|
|
|
|
|
if timeelapsed.days < 730:
|
|
|
|
|
|
|
|
filewrite.write("<li class=\"prazelink\"><a href=\"")
|
|
|
|
|
|
|
|
if local:
|
|
|
|
|
|
|
|
filewrite.write("/home/mdd/Documents/drive/proj/fic-archive/build/comments/" + translationstring + "/index.html")
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
filewrite.write("/fic/comments/" + translationstring)
|
|
|
|
|
|
|
|
filewrite.write("\">comments</a></li>\n")
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
if transread.comments:
|
|
|
|
|
|
|
|
filewrite.write("<li class=\"prazelink\"><a href=\"")
|
|
|
|
|
|
|
|
if local:
|
|
|
|
|
|
|
|
filewrite.write("/home/mdd/Documents/drive/proj/fic-archive/build/comments/" + translationstring + "/index.html")
|
|
|
|
|
|
|
|
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.write("</div>\n")
|
|
|
|
filewrite.close()
|
|
|
|
filewrite.close()
|
|
|
|