diff --git a/bumblebee/modules/rss.py b/bumblebee/modules/rss.py index 6045ed2..05eb5a1 100644 --- a/bumblebee/modules/rss.py +++ b/bumblebee/modules/rss.py @@ -19,6 +19,9 @@ except ImportError: import webbrowser import time +import os +import tempfile +import logging import bumblebee.input import bumblebee.output @@ -49,7 +52,11 @@ class Module(bumblebee.engine.Module): self._post_delay = 0 self._state = [] + + self._newspaper_filename = tempfile.mktemp('.html') + engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE, cmd=self._open) + engine.input.register_callback(self, button=bumblebee.input.RIGHT_MOUSE, cmd=self._create_newspaper) def _open(self, _): if self._current_item: @@ -60,6 +67,9 @@ class Module(bumblebee.engine.Module): 'link': entry['link'], 'new': all([i['title'] != entry['title'] for i in self._items]), 'source': url, + 'summary': i['summary'], + 'feed': parser['feed']['title'], + 'image': next(iter([l['href'] for l in i['links'] if l['rel']=='enclosure']), ''), 'published': time.mktime(entry.published_parsed) if hasattr(entry, 'published_parsed') else 0} def _update_items_from_feed(self, url): @@ -150,4 +160,47 @@ class Module(bumblebee.engine.Module): def state(self, _): return self._state + def _create_news_element(self, item): + try: + logging.error("aaaaaaaa") + timestr = "" if item['published'] == 0 else str(time.ctime(1565783383)) + except Exception as e: + logging.error(str(e)) + raise e + element = "