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()
def __init__(self): self.rootdir = os.getcwd().replace(';','') ############################################################################## # Initialisation conf.cfg # ############################################################################## global UPDATE_STARTUP self.fichier = os.path.join( sys.modules[ "__main__" ].SPECIAL_SCRIPT_DATA, "conf.cfg" ) #self.fichier = os.path.join(self.rootdir, "resources", "conf.cfg") import CONF self.localConfParser = CONF.ReadConfig() ############################################################################## # Initialisation parametres locaux # ############################################################################## self.cacheDir = self.localConfParser.get('InstallPath','CacheDir') self.scriptDir = self.localConfParser.get('InstallPath','ScriptsDir') self.curversion = self.localConfParser.get('Version','version') ############################################################################## # Verification des repertoires et creation si besoin ############################################################################## self.verifrep(self.cacheDir) ############################################################################## # Initialisation parametres serveur # ############################################################################## self.host = self.localConfParser.get('ServeurID','host') self.user = self.localConfParser.get('ServeurID','user') self.password = self.localConfParser.get('ServeurID','password') self.remoteversionDir = self.localConfParser.get('ServeurID','updatescriptdir') self.filetodl = "" self.newversionfile = "" self.newversion = "" self.filedst = "" self.completedfile = "" self.versiontodl = "" self.confmaj = os.path.join(self.cacheDir, "confmaj.cfg") self.archive = "" self.scripttolaunch = os.path.join(self.rootdir, "default.py") ######################################################### # DEMARRAGE DE LA CONNEXION # ######################################################### if UPDATE_STARTUP: try: self.ftp = ftplib.FTP(self.host,self.user,self.password) self.remoteDirLst = self.ftp.nlst(self.remoteversionDir) except: print "bypass_debug: CheckMAJ - init - Exception creating CheckMAJ - cancelling update ..." UPDATE_STARTUP = False print_exc() else: self.ftp = UPDATE_STARTUP self.remoteDirLst = list()
def __init__( self, *args, **kwargs ): try: self.mainwin = kwargs[ "mainwin" ] self.configManager = self.mainwin.configManager self.thumb_size_on_load = self.mainwin.settings[ "thumb_size" ] except: import CONF config = CONF.ReadConfig() self.configManager = CONF.configCtrl() del CONF self.thumb_size_on_load = 512 # FIFO des images a telecharger self.image_queue = [] self.curCategory = "root" self.curList = [] # Current list of item/category self.stopUpdateImageThread = False # Flag indiquant si on doit stopper ou non le thread getImagesQueue_thread
def __init__(self, *args, **kwargs): Browser.__init__(self, *args, **kwargs) #self.db = kwargs[ "database" ] # Database file import CONF #TODO: check if we still need those vars self.baseURL = CONF.getBaseURLDbCrossway( ) # http://passion-xbmc.org/dbcrossway/ self.catcontentURL = "all/downloads/idparent=%d" self.xbmctypecontentURL = "all/downloads/type=file;xbmc_type=%s" self.newcontentURL = "all/downloads/type=file" self.baseURLDownloadFile = CONF.getBaseURLDownloadFile() self.baseURLPreviewPicture = CONF.getBaseURLPreviewPicture() del CONF self.currentItemId = 0 # Create History instance in order to store browsing history self.history = History()
def __init__( self, *args, **kwargs ): Browser.__init__( self, *args, **kwargs ) #self.db = kwargs[ "database" ] # Database file import CONF #TODO: check if we still need those vars self.baseURL = CONF.getBaseURLDbCrossway() # http://passion-xbmc.org/dbcrossway/ self.catcontentURL = "all/downloads/idparent=%d" self.xbmctypecontentURL = "all/downloads/type=file;xbmc_type=%s" self.newcontentURL = "all/downloads/type=file" self.baseURLDownloadFile = CONF.getBaseURLDownloadFile() self.baseURLPreviewPicture = CONF.getBaseURLPreviewPicture() del CONF self.currentItemId = 0 # Create History instance in order to store browsing history self.history = History()
def __init__( self , name, type ): #self.itemId = itemId # Id of the server item self.name = name # Name of the item self.type = type # XBMC Type of the item #self.typeInstallPath = installPath # Install Path for this type of item self.typeInstallPath = Item.get_install_path( type ) # Install Path for this type of item #self.filesize = filesize # Size of the file to download self.configManager = CONF.configCtrl() if not self.configManager.is_conf_valid: raise self.CACHEDIR = self.configManager.CACHEDIR self.fileMgr = fileMgr() # NOTE: need to be set in a subclass before calling isAlreadyInstalled or deleteInstalledItem self.scraperName = None self.scraperFileList = None # List of teh file for a scraper (xml, image ...) #self.installNameList = None self.installName = None # Name of the addon used by XBMC: i.e script dir name, plugin dir name, skin dir name, scraper xml file name self.destinationPath = None # self.status = "INIT" # Status of install :[ INIT | OK | ERROR | DOWNLOADED | EXTRACTED | ALREADYINSTALLED | ALREADYINUSE | CANCELED | INSTALL_DONE ]
def calcDate(Date): return (CONF.date(int(Date[0]), int(Date[1]), int(Date[2])) - CONF.TODAY).days
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()