def _install_addon_zip(self):
        """
        Install an addon from a local zip file
        """
        installMgr = InstallMgr()

        # Install from zip file
        status, itemName, destination, addonInstaller = installMgr.install_from_zip(
        )

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

        if status == "OK":
            requiredLibs = addonInstaller.itemInfo["required_lib"]
            status = installMgr._getAddonRequiredLibs(requiredLibs)

            from datetime import datetime

            #Install OK so save information for future update
            addonInstallName = addonInstaller.getItemInstallName()
            addonVersion = addonInstaller.getItemVersion()
            addonInfo = {}
            addonInfo['name'] = addonInstallName
            addonInfo['date'] = datetime.now()
            addonInfo['version'] = addonVersion
            addonInfo['repository'] = None
            addonInfo['installer_version'] = __version__

            PersistentDataCreator(addonInfo,
                                  os.path.join(destination, "a4x.psdt"))

        return status
    def _install_addon_zip( self ):
        """
        Install an addon from a local zip file
        """
        installMgr = InstallMgr()

        # Install from zip file
        status, itemName, destination, addonInstaller = installMgr.install_from_zip()

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

        if status == "OK":
            requiredLibs = addonInstaller.itemInfo[ "required_lib" ]
            status = installMgr._getAddonRequiredLibs( requiredLibs )
            
            from datetime import datetime

            #Install OK so save information for future update
            addonInstallName = addonInstaller.getItemInstallName()
            addonVersion = addonInstaller.getItemVersion()
            addonInfo = {}
            addonInfo['name'] = addonInstallName
            addonInfo['date'] = datetime.now()
            addonInfo['version'] = addonVersion
            addonInfo['repository'] = None
            addonInfo['installer_version'] = __version__

            PersistentDataCreator( addonInfo, os.path.join( destination, "a4x.psdt" ) )

        return status
예제 #3
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