Ejemplo n.º 1
0
    def parseUrl(self):
        oInputParameterHandler = cInputParameterHandler()

        if (oInputParameterHandler.exist('function')):
            sFunction = oInputParameterHandler.getValue('function')
        else:
            cConfig().log('call load methode')
            sFunction = "load"

        if (oInputParameterHandler.exist('site')):
            sSiteName = oInputParameterHandler.getValue('site')
            cConfig().log('load site ' + sSiteName + ' and call function ' +
                          sFunction)
            cStatistic().callStartPlugin(sSiteName)

            if (isHosterGui(sSiteName, sFunction) == True):
                return

            if (isGui(sSiteName, sFunction) == True):
                return

            if (isFav(sSiteName, sFunction) == True):
                return

            if (isHome(sSiteName, sFunction) == True):
                return

            #if (isAboutGui(sSiteName, sFunction) == True):
            #return

            #try:
            exec "import " + sSiteName + " as plugin"
            exec "plugin." + sFunction + "()"
            #except:
            #    cConfig().log('could not load site: ' + sSiteName )
        else:

            if (cConfig().getSetting("home-view") == 'true'):
                oHome = cHome()
                cAbout()
                exec "oHome." + sFunction + "()"
                return

            oGui = cGui()
            oPluginHandler = cPluginHandler()
            aPlugins = oPluginHandler.getAvailablePlugins()
            if (len(aPlugins) == 0):
                oGui.openSettings()
                oGui.updateDirectory()
            else:
                for aPlugin in aPlugins:
                    oGuiElement = cGuiElement()
                    oGuiElement.setTitle(aPlugin[0])
                    oGuiElement.setSiteName(aPlugin[1])
                    oGuiElement.setDescription(aPlugin[2])
                    oGuiElement.setFunction(sFunction)
                    oGuiElement.setIcon("icon.png")
                    oGui.addFolder(oGuiElement)

            oGui.setEndOfDirectory()
Ejemplo n.º 2
0
    def parseUrl(self):
	    oInputParameterHandler = cInputParameterHandler()

	    if (oInputParameterHandler.exist('function')):
	        sFunction = oInputParameterHandler.getValue('function')
	    else:
	        cConfig().log('call load methode')
	        sFunction = "load"

	    if (oInputParameterHandler.exist('site')):
	        sSiteName = oInputParameterHandler.getValue('site')
	        cConfig().log('load site ' + sSiteName + ' and call function ' + sFunction)
	        cStatistic().callStartPlugin(sSiteName)

	        if (isHosterGui(sSiteName, sFunction) == True):
	            return
	        
	        if (isGui(sSiteName, sFunction) == True):
	            return
	            
	        if (isFav(sSiteName, sFunction) == True):
	            return

	        if (isHome(sSiteName, sFunction) == True):
	            return

	        #if (isAboutGui(sSiteName, sFunction) == True):            
	            #return

	        #try:
	        exec "import " + sSiteName + " as plugin"
	        exec "plugin."+ sFunction +"()"
	        #except:
	        #    cConfig().log('could not load site: ' + sSiteName )
	    else:

	        if (cConfig().getSetting("home-view") == 'true'):
	            oHome = cHome()
	            cAbout()
	            exec "oHome."+ sFunction +"()"
	            return

	        oGui = cGui()
	        oPluginHandler = cPluginHandler()
	        aPlugins = oPluginHandler.getAvailablePlugins()
	        if (len(aPlugins) == 0):
	            oGui.openSettings()
		    oGui.updateDirectory()
	        else:
	            for aPlugin in aPlugins:
	                oGuiElement = cGuiElement()
	                oGuiElement.setTitle(aPlugin[0])
	                oGuiElement.setSiteName(aPlugin[1])
	                oGuiElement.setDescription(aPlugin[2])
	                oGuiElement.setFunction(sFunction)
	                oGuiElement.setIcon("icon.png")
	                oGui.addFolder(oGuiElement)

	        oGui.setEndOfDirectory()
Ejemplo n.º 3
0
def parseUrl():
    oInputParameterHandler = cInputParameterHandler()

    if (oInputParameterHandler.exist('function')):
        sFunction = oInputParameterHandler.getValue('function')
    else:
        logger.info('call load methode')
        sFunction = "load"

    if (oInputParameterHandler.exist('site')):
        sSiteName = oInputParameterHandler.getValue('site')
        logger.info('load site ' + sSiteName + ' and call function ' + sFunction)

        if (sFunction == 'load'):
            cStatistic().callStartPlugin(sSiteName)

        if (isHosterGui(sSiteName, sFunction) == True):
            return

        if (isAboutGui(sSiteName, sFunction) == True):            
            return

        #try:
        exec "import " + sSiteName + " as plugin"
        exec "plugin."+ sFunction +"()"
        #except:
        #    logger.fatal('could not load site: ' + sSiteName )
    else:
        oGui = cGui()
        oPluginHandler = cPluginHandler()
        aPlugins = oPluginHandler.getAvailablePlugins()
        if (len(aPlugins) == 0):
            oGui.openSettings()
	    oGui.updateDirectory()
        else:
            for aPlugin in aPlugins:
                oGuiElement = cGuiElement()
                oGuiElement.setTitle(aPlugin[0])
                oGuiElement.setSiteName(aPlugin[1])
                oGuiElement.setFunction(sFunction)
                oGui.addFolder(oGuiElement)

        oGui.setEndOfDirectory()
Ejemplo n.º 4
0
    def parseUrl(self):

        #xbmc.log('arg :' + str(sys.argv), xbmc.LOGNOTICE)
        #xbmc.log('Debug 1 >>' + str(xbmc.getInfoLabel('Container().CurrentPage')) , xbmc.LOGNOTICE)
        #xbmc.log('Debug 2 >>' + str(xbmc.getInfoLabel('Container.FolderPath')) , xbmc.LOGNOTICE)

        oInputParameterHandler = cInputParameterHandler()
        if (oInputParameterHandler.exist('function')):
            sFunction = oInputParameterHandler.getValue('function')
        else:
            cConfig().log('call load methode')
            sFunction = "load"

        if (sFunction == 'DoNothing'):
            return

        if (not oInputParameterHandler.exist('site')):

            #mise a jour
            try:
                from resources.lib.about import cAbout
                cAbout().getUpdate()
                #exec "from resources.lib.about import cAbout as plugin"
                #exec "plugin.getUpdate()"
            except:
                pass

            #charge home
            plugins = __import__('resources.lib.home',
                                 fromlist=['home']).cHome()
            function = getattr(plugins, 'load')
            function()
            return

        if (oInputParameterHandler.exist('site')):
            sSiteName = oInputParameterHandler.getValue('site')
            cConfig().log('load site ' + sSiteName + ' and call function ' +
                          sFunction)
            cStatistic().callStartPlugin(sSiteName)

            if (isHosterGui(sSiteName, sFunction) == True):
                return

            if (isGui(sSiteName, sFunction) == True):
                return

            if (isFav(sSiteName, sFunction) == True):
                return

            if (isLibrary(sSiteName, sFunction) == True):
                return

            if (isDl(sSiteName, sFunction) == True):
                return

            if (isHome(sSiteName, sFunction) == True):
                return

            if (isTrakt(sSiteName, sFunction) == True):
                return

            if sSiteName == 'globalSearch':
                searchGlobal()
                return

            if sSiteName == 'globalSources':

                oGui = cGui()
                oPluginHandler = cPluginHandler()
                aPlugins = oPluginHandler.getAvailablePlugins()
                if (len(aPlugins) == 0):
                    oGui.openSettings()
                    oGui.updateDirectory()
                else:
                    for aPlugin in aPlugins:

                        oOutputParameterHandler = cOutputParameterHandler()
                        oOutputParameterHandler.addParameter(
                            'siteUrl', 'http://venom')
                        icon = 'sites/%s.png' % (aPlugin[1])
                        oGui.addDir(aPlugin[1], 'load', aPlugin[0], icon,
                                    oOutputParameterHandler)

                oGui.setEndOfDirectory()
                return

            if sSiteName == 'globalParametre':
                cConfig().showSettingsWindow()
                return
            #if (isAboutGui(sSiteName, sFunction) == True):
            #return

            #charge sites
            try:
                #exec "from resources.sites import " + sSiteName + " as plugin"
                #exec "plugin."+ sFunction +"()"
                plugins = __import__('resources.sites.%s' % sSiteName,
                                     fromlist=[sSiteName])
                function = getattr(plugins, sFunction)
                function()
            except Exception as e:
                cConfig().log('could not load site: ' + sSiteName +
                              ' error: ' + str(e))
                import traceback
                traceback.print_exc()
                return
Ejemplo n.º 5
0
    def parseUrl(self):

        #import sys
        #xbmc.log('arg :' + str(sys.argv), xbmc.LOGNOTICE)
        #xbmc.log('Debug 1 >>' + str(xbmc.getInfoLabel('Container().CurrentPage')) , xbmc.LOGNOTICE)
        #xbmc.log('Debug 2 >>' + str(xbmc.getInfoLabel('Container.FolderPath')) , xbmc.LOGNOTICE)

        oInputParameterHandler = cInputParameterHandler()
        oInputParameterHandler.getAllParameter()
        
        if (oInputParameterHandler.exist('function')):
            sFunction = oInputParameterHandler.getValue('function')
        else:
            VSlog('call load methode')
            sFunction = "load"

        if (sFunction=='DoNothing'):
            return

        if (not oInputParameterHandler.exist('site')):

            #mise a jour
            try:
                #from resources.lib.about import cAbout
                #cAbout().getUpdate()
                plugins = __import__('resources.lib.about', fromlist=['about']).cAbout()
                function = getattr(plugins, 'getUpdate')
                function()
            except:
                pass

            #charge home
            plugins = __import__('resources.lib.home', fromlist=['home']).cHome()
            function = getattr(plugins, 'load')
            function()
            return


        if (oInputParameterHandler.exist('site')):
            sSiteName = oInputParameterHandler.getValue('site')
            if (oInputParameterHandler.exist('title')):
                sTitle = oInputParameterHandler.getValue('title')
            else: sTitle = "none";

            VSlog('load site ' + sSiteName + ' and call function ' + sFunction)
            cStatistic().callStartPlugin(sSiteName, sTitle)

            if (isHosterGui(sSiteName, sFunction) == True):
                return

            if (isGui(sSiteName, sFunction) == True):
                return

            if (isFav(sSiteName, sFunction) == True):
                return

            if (isLibrary(sSiteName, sFunction) == True):
                return

            if (isDl(sSiteName, sFunction) == True):
                return

            if (isHome(sSiteName, sFunction) == True):
                return

            if (isTrakt(sSiteName, sFunction) == True):
                return

            if sSiteName == 'globalSearch':
                searchGlobal()
                return

            if sSiteName == 'globalRun':
                __import__('resources.lib.runscript', fromlist=['runscript'])
                #function = getattr(plugins, sFunction)
                #function()
                return

            if sSiteName == 'globalSources':

                oGui = cGui()
                oPluginHandler = cPluginHandler()
                aPlugins = oPluginHandler.getAvailablePlugins()
                if (len(aPlugins) == 0):
                    addons = addon()
                    addons.openSettings()
                    xbmc.executebuiltin("Container.Refresh")
                else:
                    for aPlugin in aPlugins:

                        oOutputParameterHandler = cOutputParameterHandler()
                        oOutputParameterHandler.addParameter('siteUrl', 'http://venom')
                        icon = 'sites/%s.png' % (aPlugin[1])
                        #icon = 'https://imgplaceholder.com/512x512/transparent/fff?text=%s&font-family=Roboto_Bold' % aPlugin[1]
                        oGui.addDir(aPlugin[1], 'load', aPlugin[0], icon, oOutputParameterHandler)

                oGui.setEndOfDirectory()
                return

            if sSiteName == 'globalParametre':
                addons = addon()
                addons.openSettings()
                return
            #if (isAboutGui(sSiteName, sFunction) == True):
                #return

            #charge sites
            try:
            #exec "from resources.sites import " + sSiteName + " as plugin"
            #exec "plugin."+ sFunction +"()"
                plugins = __import__('resources.sites.%s' % sSiteName, fromlist=[sSiteName])
                function = getattr(plugins, sFunction)
                function()
            except Exception as e:
                VSlog('could not load site: ' + sSiteName + ' error: ' + str(e))
                import traceback
                traceback.print_exc()
                return
