示例#1
0
def RUN_UNIT_TEST():
    try:
        DIALOG_PROGRESS = sys.modules["__main__"].DIALOG_PROGRESS
        __language__ = sys.modules["__main__"].__language__
        # LOADING CONF
        print "bypass_debug: Starting UNIT TESTS"
        import CONF
        config = CONF.ReadConfig()

        DIALOG_PROGRESS.update(-1, __language__(101), __language__(110))
        if not config.getboolean('InstallPath', 'pathok'):
            CONF.SetConfiguration()
        config = CONF.ReadConfig()
        del CONF

        # UNIT TEST

        # Write your unit tests Here
        # ...
        # ...
        print "bypass_debug: Tests done"
    except:
        print "bypass_debug: Tests error..."
        print_exc()
    DIALOG_PROGRESS.close()
示例#2
0
def MAIN():
    try: output.PRINT_DEBUG = ( XBMC_SETTINGS.getSetting( "script_debug" ) == "true" )
    except: print_exc()

    # print depend of output.PRINT_DEBUG is True or False
    print "bypass_debug: %s" % str( "-" * 100 )
    print "bypass_debug: Starting %s %s, %s, SVN r%s. Built on %s" % ( __script__, __version__, __statut__, __svn_revision__, __date__ )
    print "bypass_debug: The executable script running is: %s" % os.path.join( os.getcwd(), "default.py" )
    print "bypass_debug: %s" % str( "-" * 100 )
    dialog_error = False
    updating = False
    try:
        from utilities import getUserSkin
        current_skin, force_fallback = getUserSkin()
        print "bypass_debug: load default skin:[%s]" % current_skin
        print "bypass_debug: default skin use force fallback: %s" % repr( force_fallback )
        del getUserSkin
    except:
        pass

    #setup skins utilities and reload xbmc skin if necessary
    import skins_utilities
    if skins_utilities.setupUtilities():
        print "Reloaded Skin: %s" % xbmc.getSkinDir()
        xbmc.executebuiltin( "XBMC.Notification(%s,Reloaded Skin...,3000,%s)" % ( xbmc.getSkinDir(), os.path.join( os.getcwd(), "default.tbn" ), ) )
        xbmc.executebuiltin( "XBMC.ReloadSkin()" )
        xbmc.sleep( 2000 )

    # INITIALISATION CHEMINS DE FICHIER LOCAUX
    try:
        import CONF
        setconf = False
        config = CONF.ReadConfig()

        DIALOG_PROGRESS.update( -1, __language__( 101 ), __language__( 110 ) )
        curversion =  config.get('Version','version')
        if "1." in curversion:
            setconf = True
            
        if not config.getboolean( 'InstallPath', 'pathok' ):
            setconf = True

        if setconf:
            # GENERATION DES INFORMATIONS LOCALES
            CONF.SetConfiguration()
    except:
        dialog_error = True
        print "Error while setting the configuration"
        print_exc()

    # CHECK SCRIPT UPDATE AVAILABILITY AND UPDATE CONFIGUARTION FILE
    try:
        import CHECKMAJ
        try:
            CHECKMAJ.UPDATE_STARTUP = ( XBMC_SETTINGS.getSetting( "update_startup" ) == "true" )
        except:
            CHECKMAJ.UPDATE_STARTUP = False
            print_exc()
        print "CHECKMAJ.UPDATE_STARTUP = %s"%str(CHECKMAJ.UPDATE_STARTUP)
        if CHECKMAJ.UPDATE_STARTUP:
            DIALOG_PROGRESS.update( -1, __language__( 102 ), __language__( 110 ) )
            CHECKMAJ.go()
        del CHECKMAJ
    except:
        # In case of an Exception here we still load the script
        print "Error while checking availability of an update for the installer"
        print "We still going to start the script ..."
        print_exc()

    # RETRIEVING CONFIGURATION FROM CONF FILE
    try:
        config = CONF.ReadConfig()
        del CONF
    except:
        print "Error while reading the configuration"
        dialog_error = True
        print_exc()

    try:
        updating = config.getboolean( 'Version', 'UPDATING' )
    except:
        # Issue with conf file, stopping update
        dialog_error = True
        print_exc()
    try:
        if not updating:
            try:
                # LANCEMENT DU SCRIPT
                try:
                    import Home
                    DIALOG_PROGRESS.close()
                    HomeAction = Home.show_home()
                except:
                    print_exc()
                    HomeAction = "error"

                if HomeAction == "error":
                    import MainGui
                    MainGui.show_main()
            except:
                print "bypass_debug: MAIN: Exception while loading the script"
                print_exc()
                dialog_error = True
        else:
            # UPDATING THE SCRIPT
            try:
                scriptmaj = config.get( 'Version', 'SCRIPTMAJ' )
                xbmc.executescript( scriptmaj )
            except:
                print "bypass_debug: MAIN: Exception while updating of the script"
                print_exc()
                dialog_error = True

        if dialog_error: xbmcgui.Dialog().ok( __language__( 111 ), __language__( 112 ) )
    except:
        print_exc()
    DIALOG_PROGRESS.close()