Store all user data in a folder

This commit is contained in:
mez 2024-08-06 19:37:17 +01:00
parent f92d6fab53
commit d3d579840a
19 changed files with 84 additions and 151 deletions

View file

@ -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