示例#1
0
def addMissingModules2DB(addonIdList):
    """
    Add the list of modules (which failed to be installed) to the list of missing module
    """
    # Update list of module which fail to install
    missingModules = []
    if os.path.exists(MISSING_MODULES_PATH):
        pdr = PersistentDataRetriever( MISSING_MODULES_PATH )
        missingModules = pdr.get_data()

    print 'missingModules:'
    print missingModules
    for lib in addonIdList:
        print lib
        # add missing module and check if already in the list
        if len(missingModules) > 0:
            for module in missingModules:
                if module['id'] == lib['id']:
                    print "Module already in missing module list - checking version ..."
                    if versionsCmp( module['version'], lib["version"] ) < 0:
                        print "module version in list older than lib required - updating version ..."
                        module['version'] = lib["version"]
                    break
                else:
                    print "module not found in missing module list - adding it"
                    missingModules.append(lib)
        else:
            print "module not found in missing module list - adding it"
            missingModules.append(lib)

    PersistentDataCreator( missingModules, MISSING_MODULES_PATH )
示例#2
0
def removeMissingModule2DB(item):
    """
    Check if a module is part of the missing modules list and remove it if it is the case
    Remove only module with version identical or more recent than the one in the list
    """
    # Update list of module which fail to install
    missingModules = []
    if os.path.exists(MISSING_MODULES_PATH):
        pdr = PersistentDataRetriever( MISSING_MODULES_PATH )
        missingModules = pdr.get_data()

    print 'missingModules:'
    print missingModules
    if len(missingModules) > 0:
        for module in missingModules:
            if module['id'] == item['id']:
                print "Module already in missing module list - checking version ..."
                if module['version'] == item["version"] or versionsCmp( module['version'], item["version"] ) < 0:
                    print "module version in list identical or older than installed module - removing it form list ..."
                    missingModules.remove(item)
                break
            else:
                print "module not found in missing module list"
    else:
        print "No missing modules"
    PersistentDataCreator( missingModules, MISSING_MODULES_PATH )
示例#3
0
def addMissingModules2DB(addonIdList):
    """
    Add the list of modules (which failed to be installed) to the list of missing module
    """
    # Update list of module which fail to install
    missingModules = []
    if os.path.exists(MISSING_MODULES_PATH):
        pdr = PersistentDataRetriever(MISSING_MODULES_PATH)
        missingModules = pdr.get_data()

    print 'missingModules:'
    print missingModules
    for lib in addonIdList:
        print lib
        # add missing module and check if already in the list
        if len(missingModules) > 0:
            for module in missingModules:
                if module['id'] == lib['id']:
                    print "Module already in missing module list - checking version ..."
                    if versionsCmp(module['version'], lib["version"]) < 0:
                        print "module version in list older than lib required - updating version ..."
                        module['version'] = lib["version"]
                    break
                else:
                    print "module not found in missing module list - adding it"
                    missingModules.append(lib)
        else:
            print "module not found in missing module list - adding it"
            missingModules.append(lib)

    PersistentDataCreator(missingModules, MISSING_MODULES_PATH)
示例#4
0
def removeMissingModule2DB(item):
    """
    Check if a module is part of the missing modules list and remove it if it is the case
    Remove only module with version identical or more recent than the one in the list
    """
    # Update list of module which fail to install
    missingModules = []
    if os.path.exists(MISSING_MODULES_PATH):
        pdr = PersistentDataRetriever(MISSING_MODULES_PATH)
        missingModules = pdr.get_data()

    print 'missingModules:'
    print missingModules
    if len(missingModules) > 0:
        for module in missingModules:
            if module['id'] == item['id']:
                print "Module already in missing module list - checking version ..."
                if module['version'] == item["version"] or versionsCmp(
                        module['version'], item["version"]) < 0:
                    print "module version in list identical or older than installed module - removing it form list ..."
                    missingModules.remove(item)
                break
            else:
                print "module not found in missing module list"
    else:
        print "No missing modules"
    PersistentDataCreator(missingModules, MISSING_MODULES_PATH)
