From 0e236a4be36ee67daf39d9f898cb097923ff9ef8 Mon Sep 17 00:00:00 2001 From: Simone Robutti Date: Thu, 13 May 2021 13:32:44 +0200 Subject: [PATCH] added main loop stub --- mobilizon_bots/main.py | 14 ++++++++++++++ mobilizon_bots/storage/db.py | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 mobilizon_bots/main.py diff --git a/mobilizon_bots/main.py b/mobilizon_bots/main.py new file mode 100644 index 0000000..b2a9d61 --- /dev/null +++ b/mobilizon_bots/main.py @@ -0,0 +1,14 @@ +from mobilizon_bots.storage.db import MobilizonBotsDB + + +def main(): + """ + STUB + :return: + """ + db = MobilizonBotsDB().setup() + unpublished_events = Mobilizon().get_unpublished_events() + published_events = db.get_published_events() + event = select_event_to_publish() + result = PublisherCoordinator(event).publish() if event else exit(0) + exit(0 if result.is_success() else 1) diff --git a/mobilizon_bots/storage/db.py b/mobilizon_bots/storage/db.py index 2b556a4..0f75c60 100644 --- a/mobilizon_bots/storage/db.py +++ b/mobilizon_bots/storage/db.py @@ -3,8 +3,8 @@ from pathlib import Path from tortoise import Tortoise -class MobotsDB: - def __init__(self, path: Path): +class MobilizonBotsDB: + def __init__(self, path: Path = None): self.path = path async def setup(self):