Ejemplo n.º 6
0
    def parseUrl(self):

        #print sys.argv

        #print 'Debug 1'
        oInputParameterHandler = cInputParameterHandler()
        #print 'Debug 2'
        if (oInputParameterHandler.exist('function')):
            #print 'Debug 3'
            sFunction = oInputParameterHandler.getValue('function')
        else:
            #print 'Debug 4'
            cConfig().log('call load methode')
            sFunction = "load"

        #print 'Debug 5'
        if (sFunction == 'DoNothing'):
            return

        if (oInputParameterHandler.exist('site')):
            sSiteName = oInputParameterHandler.getValue('site')
            cConfig().log('load site ' + sSiteName + ' and call function ' +
                          sFunction)
            cStatistic().callStartPlugin(sSiteName)

            if (isHosterGui(sSiteName, sFunction) == True):
                return

            if (isGui(sSiteName, sFunction) == True):
                return

            if (isFav(sSiteName, sFunction) == True):
                return

            if (isLibrary(sSiteName, sFunction) == True):
                return

            if (isDl(sSiteName, sFunction) == True):
                return

            if (isHome(sSiteName, sFunction) == True):
                return

            #if (isAboutGui(sSiteName, sFunction) == True):
            #return

            #try:
            exec "from resources.sites import " + sSiteName + " as plugin"
            exec "plugin." + sFunction + "()"
            #except:
            #    cConfig().log('could not load site: ' + sSiteName )
        else:

            if (cConfig().getSetting("home-view") == 'true'):
                oHome = cHome()
                cAbout()
                exec "oHome." + sFunction + "()"
                return

            oGui = cGui()
            oPluginHandler = cPluginHandler()
            aPlugins = oPluginHandler.getAvailablePlugins()
            if (len(aPlugins) == 0):
                oGui.openSettings()
                oGui.updateDirectory()
            else:
                for aPlugin in aPlugins:

                    # oGuiElement = cGuiElement()
                    # oGuiElement.setTitle(aPlugin[0])
                    # oGuiElement.setSiteName(aPlugin[1])
                    # oGuiElement.setDescription(aPlugin[2])
                    # oGuiElement.setFunction(sFunction)
                    # oGuiElement.setIcon("icon.png")
                    # oGui.addFolder(oGuiElement)

                    oOutputParameterHandler = cOutputParameterHandler()
                    oOutputParameterHandler.addParameter('siteUrl', 'test')
                    oGui.addDir(aPlugin[1], sFunction, aPlugin[0], 'icon.png',
                                oOutputParameterHandler)

            oGui.setEndOfDirectory()
Ejemplo n.º 7
0
class main:
    def __init__(self):
        self.oConfig = cConfig()
        cCast().updateCast()
        self.parseUrl()
        cDb()._create_tables()
        self.oConfig.log('Constructor of default.py')

    def parseUrl(self):
        self.oConfig.log('call parseUrl methode')

        oInputParameterHandler = cInputParameterHandler()
        if (oInputParameterHandler.exist('function')):
            sFunction = oInputParameterHandler.getValue('function')
        else:
            sFunction = "load"

        if (sFunction =='DoNothing'):
            return

        if (not oInputParameterHandler.exist('site')):
            # mise a jour
            try:
                from resources.lib.about import cAbout
                cAbout().getUpdate()
            except Exception, e:
                self.oConfig.log('getUpdate ERROR: ' + e.message)

            #charge home
            #plugins = __import__('resources.lib.home', fromlist=['home']).cHome()
            #function = getattr(plugins, 'showSources')
            self.oConfig.log('In default.py call load')
            from resources.sites.server import load
            load() #server

            return


        if (oInputParameterHandler.exist('site')):
            sSiteName = oInputParameterHandler.getValue('site')
            if (oInputParameterHandler.exist('title')):
                sTitle = oInputParameterHandler.getValue('title')
            else: sTitle = "none";

            self.oConfig.log('load site ' + sSiteName + ' and call function ' + sFunction)
            cStatistic().callStartPlugin(sSiteName, sTitle)


            if (isHosterGui(sSiteName, sFunction) == True):
                return

            if (isGui(sSiteName, sFunction) == True):
                return

            if (isFav(sSiteName, sFunction) == True):
                return

            if (isLibrary(sSiteName, sFunction) == True):
                return

            if (isDl(sSiteName, sFunction) == True):
                return

            if (isHome(sSiteName, sFunction) == True):
                return

            if (isTrakt(sSiteName, sFunction) == True):
                return

            if sSiteName == 'globalSearch':
                searchGlobal()
                return

            if sSiteName == 'globalSources':

                oGui = cGui()
                oPluginHandler = cPluginHandler()
                aPlugins = oPluginHandler.getAvailablePlugins()
                if (len(aPlugins) == 0):
                    oGui.openSettings()
                    oGui.updateDirectory()
                else:
                    for aPlugin in aPlugins:

                        oOutputParameterHandler = cOutputParameterHandler()
                        oOutputParameterHandler.addParameter('siteUrl', 'http://primatech')
                        icon = 'sites/%s.png' % (aPlugin[1])
                        oGui.addDir(aPlugin[1], 'load', aPlugin[0], icon, oOutputParameterHandler)

                oGui.setEndOfDirectory()
                return

            if sSiteName == 'globalParametre':
                self.oConfig.showSettingsWindow()
                cCast().updateCast()
                return
            #if (isAboutGui(sSiteName, sFunction) == True):
                #return

            #charge sites
            try:
            #exec "from resources.sites import " + sSiteName + " as plugin"
            #exec "plugin."+ sFunction +"()"
                plugins = __import__('resources.sites.%s' % sSiteName, fromlist=[sSiteName])
                function = getattr(plugins, sFunction)
                function()
            except Exception as e:
                self.oConfig.log('could not load site: ' + sSiteName + ' error: ' + str(e))
                try:
                    plugins = __import__('resources.lib.gui.%s' % sSiteName, fromlist=[sSiteName])
                    function = getattr(plugins, sFunction)
                    function()
                except Exception as e:
                    self.oConfig.log('could not load gui: ' + sSiteName + ' error: ' + str(e))
                import traceback
                traceback.print_exc()
                return
Ejemplo n.º 8
0
    def parseUrl(self):
        
        #print sys.argv
        
        #print 'Debug 1'
        oInputParameterHandler = cInputParameterHandler()
        #print 'Debug 2'
        if (oInputParameterHandler.exist('function')):
            #print 'Debug 3'
            sFunction = oInputParameterHandler.getValue('function')
        else:
            #print 'Debug 4'
            cConfig().log('call load methode')
            sFunction = "load"

        #print 'Debug 5'   
        if (sFunction=='DoNothing'):
            return

        if (oInputParameterHandler.exist('site')):
            sSiteName = oInputParameterHandler.getValue('site')
            cConfig().log('load site ' + sSiteName + ' and call function ' + sFunction)
            cStatistic().callStartPlugin(sSiteName)

            if (isHosterGui(sSiteName, sFunction) == True):
                return
            
            if (isGui(sSiteName, sFunction) == True):
                return
            
            if (isFav(sSiteName, sFunction) == True):
                return
                
            if (isLibrary(sSiteName, sFunction) == True):
                return
                
            if (isDl(sSiteName, sFunction) == True):
                return
            
            if (isHome(sSiteName, sFunction) == True):
                return

            #if (isAboutGui(sSiteName, sFunction) == True):            
                #return

            #try:
            exec "from resources.sites import " + sSiteName + " as plugin"
            exec "plugin."+ sFunction +"()"
            #except:
            #    cConfig().log('could not load site: ' + sSiteName )
        else:
        
            try:
                from resources.lib.about import cAbout
                cAbout().getUpdate()
                #exec "from resources.lib.about import cAbout as plugin"
                #exec "plugin.getUpdate()"
            except:
                pass
            
            if (cConfig().getSetting("home-view") == 'true'):
                oHome = cHome()
                
                exec "oHome."+ sFunction +"()"
                return

            oGui = cGui()
            oPluginHandler = cPluginHandler()
            aPlugins = oPluginHandler.getAvailablePlugins()
            if (len(aPlugins) == 0):
                oGui.openSettings()
                oGui.updateDirectory()
            else:
                for aPlugin in aPlugins:
                    
                    # oGuiElement = cGuiElement()
                    # oGuiElement.setTitle(aPlugin[0])
                    # oGuiElement.setSiteName(aPlugin[1])
                    # oGuiElement.setDescription(aPlugin[2])
                    # oGuiElement.setFunction(sFunction)
                    # oGuiElement.setIcon("icon.png")
                    # oGui.addFolder(oGuiElement)
                    
                        oOutputParameterHandler = cOutputParameterHandler()
                        oOutputParameterHandler.addParameter('siteUrl', 'test')
                        oGui.addDir(aPlugin[1], sFunction, aPlugin[0], 'icon.png', oOutputParameterHandler)

            oGui.setEndOfDirectory()
Ejemplo n.º 9
0
    def parseUrl(self):

        # import sys
        # xbmc.log('arg :' + str(sys.argv), xbmc.LOGNOTICE)
        # xbmc.log('Debug 1 >>' + str(xbmc.getInfoLabel('Container().CurrentPage')), xbmc.LOGNOTICE)
        # xbmc.log('Debug 2 >>' + str(xbmc.getInfoLabel('Container.FolderPath')), xbmc.LOGNOTICE)

        
        # Exclue les appels par des plugins qu'on ne sait pas gérer, par exemple :  plugin://plugin.video.vstream/extrafanart
        oPluginHandler = cPluginHandler()
#         if oPluginHandler.getPluginPath() != 'plugin://plugin.video.vstream/':
#             cGui().setEndOfDirectory()
#             return
        
        oInputParameterHandler = cInputParameterHandler()

        if oInputParameterHandler.exist('function'):
            sFunction = oInputParameterHandler.getValue('function')
        else:
            VSlog('call load methode')
            sFunction = "load"

        if sFunction == 'setSetting':
            if oInputParameterHandler.exist('id'):
                plugin_id = oInputParameterHandler.getValue('id')
            else:
                return

            if oInputParameterHandler.exist('value'):
                value = oInputParameterHandler.getValue('value')
            else:
                return

            setSetting(plugin_id, value)
            return

        if sFunction == 'setSettings':
            setSettings(oInputParameterHandler)
            return
            
        if sFunction == 'DoNothing':
            return

        if not oInputParameterHandler.exist('site'):

            # mise a jour
            try:
                # from resources.lib.about import cAbout
                # cAbout().getUpdate()
                plugins = __import__('resources.lib.about', fromlist=['about']).cAbout()
                function = getattr(plugins, 'getUpdate')
                function()
            except:
                pass

            # charge home
            plugins = __import__('resources.lib.home', fromlist=['home']).cHome()
            function = getattr(plugins, 'load')
            function()
            return


        if oInputParameterHandler.exist('site'):
            sSiteName = oInputParameterHandler.getValue('site')
            if oInputParameterHandler.exist('title'):
                sTitle = oInputParameterHandler.getValue('title')
            else:
                sTitle = 'none'


            VSlog('load site ' + sSiteName + ' and call function ' + sFunction)
            cStatistic().callStartPlugin(sSiteName, sTitle)

            if isHosterGui(sSiteName, sFunction):
                return

            if isGui(sSiteName, sFunction):
                return

            if isFav(sSiteName, sFunction):
                return

            if isLibrary(sSiteName, sFunction):
                return

            if isDl(sSiteName, sFunction):
                return

            if isHome(sSiteName, sFunction):
                return

            if isTrakt(sSiteName, sFunction):
                return

            if sSiteName == 'globalSearch':
                searchGlobal()
                return

            if sSiteName == 'globalRun':
                __import__('resources.lib.runscript', fromlist=['runscript'])
                # function = getattr(plugins, sFunction)
                # function()
                return

            if sSiteName == 'globalSources':

                oGui = cGui()

                aPlugins = oPluginHandler.getAvailablePlugins(True)

                if len(aPlugins) == 0:
                    addons = addon()
                    addons.openSettings()
                    oGui.updateDirectory()

                else:
                    for aPlugin in aPlugins:

                        oOutputParameterHandler = cOutputParameterHandler()
                        oOutputParameterHandler.addParameter('siteUrl', 'http://venom')
                        icon = 'sites/%s.png' % (aPlugin[1])
                        # icon = 'https://imgplaceholder.com/512x512/transparent/fff?text=%s&font-family=Roboto_Bold' % aPlugin[1]
                        oGui.addDir(aPlugin[1], 'load', aPlugin[0], icon, oOutputParameterHandler)

                oGui.setEndOfDirectory()
                return

            if sSiteName == 'globalParametre':
                addons = addon()
                addons.openSettings()
                return
            # if isAboutGui(sSiteName, sFunction) == True:
                # return


            # charge sites
            try:
                # exec("from resources.sites import " + sSiteName + " as plugin")
                # exec("plugin." + sFunction + "()")
                plugins = __import__('resources.sites.%s' % sSiteName, fromlist=[sSiteName])
                function = getattr(plugins, sFunction)
                function()
            except Exception as e:
                progress().VSclose()  # Referme le dialogue en cas d'exception, sinon blocage de Kodi
                VSlog('could not load site: ' + sSiteName + ' error: ' + str(e))
                import traceback
                traceback.print_exc()
                return
Ejemplo n.º 10
0
    def parseUrl(self):

        # print sys.argv

        # print 'Debug 1'
        oInputParameterHandler = cInputParameterHandler()
        # print 'Debug 2'
        if oInputParameterHandler.exist("function"):
            # print 'Debug 3'
            sFunction = oInputParameterHandler.getValue("function")
        else:
            # print 'Debug 4'
            cConfig().log("call load methode")
            sFunction = "load"

        # print 'Debug 5'
        if sFunction == "DoNothing":
            return

        if oInputParameterHandler.exist("site"):
            sSiteName = oInputParameterHandler.getValue("site")
            cConfig().log("load site " + sSiteName + " and call function " + sFunction)
            cStatistic().callStartPlugin(sSiteName)

            if isHosterGui(sSiteName, sFunction) == True:
                return

            if isGui(sSiteName, sFunction) == True:
                return

            if isFav(sSiteName, sFunction) == True:
                return

            if isLibrary(sSiteName, sFunction) == True:
                return

            if isDl(sSiteName, sFunction) == True:
                return

            if isHome(sSiteName, sFunction) == True:
                return

            # if (isAboutGui(sSiteName, sFunction) == True):
            # return

            # try:
            exec "from resources.sites import " + sSiteName + " as plugin"
            exec "plugin." + sFunction + "()"
            # except:
            #    cConfig().log('could not load site: ' + sSiteName )
        else:

            if cConfig().getSetting("home-view") == "true":
                oHome = cHome()
                # cAbout()
                exec "oHome." + sFunction + "()"
                return

            oGui = cGui()
            oPluginHandler = cPluginHandler()
            aPlugins = oPluginHandler.getAvailablePlugins()
            if len(aPlugins) == 0:
                oGui.openSettings()
                oGui.updateDirectory()
            else:
                for aPlugin in aPlugins:

                    # oGuiElement = cGuiElement()
                    # oGuiElement.setTitle(aPlugin[0])
                    # oGuiElement.setSiteName(aPlugin[1])
                    # oGuiElement.setDescription(aPlugin[2])
                    # oGuiElement.setFunction(sFunction)
                    # oGuiElement.setIcon("icon.png")
                    # oGui.addFolder(oGuiElement)

                    oOutputParameterHandler = cOutputParameterHandler()
                    oOutputParameterHandler.addParameter("siteUrl", "test")
                    oGui.addDir(aPlugin[1], sFunction, aPlugin[0], "icon.png", oOutputParameterHandler)

            oGui.setEndOfDirectory()