from Plugins.Plugin import PluginDescriptor
from Screens.Screen import Screen
import os

session = None

def autostart(reason, **kwargs):
    global session
    if reason == 0 and kwargs.has_key("session"):
       session = kwargs["session"]
       session.open(CardDriverBoot)

class CardDriverBoot(Screen):        
    def __init__(self,session):
		Screen.__init__(self,session)
		self.session = session
		
                if os.path.exists("/var/bin/sci-ng.sh") is True:
					os.system("/var/bin/sci-ng.sh restart")

def Plugins(**kwargs):
	return [PluginDescriptor(where = [PluginDescriptor.WHERE_SESSIONSTART, PluginDescriptor.WHERE_AUTOSTART], fnc = autostart)]
