Preload some generate() variables

This commit is contained in:
Sage Vaillancourt 2021-07-29 22:15:07 -04:00
parent d1af841b41
commit fc037bd105
1 changed files with 6 additions and 5 deletions

View File

@ -16,6 +16,11 @@ def get_datetime():
now = datetime.now()
return now.strftime("%Y-%m-%d %H:%M:%S")
root_dir = os.path.dirname(os.getcwd())
proj_dir = root_dir + '/undercover/'
output_dir = proj_dir + 'outputs/'
base_tex_text = open(proj_dir + "/writing_templates/base.tex", "r").read()
@dataclass
class CLData():
username: str
@ -40,15 +45,11 @@ class CLData():
def generate_pdf(self):
import threading
unique_id = get_unique()
root_dir = os.path.dirname(os.getcwd())
proj_dir = root_dir + '/undercover/'
output_dir = proj_dir + 'outputs/'
unique_file = output_dir + unique_id + ".tex"
f = open(unique_file, "w")
for pair in self.get_pairs():
f.write("\\def \\" + pair[0] + "{" + pair[1] + "}\n")
f.write(open(proj_dir + "/writing_templates/base.tex", "r").read())
f.write(base_tex_text)
f.close()
output_arg="-jobname=outputs/" + unique_id + " " + unique_file