Commit cb26db20 authored by Jakob Lerch's avatar Jakob Lerch Committed by satan
Browse files

refactor(cli): put `pad to mail` to the right place in the code

parent c50685a6
......@@ -9,6 +9,7 @@ import topicmanager.mail as mail
import topicmanager.hedgedoc as hedgedoc
from typer import Option, echo, run
def main(
gitlab_url: str = Option(..., envvar="GITLAB_URL"),
gitlab_token: str = Option(..., envvar="GITLAB_TOKEN"),
......@@ -36,9 +37,18 @@ def main(
template = Template(mail_template_path.read_text())
# pad to mail
hd = hedgedoc.HedgedocNote(hedgedoc_url)
tl = deepl.Translator(translator_key)
protocol_german = hd.read_note()
protocol_english = tl.translate_text(protocol_german,
source_lang="DE",
target_lang="EN")
body = template.substitute(
date=meeting_date,
time=meeting_time
protocol_german=protocol_german,
protocol_english=protocol_english
)
m = mail.Mail(
......@@ -50,25 +60,10 @@ def main(
smtp_password
)
m.send_mail(body, mail_subject)
hd = hedgedoc.HedgedocNote(hedgedoc_url)
tl = deepl.Translator(translator_key)
protocol_german = hd.read_note()
# to gitlab
# TODO: parsing
# to mail
protocol_english = tl.translate_text(protocol_german,
source_lang="DE",
target_lang="EN")
mail_text = apply_proto_mail_template(protocol_german, protocol_english)
m.send_mail(mail_text, "Protocol Tech Meeting " +
meeting_date)
# pad to gitlab
# TODO
if __name__ == "__main__":
run(main)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment