diff options
| author | Jan Tuomi <jans.tuomi@gmail.com> | 2023-09-02 21:48:53 +0300 |
|---|---|---|
| committer | Jan Tuomi <jans.tuomi@gmail.com> | 2023-09-10 19:01:00 +0300 |
| commit | c13734f56e9b01a61cfb66019a71d46c3dfe6f86 (patch) | |
| tree | 155da5a7386a6fabf493640bd9d0eb9aa10313c2 /app/FeedSourcePlugin.py | |
| parent | 4745449cf847f27c3cbbca5cef2f1d9d02103692 (diff) | |
Add tinydb
Diffstat (limited to 'app/FeedSourcePlugin.py')
| -rw-r--r-- | app/FeedSourcePlugin.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/app/FeedSourcePlugin.py b/app/FeedSourcePlugin.py index 5453f80..7690c8d 100644 --- a/app/FeedSourcePlugin.py +++ b/app/FeedSourcePlugin.py @@ -12,8 +12,13 @@ class Plugin(PluginInterface): print(f"[FeedSourcePlugin#{self.id}] initialized") - def process(self, items: list[Item]) -> list[Item]: + def process(self, source_id: str | None, items: list[Item]) -> list[Item]: print(f"[FeedSourcePlugin#{self.id}] process called") + if source_id is not None: + raise Exception( + f"FeedSourcePlugin#{self.id} can only be scheduled, trying to process items from source {source_id}" + ) + feed: Any = feedparser.parse(self.feed_url) # type: ignore result_items: list[Item] = [] if "bozo" in feed and feed["bozo"] == 1: @@ -26,5 +31,7 @@ class Plugin(PluginInterface): Item(title=d["title"], link=d["link"], description=d["description"]) ) - print(f"[FeedSourcePlugin#{self.id}] process returns items, n={len(items)}") + print( + f"[FeedSourcePlugin#{self.id}] process returns items, n={len(result_items)}" + ) return result_items |
