Skip to content

Commit

Permalink
Begin sync implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
mrvladus committed Sep 19, 2023
1 parent 74c118c commit 54611ab
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 1 deletion.
54 changes: 54 additions & 0 deletions build-aux/python3-nextcloud-tasks-api.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"name": "python3-nextcloud-tasks-api",
"buildsystem": "simple",
"build-commands": [
"pip3 install --verbose --exists-action=i --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} \"nextcloud-tasks-api\" --no-build-isolation"
],
"sources": [
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/4c/dd/2234eab22353ffc7d94e8d13177aaa050113286e93e7b40eae01fbf7c3d9/certifi-2023.7.22-py3-none-any.whl",
"sha256": "92d6037539857d8206b8f6ae472e8b77db8058fec5937a1ef3f54304089edbb9"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/2a/53/cf0a48de1bdcf6ff6e1c9a023f5f523dfe303e4024f216feac64b6eb7f67/charset-normalizer-3.2.0.tar.gz",
"sha256": "3bb3d25a8e6c0aedd251753a79ae98a093c7e7b471faa3aa9a93a81431987ace"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/fc/34/3030de6f1370931b9dbb4dad48f6ab1015ab1d32447850b9fc94e60097be/idna-3.4-py3-none-any.whl",
"sha256": "90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/db/77/73b90042bacd18233bf3ed305ea130255cd99edb966b17b92705c32211c1/nextcloud_tasks_api-0.0.5-py3-none-any.whl",
"sha256": "e341373805de776e23e00c6ebd62b7df72cec4d1d13a19157c747a58433384c7"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/eb/37/791f1a6edd13c61cac85282368aa68cb0f3f164440fdf60032f2cc6ca34e/prompt_toolkit-3.0.36-py3-none-any.whl",
"sha256": "aa64ad242a462c5ff0363a7b9cfe696c20d55d9fc60c11fd8e632d064804d305"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/0b/e7/2dd8f59d1d328773505f78b85405ddb1cfe74126425d076ce72e65540b8b/questionary-2.0.1-py3-none-any.whl",
"sha256": "8ab9a01d0b91b68444dff7f6652c1e754105533f083cbe27597c8110ecc230a2"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/70/8e/0e2d847013cb52cd35b38c009bb167a1a26b2ce6cd6965bf26b47bc0bf44/requests-2.31.0-py3-none-any.whl",
"sha256": "58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/9b/81/62fd61001fa4b9d0df6e31d47ff49cfa9de4af03adecf339c7bc30656b37/urllib3-2.0.4-py3-none-any.whl",
"sha256": "de7df1803967d2c2a98e4b11bb7d6bd9210474c46e8a0401514e3a42a75ebde4"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/20/f4/c0584a25144ce20bfcf1aecd041768b8c762c1eb0aa77502a3f0baa83f11/wcwidth-0.2.6-py2.py3-none-any.whl",
"sha256": "795b138f6875577cd91bba52baf9e445cd5118fd32723b460e30a0af30ea230e"
}
]
}
4 changes: 3 additions & 1 deletion io.github.mrvladus.List.Devel.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
"--device=dri",
"--socket=wayland",
"--socket=fallback-x11",
"--share=ipc"
"--share=ipc",
"--share=network"
],
"modules": [
"build-aux/python3-nextcloud-tasks-api.json",
{
"name": "errands",
"buildsystem": "meson",
Expand Down
1 change: 1 addition & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ install_data(
[
'application.py',
'preferences.py',
'sync.py',
'task.py',
'utils.py',
'window.py',
Expand Down
59 changes: 59 additions & 0 deletions src/sync.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
from .utils import GSettings, Log
from nextcloud_tasks_api import NextcloudTasksApi, TaskFile, get_nextcloud_tasks_api


class Sync:
providers: list

@classmethod
def init(self) -> None:
self.providers.append(SyncProviderNextcloud())
# self.providers.append(SyncProviderTodoist())

@classmethod
def sync(self) -> None:
pass

def _setup_providers(self) -> None:
pass


class SyncProviderNextcloud:
url: str
username: str
password: str
api: NextcloudTasksApi
tasks: list[TaskFile]

def __init__(self) -> None:
Log.debug("Initialize Nextcloud sync provider")

self.url = GSettings.get("nc-url")
self.username = GSettings.get("nc-username")
self.password = GSettings.get("nc-password")

self.connect()

def connect(self) -> None:
Log.debug(f"Connecting to Nextcloud at '{self.url}' as user '{self.username}'")
self.api = get_nextcloud_tasks_api(self.url, self.username, self.password)

def get_tasks(self):
for task_list in self.api.get_lists():
self.tasks.extend(task_list)

def sync(self) -> None:
pass


class SyncProviderTodoist:
token: str

def __init__(self) -> None:
pass

def connect(self) -> None:
pass

def sync(self) -> None:
pass

0 comments on commit 54611ab

Please sign in to comment.