patelnaitik30
patelnaitik30

Reputation: 41

How to run my enigma2 based plug-in on bootup/startup for dreambox?

I had developed on plugin in enigma2 for dreambox.I had use this thing

def Plugins(**kwargs):

    return PluginDescriptor(
           name="01loginscreendemo",
           description="loginScreenDemo ",
           where = PluginDescriptor.WHERE_PLUGINMENU,
           icon="../images.jpg",
           fnc=main)

so it display my plugin on plugins menu.

Is it possible to run plugins on startup? How?

Upvotes: 4

Views: 2449

Answers (2)

s3n0
s3n0

Reputation: 636

from Plugins.Plugin import PluginDescriptor

def autoStart(reason, **kwargs):                           # starts DURING the Enigma2 booting
    if reason == 0:    # and kwargs.has_key('session'):
        print('PLUGINSTARTDEBUGLOG - autoStart executed , reason == 0 , kwargs.has_key("session") = %s' % kwargs.has_key("session")  )
    if reason == 1:
        print('PLUGINSTARTDEBUGLOG - autoStart executed , reason == 1 , kwargs.has_key("session") = %s' % kwargs.has_key("session")  )

def mainStart(session, **kwargs):                          # starts when the plugin is opened via Plugin-MENU
    print('PLUGINSTARTDEBUGLOG - mainStart executed , kwargs.has_key("session") = %s' % kwargs.has_key("session")  )

def sessionStart(reason, session):                         # starts AFTER the Enigma2 booting
    if reason == 0:
        print('PLUGINSTARTDEBUGLOG - sessionStart executed, reason == 0')
    if reason == 1:
        print('PLUGINSTARTDEBUGLOG - sessionStart executed, reason == 1')

def Plugins(**kwargs):
    """ Register plugin in the plugin menu and prepare the plugin with autostart """
    return [
        PluginDescriptor(
            where = PluginDescriptor.WHERE_AUTOSTART,      # starts DURING the Enigma2 booting
            #where = [PluginDescriptor.WHERE_AUTOSTART , PluginDescriptor.WHERE_SESSIONSTART],
            fnc = autoStart),
        PluginDescriptor(
            where = PluginDescriptor.WHERE_SESSIONSTART,   # starts AFTER the Enigma2 booting
            fnc = sessionStart),
        PluginDescriptor(
            where = PluginDescriptor.WHERE_PLUGINMENU,     # starts when the plugin is opened via Plugin-MENU
            name = "picons updater",
            description = "picon updater for OE2.0",
            icon = "images/plugin.png",
            fnc = mainStart)
        ]

Upvotes: 1

user1365789
user1365789

Reputation: 81

def autostart(reason, **kwargs):
         print "startup"



def Plugins(**kwargs):
    return [
        PluginDescriptor(
            where =  PluginDescriptor.WHERE_AUTOSTART,
            fnc = autostart),
        PluginDescriptor(
            name = "esprit 2",
            description = "Test Plugit 2",
            where = PluginDescriptor.WHERE_AUTOSTART,
            icon = "../ihad_tut.png",
            fnc = main)]

Upvotes: 1

Related Questions