diff --git a/feed.py b/feed.py
index 3d92d08..f9309b3 100644
--- a/feed.py
+++ b/feed.py
@@ -5,7 +5,7 @@ from importlib import import_module
Code to generate RSS feed
"""
-def feedgen():
+def feedgen(local=False):
# delete existing file
if os.path.exists("build/feed.xml"):
os.remove("build/feed.xml")
@@ -103,7 +103,14 @@ def feedgen():
therating = "X"
filewrite.write(", rated " + therating)
if len(origread.genre) > 1:
- filewrite.write(", " + origread.genre[1])
+ genred = False
+ for thegenre in origread.genre:
+ if genred == False:
+ if thegenre == "gen" or thegenre == "slash" or thegenre == "pre-slash" or thegenre == "poly slash" or thegenre == "het" or thegenre == "pre-het" or thegenre == "femslash" or thegenre == "poly" or thegenre == "masturbation":
+ pass
+ else:
+ filewrite.write(", " + thegenre)
+ genred = True
except:
try:
filewrite.write(thefile.fandomtext)
@@ -130,11 +137,23 @@ def feedgen():
therating = "X"
filewrite.write(", rated " + therating)
if len(thefile.genre) > 1:
- filewrite.write(", " + thefile.genre[1])
+ genred = False
+ for thegenre in thefile.genre:
+ if genred == False:
+ if thegenre == "gen" or thegenre == "slash" or thegenre == "pre-slash" or thegenre == "poly slash" or thegenre == "het" or thegenre == "pre-het" or thegenre == "femslash" or thegenre == "poly" or thegenre == "masturbation":
+ pass
+ else:
+ filewrite.write(", " + thegenre)
+ genred = True
filewrite.write("\n")
futuredate = date + datetime.timedelta(days=2)
filewrite.write(futuredate.strftime("%a, %-d %b %Y"))
- filewrite.write(" 00:00:00 UT\nhttps://tre.praze.net/fic/masterlist#fic" + ficcountstring + "\npraze-fic-" + ficcountstring)
+ filewrite.write(" 00:00:00 UT\n")
+ if local:
+ filewrite.write("/home/mdd/Documents/drive/proj/fic-archive/build/masterlist")
+ else:
+ filewrite.write("https://tre.praze.net/fic/masterlist")
+ filewrite.write("#fic" + ficcountstring + "\npraze-fic-" + ficcountstring)
datecount = 0
dateindex = 0
for instalment in thefile.datewords:
diff --git a/generate.py b/generate.py
index a13b581..a9b9ac9 100644
--- a/generate.py
+++ b/generate.py
@@ -19,8 +19,8 @@ except:
local = False
if __name__ == "__main__":
- feed.feedgen()
if local == True:
+ feed.feedgen(True)
masterlist.listgen(True)
commentpage.allcomments(True)
commentpage.commentindex(True)
@@ -31,6 +31,7 @@ if __name__ == "__main__":
verifygen.verifygen(True)
statsgen.yeargen(True)
else:
+ feed.feedgen()
masterlist.listgen()
commentpage.allcomments()
commentpage.commentindex()
diff --git a/statsgen.py b/statsgen.py
index 8f57a41..6a50b69 100644
--- a/statsgen.py
+++ b/statsgen.py
@@ -34,11 +34,15 @@ def ficsum(ficcount,year,month=0,showfandom=True,local=False):
fandom = "/".join(origfile.fandom)
except:
fandom = "/".join(fileread.fandom)
+ thechars = ""
try:
if "OW" not in origfile.fandom:
- try:
- thechars = origfile.ship[0]
- except:
+ if "gen" not in origfile.genre:
+ try:
+ thechars = origfile.ship[0]
+ except:
+ pass
+ else:
chars = []
try:
chars.extend(origfile.charpov)
@@ -56,9 +60,12 @@ def ficsum(ficcount,year,month=0,showfandom=True,local=False):
thechars = ""
except:
if "OW" not in fileread.fandom:
- try:
- thechars = fileread.ship[0]
- except:
+ if "gen" not in fileread.genre:
+ try:
+ thechars = fileread.ship[0]
+ except:
+ pass
+ else:
chars = []
try:
chars.extend(fileread.charpov)
@@ -74,6 +81,8 @@ def ficsum(ficcount,year,month=0,showfandom=True,local=False):
thechars = ""
else:
thechars = ""
+ if thechars == "":
+ thechars = "no characters specified"
if fileread.language == "fr":
language = "French"
else:
@@ -82,10 +91,35 @@ def ficsum(ficcount,year,month=0,showfandom=True,local=False):
rating = origfile.rating
except:
rating = fileread.rating
+ genre = []
try:
- genre = origfile.genre[0]
+ for thegenre in origfile.genre:
+ if thegenre == "gen":
+ genre.append(thegenre)
+ elif thegenre == "het" or thegenre == "pre-het":
+ genre.append("het")
+ elif thegenre == "slash" or thegenre == "pre-slash" or thegenre == "poly slash":
+ genre.append("slash")
+ elif thegenre == "femslash":
+ genre.append("femslash")
+ elif thegenre == "poly":
+ genre.append("multi")
+ elif thegenre == "masturbation":
+ genre.append("other")
except:
- genre = fileread.genre[0]
+ for thegenre in fileread.genre:
+ if thegenre == "gen":
+ genre.append(thegenre)
+ elif thegenre == "het" or thegenre == "pre-het":
+ genre.append("het")
+ elif thegenre == "slash" or thegenre == "pre-slash" or thegenre == "poly slash":
+ genre.append("slash")
+ elif thegenre == "femslash":
+ genre.append("femslash")
+ elif thegenre == "poly":
+ genre.append("multi")
+ elif thegenre == "masturbation":
+ genre.append("other")
try:
if origfile.warnings:
warnings = "?!"
@@ -130,16 +164,19 @@ def ficsum(ficcount,year,month=0,showfandom=True,local=False):
ficstring += " M "
elif rating == "e":
ficstring += " E "
- if genre == "gen":
- ficstring += " ☉ "
- elif genre == "slash" or genre == "pre-slash" or genre == "poly slash":
- ficstring += " ♂ "
- elif genre == "het" or genre == "pre-het":
- ficstring += " ⚤ "
- elif genre == "femslash":
- ficstring += " ♀ "
- elif genre == "poly":
- ficstring += " "
+ for thegenre in genre:
+ if thegenre == "gen":
+ ficstring += " ☉ "
+ elif thegenre == "slash":
+ ficstring += " ♂ "
+ elif thegenre == "het":
+ ficstring += " ⚤ "
+ elif thegenre == "femslash":
+ ficstring += " ♀ "
+ elif thegenre == "poly":
+ ficstring += " "
+ elif thegenre == "other":
+ ficstring += " ☿ "
if warnings:
ficstring += " !? "
ficstring += " " + str(words) + "
"