Sort fics properly
This commit is contained in:
parent
d1003797f2
commit
663cac35b9
5 changed files with 59 additions and 12 deletions
|
@ -16,6 +16,7 @@ def listgen(local=False):
|
|||
headerfooter.headerwrite("build/masterlist/index.html","Masterlist","Fic masterlist","<p>On this page, from newest to oldest, you’ll find basically everything I’ve ever written that is a. fanfiction and b. extant; quality may vary. Some fics, such as things I wrote before 2020, require a username and password to access.</p>",False,local)
|
||||
# write fic divs
|
||||
ficcount = 500
|
||||
sortfics = []
|
||||
while ficcount > 0:
|
||||
ficcount -= 1
|
||||
if ficcount < 10:
|
||||
|
@ -25,7 +26,18 @@ def listgen(local=False):
|
|||
else:
|
||||
ficcountstring = str(ficcount)
|
||||
if os.path.exists("originalsmeta/" + ficcountstring + ".py"):
|
||||
makeheader.ficgen(ficcount,True,"build/masterlist/index.html",local)
|
||||
ficfile = "originalsmeta." + ficcountstring
|
||||
fileread = import_module(ficfile)
|
||||
try:
|
||||
if fileread.revealdate <= datetime.datetime.now():
|
||||
ficdict = {"thefic":ficcount,"thedate":(fileread.datewords[-1])["date"]}
|
||||
sortfics.append(ficdict)
|
||||
except:
|
||||
ficdict = {"thefic":ficcount,"thedate":(fileread.datewords[-1])["date"]}
|
||||
sortfics.append(ficdict)
|
||||
thefics = sorted(sortfics, key=lambda d: d["thedate"],reverse=True)
|
||||
for fic in thefics:
|
||||
makeheader.ficgen(fic["thefic"],True,"build/masterlist/index.html",local)
|
||||
# write footer
|
||||
headerfooter.footerwrite("build/masterlist/index.html",False,local)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue