Store all user data in a folder

master
trémeur 5 months ago
parent f92d6fab53
commit d3d579840a

9
.gitignore vendored

@ -16,12 +16,5 @@ build/secret/*.epub
build/secret/*.gif
build/secret/*.png
build/emacs.jpg
originalsmeta/*
!originalsmeta/__init__.py
!originalsmeta/template.py
texts/*
!texts/.gitkeep
translationsmeta/*
!translationsmeta/__init__.py
!translationsmeta/template.py
files/
build/stats/*/index.html

@ -26,8 +26,8 @@ def charlist(local=False):
ficcountstring = "0" + str(ficcount)
else:
ficcountstring = str(ficcount)
if os.path.exists("originalsmeta/" + ficcountstring + ".py"):
ficfile = "originalsmeta." + ficcountstring
if os.path.exists("files/originalsmeta/" + ficcountstring + ".py"):
ficfile = "files.originalsmeta." + ficcountstring
fileread = import_module(ficfile)
try:
if fileread.revealdate > datetime.datetime.now():
@ -79,8 +79,8 @@ def charlist(local=False):
ficcountstring = "0" + str(ficcount)
else:
ficcountstring = str(ficcount)
if os.path.exists("originalsmeta/" + ficcountstring + ".py"):
countfile = "originalsmeta." + ficcountstring
if os.path.exists("files/originalsmeta/" + ficcountstring + ".py"):
countfile = "files.originalsmeta." + ficcountstring
fileread = import_module(countfile)
try:
if fileread.revealdate > datetime.datetime.now():

@ -27,7 +27,7 @@ def commentpage(ficno,directory,local=False):
else:
fffandom = False
except:
origfile = "originalsmeta." + str(fileread.original)
origfile = "files.originalsmeta." + str(fileread.original)
origread = import_module(origfile)
if any(item in fffandoms for item in origread.fandom):
fffandom = True
@ -143,10 +143,10 @@ def allcomments(local=False):
ficcountstring = "0" + str(ficcount)
else:
ficcountstring = str(ficcount)
if os.path.exists("originalsmeta/" + ficcountstring + ".py"):
commentpage(ficcount,"originalsmeta",local)
elif os.path.exists("translationsmeta/" + ficcountstring + ".py"):
commentpage(ficcount,"translationsmeta",local)
if os.path.exists("files/originalsmeta/" + ficcountstring + ".py"):
commentpage(ficcount,"files.originalsmeta",local)
elif os.path.exists("files/translationsmeta/" + ficcountstring + ".py"):
commentpage(ficcount,"files.translationsmeta",local)
if __name__ == "__main__":
allcomments()

@ -21,8 +21,8 @@ def eventlist(local=False):
ficcountstring = "0" + str(ficcount)
else:
ficcountstring = str(ficcount)
if os.path.exists("originalsmeta/" + ficcountstring + ".py"):
ficfile = "originalsmeta." + ficcountstring
if os.path.exists("files/originalsmeta/" + ficcountstring + ".py"):
ficfile = "files.originalsmeta." + ficcountstring
fileread = import_module(ficfile)
try:
if fileread.revealdate > datetime.datetime.now():
@ -57,8 +57,8 @@ def eventlist(local=False):
ficcountstring = "0" + str(ficcount)
else:
ficcountstring = str(ficcount)
if os.path.exists("originalsmeta/" + ficcountstring + ".py"):
countfile = "originalsmeta." + ficcountstring
if os.path.exists("files/originalsmeta/" + ficcountstring + ".py"):
countfile = "files.originalsmeta." + ficcountstring
fileread = import_module(countfile)
try:
if fileread.revealdate > datetime.datetime.now():

@ -21,8 +21,8 @@ def fandomlist(local=False):
ficcountstring = "0" + str(ficcount)
else:
ficcountstring = str(ficcount)
if os.path.exists("originalsmeta/" + ficcountstring + ".py"):
ficfile = "originalsmeta." + ficcountstring
if os.path.exists("files/originalsmeta/" + ficcountstring + ".py"):
ficfile = "files.originalsmeta." + ficcountstring
fileread = import_module(ficfile)
try:
if fileread.revealdate > datetime.datetime.now():
@ -64,8 +64,8 @@ def fandomlist(local=False):
ficcountstring = "0" + str(ficcount)
else:
ficcountstring = str(ficcount)
if os.path.exists("originalsmeta/" + ficcountstring + ".py"):
countfile = "originalsmeta." + ficcountstring
if os.path.exists("files/originalsmeta/" + ficcountstring + ".py"):
countfile = "files.originalsmeta." + ficcountstring
fileread = import_module(countfile)
try:
if fileread.revealdate > datetime.datetime.now():
@ -88,7 +88,7 @@ def fandomlist(local=False):
firstficstring = "0" + str(firstfic)
else:
firstficstring = str(firstfic)
firstfile = "originalsmeta." + firstficstring
firstfile = "files.originalsmeta." + firstficstring
firstread = import_module(firstfile)
firstyear = (firstread.datewords[0])["date"].year
lastfic = fandomfics[0]
@ -98,7 +98,7 @@ def fandomlist(local=False):
lastficstring = "0" + str(lastfic)
else:
lastficstring = str(lastfic)
lastfile = "originalsmeta." + lastficstring
lastfile = "files.originalsmeta." + lastficstring
lastread = import_module(lastfile)
lastyear = (lastread.datewords[0])["date"].year
if lastyear == firstyear:

@ -23,8 +23,8 @@ def feedgen(local=False):
ficcountstring = "0" + str(ficcount)
else:
ficcountstring = str(ficcount)
if os.path.exists("originalsmeta/" + ficcountstring + ".py"):
ficfile = "originalsmeta." + ficcountstring
if os.path.exists("files/originalsmeta/" + ficcountstring + ".py"):
ficfile = "files.originalsmeta." + ficcountstring
fileread = import_module(ficfile)
try:
if fileread.revealdate <= datetime.datetime.now():
@ -32,8 +32,8 @@ def feedgen(local=False):
except:
for instalment in fileread.datewords:
datelist.append(instalment["date"])
elif os.path.exists("translationsmeta/" + ficcountstring + ".py"):
ficfile = "translationsmeta." + ficcountstring
elif os.path.exists("files/translationsmeta/" + ficcountstring + ".py"):
ficfile = "files.translationsmeta." + ficcountstring
fileread = import_module(ficfile)
for instalment in fileread.datewords:
datelist.append(instalment["date"])
@ -53,8 +53,8 @@ def feedgen(local=False):
else:
ficcountstring = str(ficcount)
targetfile = 0
if os.path.exists("originalsmeta/" + ficcountstring + ".py"):
ficfile = "originalsmeta." + ficcountstring
if os.path.exists("files/originalsmeta/" + ficcountstring + ".py"):
ficfile = "files.originalsmeta." + ficcountstring
fileread = import_module(ficfile)
try:
if fileread.revealdate <= datetime.datetime.now():
@ -66,8 +66,8 @@ def feedgen(local=False):
if instalment["date"] == date:
if targetfile == 0:
targetfile = ficfile
elif os.path.exists("translationsmeta/" + ficcountstring + ".py"):
transfile = "translationsmeta." + ficcountstring
elif os.path.exists("files/translationsmeta/" + ficcountstring + ".py"):
transfile = "files.translationsmeta." + ficcountstring
transread = import_module(transfile)
for instalment in transread.datewords:
if instalment["date"] == date:
@ -90,7 +90,7 @@ def feedgen(local=False):
filewrite.write (" (French)")
filewrite.write(": ")
try:
origfile = "originalsmeta." + str(thefile.original)
origfile = "files.originalsmeta." + str(thefile.original)
origread = import_module(origfile)
try:
filewrite.write(origread.fandomtext)

@ -14,11 +14,11 @@ def statslist(local=False):
ficcountstring = "0" + str(ficcount)
else:
ficcountstring = str(ficcount)
if os.path.exists("originalsmeta/" + ficcountstring + ".py"):
ficfile = "originalsmeta." + ficcountstring
if os.path.exists("files/originalsmeta/" + ficcountstring + ".py"):
ficfile = "files.originalsmeta." + ficcountstring
fileread = import_module(ficfile)
elif os.path.exists("translationsmeta/" + ficcountstring + ".py"):
ficfile = "translationsmeta." + ficcountstring
elif os.path.exists("files/translationsmeta/" + ficcountstring + ".py"):
ficfile = "files.translationsmeta." + ficcountstring
fileread = import_module(ficfile)
else:
fileread = False

@ -17,7 +17,7 @@ def linkgen(ficno,output="output.html",local=False):
else:
ficnostring = str(ficno)
# open the file
ficfile = "originalsmeta." + ficnostring
ficfile = "files.originalsmeta." + ficnostring
fileread = import_module(ficfile)
# open translation file if there is one
try:
@ -28,7 +28,7 @@ def linkgen(ficno,output="output.html",local=False):
translationstring = "0" + str(fileread.translation)
else:
translationstring = str(fileread.translation)
translationfile = "translationsmeta." + translationstring
translationfile = "files.translationsmeta." + translationstring
transread = import_module(translationfile)
except:
pass
@ -259,7 +259,7 @@ def ficgen(ficno,unique=False,output="output.html",local=False):
else:
ficnostring = str(ficno)
# open the file
ficfile = "originalsmeta." + ficnostring
ficfile = "files.originalsmeta." + ficnostring
fileread = import_module(ficfile)
# open translation file if there is one
try:
@ -270,7 +270,7 @@ def ficgen(ficno,unique=False,output="output.html",local=False):
translationstring = "0" + str(fileread.translation)
else:
translationstring = str(fileread.translation)
translationfile = "translationsmeta." + translationstring
translationfile = "files.translationsmeta." + translationstring
transread = import_module(translationfile)
except:
pass

@ -25,8 +25,8 @@ def listgen(local=False):
ficcountstring = "0" + str(ficcount)
else:
ficcountstring = str(ficcount)
if os.path.exists("originalsmeta/" + ficcountstring + ".py"):
ficfile = "originalsmeta." + ficcountstring
if os.path.exists("files/originalsmeta/" + ficcountstring + ".py"):
ficfile = "files.originalsmeta." + ficcountstring
fileread = import_module(ficfile)
try:
if fileread.revealdate <= datetime.datetime.now():

@ -1,49 +0,0 @@
import datetime
title = "" # just the number is fine
showtitle = False
language = "en"
# translation =
datewords = [{"date":datetime.datetime(YYYY,M,D),"words":}]
# revealdate = datetime.datetime(YYYY,M,D)
# approxdate = ""
status = "complete" # incomplete, abandoned
rating = "" # g, t, m, e
# ratingreason = ""
fandom = [""]
# fandomtext = ""
# charpov = [""]
# charmain = [""]
# charsecondary = [""]
# charmention = [""]
# ship = [""]
genre = [""]
# warnings = ""
time = ""
location = [""]
# locationtext = ""
# summary = ""
# notes = ""
# event = "" # challenge (including fests; anything without a specific prompt), ao3exchange, exchange, prompt
# eventlocation = "" # dwcomm, dwjournal, ljjournal
# eventname = ""
# eventdeets = "" # probably not needed unless its robotsoup
# eventfrequency = "" # "annual" or some custom value like "summer 2022 round" or can leave
# prompt = ""
# recip = ""
# recippseud = ""
# recipsite = "" # ao3, dw, tumblr
locked = False
# ao3slug =
# ao3locked =
html = True
pdf = True
epub = True
# fedislug = ""
# comments = [{"site":"", # ao3, dw, lj, discord
# "registered":, # True or False, not required for discord
# "username":"", # leave out if its a dw/lj anon
# "pseud":"", # optional, ao3 only
# "date":datetime.datetime(),
# "link":"",
# "text":""}]

@ -26,8 +26,8 @@ def shiplist(local=False):
ficcountstring = "0" + str(ficcount)
else:
ficcountstring = str(ficcount)
if os.path.exists("originalsmeta/" + ficcountstring + ".py"):
ficfile = "originalsmeta." + ficcountstring
if os.path.exists("files/originalsmeta/" + ficcountstring + ".py"):
ficfile = "files.originalsmeta." + ficcountstring
fileread = import_module(ficfile)
try:
if fileread.revealdate > datetime.datetime.now():
@ -67,8 +67,8 @@ def shiplist(local=False):
ficcountstring = "0" + str(ficcount)
else:
ficcountstring = str(ficcount)
if os.path.exists("originalsmeta/" + ficcountstring + ".py"):
countfile = "originalsmeta." + ficcountstring
if os.path.exists("files/originalsmeta/" + ficcountstring + ".py"):
countfile = "files.originalsmeta." + ficcountstring
fileread = import_module(countfile)
try:
if fileread.revealdate > datetime.datetime.now():

@ -83,10 +83,10 @@ def allsingles(local=False):
ficcountstring = "0" + str(ficcount)
else:
ficcountstring = str(ficcount)
if os.path.exists("originalsmeta/" + ficcountstring + ".py"):
singlepage(ficcount,"originalsmeta",local)
elif os.path.exists("translationsmeta/" + ficcountstring + ".py"):
singlepage(ficcount,"translationsmeta",local)
if os.path.exists("files/originalsmeta/" + ficcountstring + ".py"):
singlepage(ficcount,"files.originalsmeta",local)
elif os.path.exists("files/translationsmeta/" + ficcountstring + ".py"):
singlepage(ficcount,"files.translationsmeta",local)
if __name__ == "__main__":
allsingles()

@ -13,27 +13,27 @@ do
ficstring="$i"
fi
fi
if compgen -G "texts/${ficstring}.*" > /dev/null
if compgen -G "files/texts/${ficstring}.*" > /dev/null
then
if test -f "originalsmeta/${ficstring}.py"
if test -f "files/originalsmeta/${ficstring}.py"
then
if grep -q "^locked = True" "originalsmeta/${ficstring}.py"
if grep -q "^locked = True" "files/originalsmeta/${ficstring}.py"
then
builddir="secret"
else
if grep -q "^locked = False" "originalsmeta/${ficstring}.py"
if grep -q "^locked = False" "files/originalsmeta/${ficstring}.py"
then
builddir="files"
fi
fi
else
if test -f "translationsmeta/${ficstring}.py"
if test -f "files/translationsmeta/${ficstring}.py"
then
if grep -q "^locked = True" "translationsmeta/${ficstring}.py"
if grep -q "^locked = True" "files/translationsmeta/${ficstring}.py"
then
builddir="secret"
else
if grep -q "^locked = False" "translationsmeta/${ficstring}.py"
if grep -q "^locked = False" "files/translationsmeta/${ficstring}.py"
then
builddir="files"
fi
@ -44,17 +44,17 @@ do
fi
if [ ${builddir} != "null" ]
then
if test -f "texts/${ficstring}.html"
if test -f "files/texts/${ficstring}.html"
then
mv "texts/${ficstring}.html" "build/${builddir}/"
mv "files/texts/${ficstring}.html" "build/${builddir}/"
fi
if test -f "texts/${ficstring}.pdf"
if test -f "files/texts/${ficstring}.pdf"
then
mv "texts/${ficstring}.pdf" "build/${builddir}/"
mv "files/texts/${ficstring}.pdf" "build/${builddir}/"
fi
if test -f "texts/${ficstring}.epub"
if test -f "files/texts/${ficstring}.epub"
then
mv "texts/${ficstring}.epub" "build/${builddir}/"
mv "files/texts/${ficstring}.epub" "build/${builddir}/"
fi
fi
fi

@ -16,17 +16,17 @@ def ficsum(ficcount,year,month=0,showfandom=True,local=False):
ficcountstring = "0" + str(ficcount)
else:
ficcountstring = str(ficcount)
if os.path.exists("originalsmeta/" + ficcountstring + ".py"):
ficfile = "originalsmeta." + ficcountstring
if os.path.exists("files/originalsmeta/" + ficcountstring + ".py"):
ficfile = "files.originalsmeta." + ficcountstring
fileread = import_module(ficfile)
elif os.path.exists("translationsmeta/" + ficcountstring + ".py"):
ficfile = "translationsmeta." + ficcountstring
elif os.path.exists("files/translationsmeta/" + ficcountstring + ".py"):
ficfile = "files.translationsmeta." + ficcountstring
fileread = import_module(ficfile)
else:
fileread = False
if fileread:
try:
theorig = "originalsmeta." + str(fileread.original)
theorig = "files.originalsmeta." + str(fileread.original)
origfile = import_module(theorig)
except:
pass
@ -227,11 +227,11 @@ def yeargen(local=False):
ficcountstring = "0" + str(ficcount)
else:
ficcountstring = str(ficcount)
if os.path.exists("originalsmeta/" + ficcountstring + ".py"):
ficfile = "originalsmeta." + ficcountstring
if os.path.exists("files/originalsmeta/" + ficcountstring + ".py"):
ficfile = "files.originalsmeta." + ficcountstring
fileread = import_module(ficfile)
elif os.path.exists("translationsmeta/" + ficcountstring + ".py"):
ficfile = "translationsmeta." + ficcountstring
elif os.path.exists("files/translationsmeta/" + ficcountstring + ".py"):
ficfile = "files.translationsmeta." + ficcountstring
fileread = import_module(ficfile)
else:
fileread = False
@ -270,11 +270,11 @@ def yeargen(local=False):
ficcountstring = "0" + str(ficcount)
else:
ficcountstring = str(ficcount)
if os.path.exists("originalsmeta/" + ficcountstring + ".py"):
ficfile = "originalsmeta." + ficcountstring
if os.path.exists("files/originalsmeta/" + ficcountstring + ".py"):
ficfile = "files.originalsmeta." + ficcountstring
fileread = import_module(ficfile)
elif os.path.exists("translationsmeta/" + ficcountstring + ".py"):
ficfile = "translationsmeta." + ficcountstring
elif os.path.exists("files/translationsmeta/" + ficcountstring + ".py"):
ficfile = "files.translationsmeta." + ficcountstring
fileread = import_module(ficfile)
else:
fileread = False
@ -292,11 +292,11 @@ def yeargen(local=False):
allfics.append(ficcountstring)
allfics = sorted(list(dict.fromkeys(allfics)))
for fic in allfics:
if os.path.exists("originalsmeta/" + fic + ".py"):
ficfile = "originalsmeta." + fic
if os.path.exists("files/originalsmeta/" + fic + ".py"):
ficfile = "files.originalsmeta." + fic
fileread = import_module(ficfile)
elif os.path.exists("translationsmeta/" + fic + ".py"):
ficfile = "translationsmeta." + fic
elif os.path.exists("files/translationsmeta/" + fic + ".py"):
ficfile = "files.translationsmeta." + fic
fileread = import_module(ficfile)
else:
fileread = False
@ -320,7 +320,7 @@ def yeargen(local=False):
except:
try:
if fileread.original:
theorig = "originalsmeta." + str(fileread.original)
theorig = "files.originalsmeta." + str(fileread.original)
origfile = import_module(theorig)
try:
fandom = origfile.fandom
@ -534,11 +534,11 @@ def yeargen(local=False):
# read the file back in to get the right word count, because dicts are dynamic somehow??
thedate = fic["date"]
thefic = fic["number"]
if os.path.exists("originalsmeta/" + thefic + ".py"):
ficfile = "originalsmeta." + thefic
if os.path.exists("files/originalsmeta/" + thefic + ".py"):
ficfile = "files.originalsmeta." + thefic
fileread = import_module(ficfile)
elif os.path.exists("translationsmeta/" + thefic + ".py"):
ficfile = "translationsmeta." + thefic
elif os.path.exists("files/translationsmeta/" + thefic + ".py"):
ficfile = "files.translationsmeta." + thefic
fileread = import_module(ficfile)
else:
fileread = False

@ -1,11 +0,0 @@
import datetime
title = ""
showtitle = False
language = "fr"
original =
datewords = [{"date":datetime.datetime(YYYY,M,D),"words":}]
status = "complete" # incomplete, abandoned
summary = ""
ao3slug =
# comments = [] # see originalsmeta/template.py for format

@ -23,8 +23,8 @@ def bywords(local=False):
ficcountstring = "0" + str(ficcount)
else:
ficcountstring = str(ficcount)
if os.path.exists("originalsmeta/" + ficcountstring + ".py"):
ficfile = "originalsmeta." + ficcountstring
if os.path.exists("files/originalsmeta/" + ficcountstring + ".py"):
ficfile = "files.originalsmeta." + ficcountstring
fileread = import_module(ficfile)
try:
if fileread.revealdate > datetime.datetime.now():

Loading…
Cancel
Save