Sort fics properly
This commit is contained in:
parent
d1003797f2
commit
663cac35b9
5 changed files with 59 additions and 12 deletions
|
@ -90,26 +90,27 @@ def charlist(local=False):
|
|||
except:
|
||||
revealed = True
|
||||
if revealed == True:
|
||||
ficdict = {"thefic":ficcount,"thedate":(fileread.datewords[-1])["date"]}
|
||||
if searchfandom in fileread.fandom:
|
||||
# append to lists
|
||||
try:
|
||||
if character in fileread.charpov:
|
||||
povcount.append(ficcount)
|
||||
povcount.append(ficdict)
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
if character in fileread.charmain:
|
||||
maincount.append(ficcount)
|
||||
maincount.append(ficdict)
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
if character in fileread.charsecondary:
|
||||
secondarycount.append(ficcount)
|
||||
secondarycount.append(ficdict)
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
if character in fileread.charmention:
|
||||
mentioncount.append(ficcount)
|
||||
mentioncount.append(ficdict)
|
||||
except:
|
||||
pass
|
||||
# write details element
|
||||
|
@ -132,25 +133,41 @@ def charlist(local=False):
|
|||
filewrite = open(output, "a")
|
||||
filewrite.write("<h1>POV character</h1>\n")
|
||||
filewrite.close()
|
||||
povcount = sorted(povcount,key=lambda d: d["thedate"],reverse=True)
|
||||
newpov = []
|
||||
for fic in povcount:
|
||||
newpov.append(fic["thefic"])
|
||||
for fic in newpov:
|
||||
makeheader.ficgen(fic,False,output,local)
|
||||
if len(maincount) > 0:
|
||||
filewrite = open(output, "a")
|
||||
filewrite.write("<h1>Main character</h1>\n")
|
||||
filewrite.close()
|
||||
maincount = sorted(maincount,key=lambda d: d["thedate"],reverse=True)
|
||||
newmain = []
|
||||
for fic in maincount:
|
||||
newmain.append(fic["thefic"])
|
||||
for fic in newmain:
|
||||
makeheader.ficgen(fic,False,output,local)
|
||||
if len(secondarycount) > 0:
|
||||
filewrite = open(output, "a")
|
||||
filewrite.write("<h1>Secondary character</h1>\n")
|
||||
filewrite.close()
|
||||
secondarycount = sorted(secondarycount,key=lambda d: d["thedate"],reverse=True)
|
||||
newsecondary = []
|
||||
for fic in secondarycount:
|
||||
newsecondary.append(fic["thefic"])
|
||||
for fic in newsecondary:
|
||||
makeheader.ficgen(fic,False,output,local)
|
||||
if len(mentioncount) > 0:
|
||||
filewrite = open(output, "a")
|
||||
filewrite.write("<h1>Mentioned</h1>\n")
|
||||
filewrite.close()
|
||||
mentioncount = sorted(mentioncount,key=lambda d: d["thedate"],reverse=True)
|
||||
newmention = []
|
||||
for fic in mentioncount:
|
||||
newmention.append(fic["thefic"])
|
||||
for fic in newmention:
|
||||
makeheader.ficgen(fic,False,output,local)
|
||||
filewrite = open(output, "a")
|
||||
filewrite.write("</details>\n")
|
||||
|
|
12
events.py
12
events.py
|
@ -70,7 +70,7 @@ def eventlist(local=False):
|
|||
if revealed == True:
|
||||
try:
|
||||
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,"update":(fileread.datewords[-1])["date"]})
|
||||
except:
|
||||
pass
|
||||
eventfandoms = []
|
||||
|
@ -102,13 +102,17 @@ def eventlist(local=False):
|
|||
yearlist = []
|
||||
for entry in evententries:
|
||||
if int(entry["year"]) == startyear:
|
||||
yearlist.append(entry["ficno"])
|
||||
ficdict = {"thefic":entry["ficno"],"thedate":entry["update"]}
|
||||
yearlist.append(ficdict)
|
||||
if len(yearlist) > 0:
|
||||
yearlist = sorted(yearlist)
|
||||
yearlist = sorted(yearlist,key=lambda d: d["thedate"])
|
||||
newyear = []
|
||||
for fic in yearlist:
|
||||
newyear.append(fic["thefic"])
|
||||
filewrite = open(output, "a")
|
||||
filewrite.write("<h1>" + str(startyear) + "</h1>\n")
|
||||
filewrite.close()
|
||||
for fic in yearlist:
|
||||
for fic in newyear:
|
||||
makeheader.ficgen(fic,False,output,local)
|
||||
filewrite = open(output, "a")
|
||||
filewrite.write("</details>\n")
|
||||
|
|
|
@ -53,6 +53,7 @@ def fandomlist(local=False):
|
|||
fandomlist = sorted(fandomlist, key=lambda d: d["sortname"])
|
||||
for fandom in fandomlist:
|
||||
fandomfics = []
|
||||
sortfics = []
|
||||
# check which fics are in the fandom
|
||||
ficcount = 500
|
||||
while ficcount > 0:
|
||||
|
@ -75,7 +76,11 @@ def fandomlist(local=False):
|
|||
revealed = True
|
||||
if revealed == True:
|
||||
if fandom["searchname"] in fileread.fandom:
|
||||
fandomfics.append(ficcount)
|
||||
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:
|
||||
fandomfics.append(fic["thefic"])
|
||||
firstfic = fandomfics[-1]
|
||||
if firstfic < 10:
|
||||
firstficstring = "00" + str(firstfic)
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
13
ships.py
13
ships.py
|
@ -78,13 +78,14 @@ def shiplist(local=False):
|
|||
except:
|
||||
revealed = True
|
||||
if revealed == True:
|
||||
ficdict = {"thefic":ficcount,"thedate":(fileread.datewords[-1])["date"]}
|
||||
if searchfandom in fileread.fandom:
|
||||
# append to lists
|
||||
try:
|
||||
if fileread.ship[0] == ship:
|
||||
maincount.append(ficcount)
|
||||
maincount.append(ficdict)
|
||||
elif ship in fileread.ship:
|
||||
secondarycount.append(ficcount)
|
||||
secondarycount.append(ficdict)
|
||||
except:
|
||||
pass
|
||||
# write details element
|
||||
|
@ -103,13 +104,21 @@ def shiplist(local=False):
|
|||
filewrite = open(output, "a")
|
||||
filewrite.write("<h1>Main ship</h1>\n")
|
||||
filewrite.close()
|
||||
maincount = sorted(maincount,key=lambda d: d["thedate"],reverse=True)
|
||||
newmain = []
|
||||
for fic in maincount:
|
||||
newmain.append(fic["thefic"])
|
||||
for fic in newmain:
|
||||
makeheader.ficgen(fic,False,output,local)
|
||||
if len(secondarycount) > 0:
|
||||
filewrite = open(output, "a")
|
||||
filewrite.write("<h1>Secondary ship</h1>\n")
|
||||
filewrite.close()
|
||||
secondarycount = sorted(secondarycount,key=lambda d: d["thedate"],reverse=True)
|
||||
newsecondary = []
|
||||
for fic in secondarycount:
|
||||
newsecondary.append(fic["thefic"])
|
||||
for fic in newsecondary:
|
||||
makeheader.ficgen(fic,False,output,local)
|
||||
filewrite = open(output, "a")
|
||||
filewrite.write("</details>\n")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue