Esempio n. 1
0
def executeCommand():
    pluginHandle = int(sys.argv[1])
    success = False

    if (mycgi.EmptyQS()):
        success = ShowProviders()
    else:
        (providerName, clearCache,
         testForwardedIP) = mycgi.Params(u'provider', u'clearcache',
                                         u'testforwardedip')

        if clearCache != u'':
            httpManager.ClearCache()
            return True

        elif testForwardedIP != u'':
            provider = Provider()
            provider.addon = addon

            httpManager.SetDefaultHeaders(provider.GetHeaders())
            forwardedIP = provider.CreateForwardedForIP('0.0.0.0')

            return TestForwardedIP(forwardedIP)

        elif providerName != u'':
            log(u"providerName: " + providerName, xbmc.LOGDEBUG)
            if providerName <> u'':
                provider = providerfactory.getProvider(providerName)

                if provider is None:
                    # ProviderFactory return none for providerName: %s
                    logException = LoggingException(
                        language(30000) % providerName)
                    # 'Cannot proceed', Error processing provider name
                    logException.process(language(30755), language(30020),
                                         xbmc.LOGERROR)
                    return False

                if provider.initialise(httpManager, sys.argv[0], pluginHandle,
                                       addon, language, PROFILE_DATA_FOLDER,
                                       RESOURCE_PATH):
                    success = provider.ExecuteCommand(mycgi)
                    log(u"executeCommand done", xbmc.LOGDEBUG)
                """
				print cookiejar
				print 'These are the cookies we have received so far :'

				for index, cookie in enumerate(cookiejar):
					print index, '  :  ', cookie
				cookiejar.save() 
				"""

    return success
Esempio n. 2
0
	success = False

	if ( mycgi.EmptyQS() ):
		success = ShowProviders()
        print success
	else:
		(providerName, clearCache, testForwardedIP) = mycgi.Params( u'provider', u'clearcache', u'testforwardedip' )

		if clearCache != u'':
			httpManager.ClearCache()
			return True
		
		elif testForwardedIP != u'':
			provider = Provider()

			httpManager.SetDefaultHeaders( provider.GetHeaders() )
			forwardedIP = provider.CreateForwardedForIP('0.0.0.0')
			
			return TestForwardedIP(forwardedIP)
			
		elif providerName != u'':
			logger.debug(u"providerName: " + providerName)
			if providerName <> u'':
				provider = providerfactory.getProvider(providerName)
				
				if provider is None:
					# ProviderFactory return none for providerName: %s
					logException = LoggingException("ProviderFactory returned None for providerName: %s" % providerName)
					# 'Cannot proceed', Error processing provider name
					logException.process("Cannot proceed", "Error processing provider name", logging.ERROR)
					return False