1 from Plugins.Plugin import PluginDescriptor
3 from RSSSetup import RSSSetup
4 from RSSScreens import RSSOverview
5 from RSSPoller import RSSPoller
7 from Components.config import config, ConfigSubsection, ConfigSubList, ConfigEnableDisable, ConfigInteger, ConfigText
9 # Initialize Configuration
10 config.plugins.simpleRSS = ConfigSubsection()
11 config.plugins.simpleRSS.show_new = ConfigEnableDisable(default=True)
12 config.plugins.simpleRSS.interval = ConfigInteger(default=10, limits=(5, 300))
13 config.plugins.simpleRSS.feedcount = ConfigInteger(default=0)
14 config.plugins.simpleRSS.autostart = ConfigEnableDisable(default=False)
15 config.plugins.simpleRSS.keep_running = ConfigEnableDisable(default=True)
16 config.plugins.simpleRSS.feed = ConfigSubList()
17 for i in range(0, config.plugins.simpleRSS.feedcount.value):
18 config.plugins.simpleRSS.feed.append(ConfigSubsection())
19 config.plugins.simpleRSS.feed[i].uri = ConfigText(default="http://", fixed_size = False)
20 config.plugins.simpleRSS.feed[i].autoupdate = ConfigEnableDisable(default=True)
22 # Global Poller-Object
26 def main(session, **kwargs):
27 # Get Global rssPoller-Object
30 # Create one if we have none (no autostart)
32 rssPoller = RSSPoller(session)
34 # Show Overview when we have feeds
35 if len(rssPoller.feeds):
36 session.openWithCallback(closed, RSSOverview, rssPoller)
37 # Show Setup otherwise
39 session.openWithCallback(closed, RSSSetup, rssPoller)
41 # Plugin window has been closed
43 # If SimpleRSS should not run in Background: shutdown
44 if not config.plugins.simpleRSS.autostart.value and not config.plugins.simpleRSS.keep_running.value:
45 # Get Global rssPoller-Object
52 def autostart(reason, **kwargs):
55 # Instanciate when autostarting active, session present and enigma2 is launching
56 if config.plugins.simpleRSS.autostart.value and kwargs.has_key("session") and reason == 0:
57 rssPoller = RSSPoller(kwargs["session"])
59 if rssPoller is not None:
63 def Plugins(**kwargs):
64 return [ PluginDescriptor(name="RSS Reader", description="A simple to use RSS reader", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main),
65 PluginDescriptor(where = [PluginDescriptor.WHERE_SESSIONSTART, PluginDescriptor.WHERE_AUTOSTART], fnc = autostart),
66 PluginDescriptor(name="View RSS", description="Let's you view current RSS entries", where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc=main) ]