Changed to using local org files
This commit is contained in:
parent
ef6904243d
commit
e74ff560ba
5
bofa.py
5
bofa.py
@ -2,13 +2,12 @@
|
||||
|
||||
from pyexcel_ods3 import get_data
|
||||
|
||||
from nextcloud import NextCloudConnection
|
||||
from settings import EXPENSES_FILENAME
|
||||
|
||||
|
||||
class BofaData(NextCloudConnection):
|
||||
class BofaData():
|
||||
def get(self) -> None:
|
||||
with self.client.open(EXPENSES_FILENAME, mode="rb") as expenses:
|
||||
with open(EXPENSES_FILENAME, "rb") as expenses:
|
||||
data = get_data(expenses)
|
||||
main_page = data.get("Main")
|
||||
|
||||
|
@ -1,8 +0,0 @@
|
||||
from webdav4.client import Client
|
||||
|
||||
from settings import NEXTCLOUD_PASSWORD, NEXTCLOUD_URL, NEXTCLOUD_USERNAME
|
||||
|
||||
|
||||
class NextCloudConnection:
|
||||
def __init__(self):
|
||||
self.client = Client(NEXTCLOUD_URL, auth=(NEXTCLOUD_USERNAME, NEXTCLOUD_PASSWORD))
|
23
org.py
23
org.py
@ -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")
|
||||
|
@ -22,9 +22,10 @@ NEXTCLOUD_URL = os.environ.get("NEXTCLOUD_URL")
|
||||
NEXTCLOUD_USERNAME = os.environ.get("NEXTCLOUD_USERNAME")
|
||||
NEXTCLOUD_PASSWORD = os.environ.get("NEXTCLOUD_PASSWORD")
|
||||
|
||||
ORG_CAPTURE_FILENAME = os.environ.get("ORG_CAPTURE_FILENAME")
|
||||
ORG_PLAN_FILENAME = os.environ.get("ORG_PLAN_FILENAME")
|
||||
ORG_LINKS_FILENAME = os.environ.get("ORG_LINKS_FILENAME")
|
||||
ORG_LOCATION = os.environ.get("ORG_LOCATION")
|
||||
ORG_CAPTURE_FILENAME = f"{ORG_LOCATION}/{os.environ.get('ORG_CAPTURE_FILENAME')}"
|
||||
ORG_PLAN_FILENAME = f"{ORG_LOCATION}/{os.environ.get('ORG_PLAN_FILENAME')}"
|
||||
ORG_LINKS_FILENAME = f"{ORG_LOCATION}/{os.environ.get('ORG_LINKS_FILENAME')}"
|
||||
|
||||
PROMETEO_API_KEY = os.environ.get("PROMETEO_API_KEY")
|
||||
PROMETEO_URL = os.environ.get("PROMETEO_URL")
|
||||
|
Loading…
x
Reference in New Issue
Block a user