示例#5
0
    def _install_addon_remote(self):
        """
        Install an addon from a remote/web repository
        """
        xbmc.log("_install_addon_remote", xbmc.LOGDEBUG)
        status = "OK"
        installMgr = InstallMgr()

        #TODO: solve encoding pb on name

        addonName = unicode(self.parameters[PARAM_ADDON_NAME],
                            'ISO 8859-1',
                            errors='ignore')
        addonId = '%s' % self.parameters[PARAM_ADDON_ID]
        addonUrl = self.parameters[PARAM_URL].replace(' ', '%20')
        addonFormat = self.parameters[PARAM_TYPE]
        repoId = self.parameters[PARAM_REPO_ID]
        dataDir = self.parameters[PARAM_DATADIR].replace(
            ' ', '%20')  #self.repoList[repoId]['datadir']

        if (xbmcgui.Dialog().yesno(addonName, __language__(30050), "", "")):

            # Check if we install repo
            if "None" != repoId:
                # Retrieve addon info from persitence
                pdr = PersistentDataRetriever(
                    os.path.join(DIR_CACHE, repoId + ".txt"))
                addonDic = pdr.get_data()
                requiredLibs = addonDic[addonId]['required_lib']
                status = installMgr._getAddonRequiredLibs(requiredLibs, repoId)

            if status == "OK":
                # TODO: check repo ID
                status, itemName, destination, addonInstaller = installMgr.install_from_repo(
                    addonName, addonUrl, addonFormat, dataDir)
            else:
                # The install of required addons was not full
                itemName = addonDic[addonId]["name"]
                destination = None
                addonInstaller = None

            # Check if install went well
            status, destination = installMgr.check_install(
                status, itemName, destination, addonInstaller)

            if status == "OK":  # and "None" != repoId:
                saveLocalAddonInfo(repoId, destination, addonInstaller)

                # Check is addon is a module and if it was part of the missing modules list
                if "None" != repoId:
                    installedModuleItem = addonDic[addonId]
                    if TYPE_ADDON_MODULE == installedModuleItem["type"]:
                        # We just installed successfully a module
                        # Check if it was part of the missing modules list and remove it if it is the case
                        removeMissingModule2DB(installedModuleItem)

        return status
    def _install_addon_remote( self ):
        """
        Install an addon from a remote/web repository
        """
        xbmc.log("_install_addon_remote", xbmc.LOGDEBUG)
        status = "OK"
        installMgr = InstallMgr()

        #TODO: solve encoding pb on name

        addonName = unicode( self.parameters[ PARAM_ADDON_NAME ] , 'ISO 8859-1', errors='ignore' )
        addonId = '%s'%self.parameters[ PARAM_ADDON_ID ]
        addonUrl = self.parameters[ PARAM_URL ].replace( ' ', '%20' )
        addonFormat = self.parameters[ PARAM_TYPE ]
        repoId = self.parameters[ PARAM_REPO_ID ]
        dataDir = self.parameters[ PARAM_DATADIR ].replace( ' ', '%20' ) #self.repoList[repoId]['datadir']

        if ( xbmcgui.Dialog().yesno( addonName, __language__( 30050 ), "", "" ) ):

            # Check if we install repo
            if "None" != repoId:
                # Retrieve addon info from persitence
                pdr = PersistentDataRetriever( os.path.join( DIR_CACHE, repoId + ".txt" ) )
                addonDic = pdr.get_data()
                requiredLibs = addonDic[addonId]['required_lib']
                status = installMgr._getAddonRequiredLibs( requiredLibs, repoId )

            if status == "OK":
                # TODO: check repo ID
                status, itemName, destination, addonInstaller = installMgr.install_from_repo( addonName, addonUrl, addonFormat, dataDir )
            else:
                # The install of required addons was not full
                itemName       = addonDic[addonId]["name"]
                destination    = None
                addonInstaller = None

            # Check if install went well
            status, destination = installMgr.check_install(status, itemName, destination, addonInstaller)

            if status == "OK": # and "None" != repoId:
                saveLocalAddonInfo(repoId, destination, addonInstaller)

                # Check is addon is a module and if it was part of the missing modules list
                if "None" != repoId:
                    installedModuleItem = addonDic[addonId]
                    if TYPE_ADDON_MODULE == installedModuleItem["type"]:
                        # We just installed successfully a module
                        # Check if it was part of the missing modules list and remove it if it is the case
                        removeMissingModule2DB(installedModuleItem)


        return status
示例#7
0
    def _createMissingModulesDir(self):
        """
        Creates list of missing modules
        For now this is retrieve from local DB (persistent file)
        TODO: implement option in order to check each installed addon
        """

        if os.path.exists(MISSING_MODULES_PATH):
            pdr = PersistentDataRetriever(MISSING_MODULES_PATH)
            missingModules = pdr.get_data()
            print missingModules

            for lib in missingModules:
                self.pluginMgr.addLink(lib["id"], "")

        else:
            print "No missing modules found"
    def _createMissingModulesDir ( self ):
        """
        Creates list of missing modules
        For now this is retrieve from local DB (persistent file)
        TODO: implement option in order to check each installed addon
        """

        if os.path.exists(MISSING_MODULES_PATH):
            pdr = PersistentDataRetriever( MISSING_MODULES_PATH )
            missingModules = pdr.get_data()
            print missingModules

            for lib in missingModules:
                self.pluginMgr.addLink( lib["id"], "" )


        else:
            print "No missing modules found"