diff options
Diffstat (limited to 'org.py')
-rw-r--r-- | org.py | 23 |
1 files changed, 5 insertions, 18 deletions
@@ -1,16 +1,14 @@ import locale -import os from datetime import datetime from orgparse import loads -from nextcloud import NextCloudConnection from settings import ORG_CAPTURE_FILENAME, ORG_LINKS_FILENAME, ORG_PLAN_FILENAME locale.setlocale(locale.LC_ALL, "es_ES.utf8") -class OrgData(NextCloudConnection): +class OrgData(): def _generate_today(self): today = datetime.today() today_ymd = today.strftime("%Y-%m-%d") @@ -20,8 +18,6 @@ class OrgData(NextCloudConnection): def add_new_todo(self, keyword: str, description: str, outcome: str, extra: str) -> None: - self.client.download_file(ORG_CAPTURE_FILENAME, "./capture.org") - today = self._generate_today() todo_template = f""" @@ -35,15 +31,12 @@ class OrgData(NextCloudConnection): """ - with open("./capture.org", "a") as capture_file: + print(ORG_CAPTURE_FILENAME) + with open(ORG_CAPTURE_FILENAME, "a") as capture_file: capture_file.write(todo_template) - self.client.upload_file("./capture.org", ORG_CAPTURE_FILENAME, overwrite=True) - - os.remove("./capture.org") - def list_plan(self, filename: str) -> str: - with self.client.open(ORG_PLAN_FILENAME.replace("{filename}", filename), mode="r") as agenda: + with open(ORG_PLAN_FILENAME.replace("{filename}", filename), "r") as agenda: plan = agenda.read() plan = loads(plan) @@ -52,11 +45,5 @@ class OrgData(NextCloudConnection): def add_new_link(self, link: str) -> None: - self.client.download_file(ORG_LINKS_FILENAME, "./links.org") - - with open("./links.org", "a") as capture_file: + with open(ORG_LINKS_FILENAME, "a") as capture_file: capture_file.write(link) - - self.client.upload_file("./links.org", ORG_LINKS_FILENAME, overwrite=True) - - os.remove("./links.org") |