Example #1
0
    def __init__(self):
        Plugin.__init__(self, "W9Replay", "http://www.w9replay.fr/", 1)

        self.listeEmissionsCourantes = {}

        if os.path.exists(self.fichierCache):
            self.listeFichiers = self.chargerCache()
Example #2
0
class Logger(object):
    def __init__(self, opt):
        if 'plugin' not in opt:
            raise ValueError('no plugin selected');
        self.botId = self._pickAName();
        self.params = opt;
        self.logger = Plugin().load("plugins/Logger_"+opt['plugin']+".py")
        self.logger.constructor(self.params)


    def log(self, message, opt = {}):
        opt['original_message'] = message;
        opt['botId'] = self.botId;
        opt['datetime'] = datetime.today()

        if 'level' not in opt:
            opt['level'] = "INFO";

        if 'exception' in opt:
            exc_type, exc_value, exc_traceback = opt['exception'];
            lines = format_exception(exc_type, exc_value, exc_traceback)
            error = ''.join(' ' + line for line in lines)+"\n\n   ";
            message += error+"\n   ";

        self.logger.log(message, opt);

    def _pickAName(self):
        # taken from docker
        names = ["albattani","allen","almeida","archimedes","ardinghelli","aryabhata","austin","babbage","banach","bardeen","bartik","bassi","bell","bhabha","bhaskara","blackwell","bohr","booth","borg","bose","boyd","brahmagupta","brattain","brown","carson","chandrasekhar","colden","cori","cray","curie","darwin","davinci","dijkstra","dubinsky","easley","einstein","elion","engelbart","euclid","euler","fermat","fermi","feynman","franklin","galileo","gates","goldberg","goldstine","goldwasser","golick","goodall","hamilton","hawking","heisenberg","heyrovsky","hodgkin","hoover","hopper","hugle","hypatia","jang","jennings","jepsen","joliot","jones","kalam","kare","keller","khorana","kilby","kirch","knuth","kowalevski","lalande","lamarr","leakey","leavitt","lichterman","liskov","lovelace","lumiere","mahavira","mayer","mccarthy","mcclintock","mclean","mcnulty","meitner","meninsky","mestorf","minsky","mirzakhani","morse","murdock","newton","nobel","noether","northcutt","noyce","panini","pare","pasteur","payne","perlman","pike","poincare","poitras","ptolemy","raman","ramanujan","ride","ritchie","roentgen","rosalind","saha","sammet","shaw","shirley","shockley","sinoussi","snyder","spence","stallman","stonebraker","swanson","swartz","swirles","tesla","thompson","torvalds","turing","varahamihira","visvesvaraya","volhard","wescoff","williams","wilson","wing","wozniak","wright","yalow","yonath"];
        return choice(names)+str(randrange(10));
Example #3
0
	def __init__( self ):
		Plugin.__init__( self, "W9Replay", "http://www.w9replay.fr/", 1 )
		
		self.listeEmissionsCourantes = {}
		
		if os.path.exists( self.fichierCache ):
			self.listeFichiers = self.chargerCache()
Example #4
0
 def __init__(self, opt):
     if 'plugin' not in opt:
         raise ValueError('no plugin selected');
     self.botId = self._pickAName();
     self.params = opt;
     self.logger = Plugin().load("plugins/Logger_"+opt['plugin']+".py")
     self.logger.constructor(self.params)
Example #5
0
	def __init__( self ):
		Plugin.__init__( self, "M6Replay", "www.m6replay.fr/", 1 )
		
		self.listeFichiers = {} # Clefs = nomChaine, Valeurs = { nomEmission, [ [ Episode 1, Date1, URL1 ], ... ] }

		if os.path.exists( self.fichierCache ):
			self.listeFichiers = self.chargerCache()
Example #6
0
    def __init__(self, station, connector):
        Plugin.__init__(self)

        self._station = station
        self._connector = connector['icq']

        self.report = None
Example #7
0
    def __init__(self):
        Plugin.__init__(self, "Pluzz", "http://www.pluzz.fr/")

        cache = self.chargerCache()
        if cache:
            self.listeChaines = cache
        else:
            self.listeChaines = {}
Example #8
0
	def __init__( self):
		Plugin.__init__( self, "Europe1", "http://www.europe1.fr", 1 )
		# On instancie la classe qui permet de charger les pages web
		
		self.listeEmissions = {} # Clef = nom emission ; Valeur = lien fichier XML qui contient la liste des emissions
		
		if os.path.exists( self.fichierCache ):
			self.listeEmissions = self.chargerCache()
Example #9
0
    def __init__(self):
        Plugin.__init__(self, "M6Replay", "www.m6replay.fr/", 1)

        self.listeFichiers = {
        }  # Clefs = nomChaine, Valeurs = { nomEmission, [ [ Episode 1, Date1, URL1 ], ... ] }

        if os.path.exists(self.fichierCache):
            self.listeFichiers = self.chargerCache()
Example #10
0
    def init(self, logger):
        Plugin.init(self, logger)
        self.errors[3130] = self.def_class(item=3130,
                                           level=3,
                                           tags=['name', 'tag'],
                                           title=T_('Tag name is a brand'))

        self.Brand = self.BRAND.split("\n")
Example #11
0
	def __init__( self):
		Plugin.__init__( self, "Pluzz", "http://www.pluzz.fr/")
		
		cache = self.chargerCache()
		if cache:
			self.listeChaines = cache
		else:
			self.listeChaines = {}
Example #12
0
 def __init__(self, controller, msn):
     Plugin.__init__(self, controller, msn)
     self.description = _('Show preview image when you receive a wink.')
     self.authors = {'Jan de Mooij': '*****@*****.**'}
     self.website = ''
     self.displayName = _('Wink Preview')
     self.name = 'WinkPreview'
     self.msn = msn
     self.enabled = False
Example #13
0
    def __init__(self):
        Plugin.__init__(self, "Europe1", "http://www.europe1.fr", 1)
        # On instancie la classe qui permet de charger les pages web

        self.listeEmissions = {
        }  # Clef = nom emission ; Valeur = lien fichier XML qui contient la liste des emissions

        if os.path.exists(self.fichierCache):
            self.listeEmissions = self.chargerCache()
Example #14
0
    def __init__(self):
        Plugin.__init__(self, "Canal+", "http://www.canalplus.fr/", 7)

        self.listeProgrammes = {
        }  # { Nom chaine : { Nom emission : ID emission } }
        self.derniereChaine = ""

        if os.path.exists(self.fichierCache):
            self.listeProgrammes = self.chargerCache()
Example #15
0
 def init(self, logger):
     Plugin.init(self, logger)
     self.errors[3130] = {
         "item": 3130,
         "level": 3,
         "tag": ["name", "tag"],
         "desc": {
             "en": u"Tag name is a brand",
             "fr": u"Le tag name est une marque"
         }
     }
     self.Brand = self.BRAND.split("\n")
Example #16
0
    def __init__(self, controller, msn):
        Plugin.__init__(self, controller, msn)

        self.msn = msn
        self.enabled = False

        self.winkCacheDir = os.path.join(self.msn.cacheDir, 'winks')
        if not os.path.exists(self.winkCacheDir):
            os.mkdir(self.winkCacheDir)
        self.autoplay = False
        self.checkIfHasGnash()

        self.config = controller.config
        self.config.readPluginConfig(self.name)
    def __init__(self, controller, msn):
        Plugin.__init__(self, controller, msn)

        self.msn = msn
        self.enabled = False

        self.winkCacheDir = os.path.join(self.msn.cacheDir,'winks')
        if not os.path.exists(self.winkCacheDir):
            os.mkdir(self.winkCacheDir)
        self.autoplay = False
        self.checkIfHasGnash()
        
        self.config = controller.config
        self.config.readPluginConfig(self.name)
Example #18
0
 def __init__(self, controller, msn):
     '''
     Contructor
     '''
     Plugin.__init__(self, controller, msn, 100)
     self.description = _('Shakes the window when a nudge is received.')
     self.authors = {unicode('Yguaratã C. Cavalcanti','latin-1').
         encode('latin-1') : 'yguarata at gmail dot com' }
     self.website = 'http://www.yguarata.org'
     self.displayName = _('Window Trembling Nudge')
     self.name = 'WindowTremblingNudge'
     self.shakeWindowId = None
     self.controller = controller
     self.base_movement = 10
Example #19
0
def analyseBundle(bundleId):
    bundle = config.bundleTable.find_one({"bundleId": bundleId})

    if bundle == None:
        logging.error("No matching bundle has been found")
        abort(make_response("No matching bundle has been found", 400))

    if bundle["archivePath"] == None: 
        logging.error("The bundle as no directory path")
        abort(make_response("The bundle as no directory path", 400))

    headers = {'content-type': 'application/gzip'}
    analyseReturn = requests.post(
        config.uriAnalyser+"/bundle/"+str(bundleId),
        data=open(bundle["archivePath"], 'r').read(),
        headers=headers).json()

    # logging.error("analyzeBundle analyseReturn: " + str(analyseReturn))

    pluginIdOffset = config.pluginTable.count()

    while 1:
        analyseReturn = requests.get(config.uriAnalyser+"/bundle/"+str(bundleId)).json()

        if analyseReturn['status'] == "done":
            bundleData = analyseReturn['datas']
            break
        sleep(1)

    for index, plugin in enumerate(bundleData['plugins']) :
        pluginId = pluginIdOffset + index
        
        currentPlugin = Plugin(pluginId, bundleId)
        currentPlugin.clips = plugin['clips']
        currentPlugin.parameters = plugin['parameters']
        currentPlugin.properties = plugin['properties']
        currentPlugin.rawIdentifier = plugin['rawIdentifier']
        currentPlugin.version = plugin['version']

        # Gets Label/ShortLabel and ensures a non-empty value.
        currentPlugin.label = currentPlugin.getPropValueFromKeys(
            ('OfxPropLabel', 'OfxPropShortLabel', 'OfxPropLongLabel'),
            currentPlugin.rawIdentifier)
        currentPlugin.shortLabel = currentPlugin.getPropValueFromKeys(
            ('OfxPropShortLabel', 'OfxPropLongLabel'),
            currentPlugin.label)

        bundle['plugins'].append(pluginId)
        config.pluginTable.insert(currentPlugin.__dict__)
    return mongodoc_jsonify(bundle)
Example #20
0
    def load_plugins(self):
        info_files = []
        for root in sucker.PLUGIN_DIRS:
            for path in os.listdir(root):
                info_files.append(os.path.abspath(os.path.join(root, path, '%s.sucker-plugin' % path)))

        for info_file in info_files:
            if os.path.isfile(info_file):
                with open(info_file) as f:
                    info_str = f.read()
                info_str  = '[DEFAULT]\n' + info_str
                info_conf = ConfigParser.ConfigParser()
                info_conf.readfp(io.BytesIO(info_str))
                try:
                    plug_path, plug_tail = os.path.split(info_file)
                    plug_name   = info_conf.get('DEFAULT', 'name')
                    plug_type   = info_conf.get('DEFAULT', 'type')
                    plug_module = info_conf.get('DEFAULT', 'module')
                    self.plugins[plug_name] = Plugin(plug_path, self.shell)
                except ConfigParser.NoOptionError as err:
                    msg = err.message
                    msg = msg[msg.find("'")+1:]
                    msg = msg[:msg.find("'")]
                    print _("Can not load %s plugin from %s." % (path, plug_path))
                    print _("Option `%s` not found in .sucker-plugin file." % msg)

        for key in self.plugins:
            self.plugins[key].activate()
 def __init__(self, controller, msn):
     '''
     Contructor
     '''
     
     Plugin.__init__(self, controller, msn, 100)
     self.description = _('Shakes the window when a nudge is received.')
     self.authors = {unicode('Yguaratã C. Cavalcanti','latin-1').
         encode('latin-1') : 'yguarata at gmail dot com' }
     self.website = 'http://www.yguarata.org'
     self.displayName = _('Window Trembling Nudge')
     self.name = 'WindowTremblingNudge'
     self.shakeWindowId = None
     self.controller = controller
     self.base_movement = 10
     self.iterations = 30
Example #22
0
 def __init__(self, opt):
     if "plugin" not in opt:
         raise ValueError("no plugin selected")
     self.botId = self._pickAName()
     self.params = opt
     self.logger = Plugin().load("plugins/Logger_" + opt["plugin"] + ".py")
     self.logger.constructor(self.params)
Example #23
0
def mmain():
    manager = multiprocessing.Manager()

    global PROCESSES
    PROCESSES = {}

    global PLUGINS
    PLUGINS = manager.list()

    global CONTEXT
    CONTEXT = manager.dict()

    for plugin in os.listdir('plugins'):
        try:
            dir = os.path.join('plugins', plugin)
            if not os.path.isdir(dir):
                continue
            print 'Loading plugin {}'.format(plugin)
            p = Plugin(dir)
            PLUGINS.append(p)
            print 'Successfully loaded plugin: {}'.format(p)
        except Exception:
            traceback.print_exc(file=sys.stdout)
            print 'Failed to load plugin {}'.format(plugin)
    global http_server
    http_server = WSGIServer(('', 5000), app)
    #http_server.log = open('http.log', 'w')
    http_server.serve_forever()
Example #24
0
 def listerPlugins(self):
     for plugin in Plugin.__subclasses__():  # Pour tous les plugins
         # On l'instancie
         inst = plugin()
         # On recupere son nom
         nom = getattr(inst, "nom")
         # On ajoute le plugin a la liste des plugins existants
         self.listePlugins[nom] = plugin
Example #25
0
class Backend(object):
    def __init__(self, opt):
        if 'plugin' not in opt:
            raise ValueError("no plugin selected")
        self.params = opt;
        self.backend = Plugin().load("plugins/Backend_"+opt['plugin']+".py")
        self.backend.constructor(self.params)

    def alreadyExist(self, key):
        res = self.backend.alreadyExist(key);
        if not isinstance(res, bool):
            raise TypeError('issues with the plugin: '+self.params['plugin']);
        else:
            return res;

    def put(self, key, obj):
        self.backend.put(key, obj);
Example #26
0
def classFactory(iface):

    #used for symlinked test environment
    import sys, os, inspect
    cmdfolder = os.path.realpath(
        os.path.abspath(
            os.path.split(inspect.getfile(inspect.currentframe()))[0]))
    if cmdfolder not in sys.path:
        sys.path.insert(0, cmdfolder)

    from Plugin import Plugin
    return Plugin(iface)
Example #27
0
    def instancierPlugins(self):
        for plugin in Plugin.__subclasses__():  # Pour tous les plugins
            try:
                # Instance du plugin
                inst = plugin()
            except:
                logger.error("impossible d'instancier le plugin %s" % (plugin))
                continue
            # Nom du plugin
#			nom = inst.nom#FIXME Utiliser le nom de la classe
# Ajout du plugin
#			self.listeInstances[ nom ] = inst
            self.ajouterPlugin(inst)
Example #28
0
def newPlugin(bundleId):
    pluginId = request.get_json().get('pluginId', None)
    pluginName = request.get_json().get('name', None)

    if pluginId == None or pluginName == None:
        abort(404)

    plugin = Plugin(pluginId, bundleId, pluginName)

    config.pluginTable.insert(plugin.__dict__)

    requestResult = config.pluginTable.find_one({"pluginId": pluginId})
    return mongodoc_jsonify(requestResult)
Example #29
0
	def instancierPlugins( self ):
		for plugin in Plugin.__subclasses__(): # Pour tous les plugins
			try:
				# Instance du plugin
				inst = plugin()
			except Exception as exc:
				logger.error( "impossible d'instancier le plugin %s: %s" %( plugin,  exc.message) )
				traceback.print_exc()
				continue
			# Nom du plugin
#			nom = inst.nom#FIXME Utiliser le nom de la classe
			# Ajout du plugin
#			self.listeInstances[ nom ] = inst
			self.ajouterPlugin(inst)
Example #30
0
def get_available_encoders(plugins_dir):
    plugins = []
    #   For each dir in plugin dir
    for plugin_dir in listdir(plugins_dir):
        plugin_dir = path.join(plugins_dir, plugin_dir)
        if path.isdir(plugin_dir):
            #   Check if it has a file...plugin.yaml
            plugin_config = path.join(plugin_dir, "plugin.yaml")
            if path.exists(plugin_config):
                print("Plugin Found!")
                #   Each plugin.yaml represents a plugin
                try:
                    plugins.append(Plugin(plugin_config))
                except ValueError as ve:
                    print(ve)

    return plugins
Example #31
0
def load_plugin(id):
    p = [p for p in PLUGINS if p.id == id][0]
    print 'returning plugin {}'.format(p)
    return p
    for plugin in os.listdir('plugins'):
        try:
            dir = os.path.join('plugins', plugin)
            if not os.path.isdir(dir):
                continue
            if id == plugin:
                print 'Loading plugin {}'.format(plugin)
                p = Plugin(dir)
                print 'Successfully loaded plugin: {}'.format(p)
                return p
        except Exception as e:
            print 'Failed to load plugin {}. Error: {}'.format(plugin, e)
    print 'Failed to find plugin id {}'.format(id)
    return None
Example #32
0
	def __init__( self):
		Plugin.__init__( self, "Podcasts", "", 30 )
Example #33
0
	def __init__( self ):
		Plugin.__init__( self, "France Inter", "http://www.franceinter.fr/podcasts", 30 )
		
		if os.path.exists( self.fichierCache ):
			self.listeEmissions = self.chargerCache()
Example #34
0
	def __init__(self):
		Plugin.__init__(self, "videarn.com", "videarn.png")
Example #35
0
	def __init__(self):
		Plugin.__init__(self, "Bang You Later", "bangyoulater.png")
Example #36
0
 def __init__(self):
     self.moreEntries = True
     Plugin.__init__(self, "mp4porn.mobi", "mp4porn.png")
Example #37
0
	def __init__( self):
		Plugin.__init__( self, "Radio France", "http://www.radiofrance.fr/", 30 )
Example #38
0
 def init(self, logger):
     Plugin.init(self, logger)
     self.errors[3130] = { "item": 3130, "level": 3, "tag": ["name", "tag"], "desc": {"en": u"Tag name is a brand", "fr": u"Le tag name est une marque"} }
     self.Brand = self.BRAND.split("\n")
Example #39
0
	def __init__(self):
		Plugin.__init__(self, "P**n Rabbit", "pornrabbit.png")
Example #40
0
	def __init__( self ):
		Plugin.__init__( self, "France Inter", "http://sites.radiofrance.fr/franceinter/accueil/", 30 )
		
		if os.path.exists( self.fichierCache ):
			self.listeEmissions = self.chargerCache()
Example #41
0
 def __init__(self):
     Plugin.__init__(self, "Bang You Later", "bangyoulater.png")
Example #42
0
 def __init__(self, connector):
     Plugin.__init__(self)
     self._connector = connector
Example #43
0
    def __init__(self):
        Plugin.__init__(self, self.nom, self.url, 7) #7 = fréquence de rafraichissement

        if os.path.exists(self.fichierCache):
                self.listeChaines = self.chargerCache()
Example #44
0
	def __init__(self):
		self.moreEntries = True
		Plugin.__init__(self, "mp4porn.mobi", "mp4porn.png")
Example #45
0
def analyseBundle(bundleId):
    bundle = config.bundleTable.find_one({"bundleId": bundleId})

    if bundle == None:
        logging.error("No matching bundle has been found")
        abort(make_response("No matching bundle has been found", 400))

    if bundle["archivePath"] == None:
        logging.error("The bundle as no directory path")
        abort(make_response("The bundle as no directory path", 400))

    headers = {'content-type': 'application/gzip'}
    analyseReturn = requests.post(config.uriAnalyser + "/bundle/" +
                                  str(bundleId),
                                  data=open(bundle["archivePath"], 'r').read(),
                                  headers=headers).json()

    # logging.error("analyzeBundle analyseReturn: " + str(analyseReturn))

    pluginIdOffset = config.pluginTable.count()

    while 1:
        analyseReturn = requests.get(config.uriAnalyser + "/bundle/" +
                                     str(bundleId)).json()

        if analyseReturn['status'] == "done":
            bundleData = analyseReturn['datas']
            break
        sleep(1)

    for index, plugin in enumerate(bundleData['plugins']):
        pluginId = pluginIdOffset + index

        currentPlugin = Plugin(pluginId, bundleId)
        currentPlugin.clips = plugin['clips']
        currentPlugin.parameters = plugin['parameters']
        currentPlugin.properties = plugin['properties']
        currentPlugin.rawIdentifier = plugin['rawIdentifier']
        currentPlugin.version = plugin['version']

        # Gets Label/ShortLabel and ensures a non-empty value.
        currentPlugin.label = currentPlugin.getPropValueFromKeys(
            ('OfxPropLabel', 'OfxPropShortLabel', 'OfxPropLongLabel'),
            currentPlugin.rawIdentifier)
        currentPlugin.shortLabel = currentPlugin.getPropValueFromKeys(
            ('OfxPropShortLabel', 'OfxPropLongLabel'), currentPlugin.label)

        bundle['plugins'].append(pluginId)
        config.pluginTable.insert(currentPlugin.__dict__)
    return mongodoc_jsonify(bundle)
Example #46
0
 def __init__(self, name, url):
     self.url = url
     self.moreEntries = True
     Plugin.__init__(self, name, "mXVideos.png")
Example #47
0
	def __init__( self ):
		Plugin.__init__( self, "La Chaine Parlementaire", "http://www.lcp.fr/", 7 )
		
		if( os.path.exists( self.fichierCache ) ):
			self.listeEmissions = self.chargerCache()
Example #48
0
	def __init__(self, name, url):
		self.url = url
		self.moreEntries = True
		Plugin.__init__(self, name, "pornrabbit.png")
Example #49
0
 def __init__(self, name, url):
     self.url = url
     self.moreEntries = True
     Plugin.__init__(self, name, "bangyoulater.png")
Example #50
0
	def __init__(self):
		Plugin.__init__(self, "mXVideos", "mXVideos.png")
Example #51
0
#!/usr/bin/python

from Plugin import Plugin

def run(bot, serv, ev) :
	pass

REGEX = '.'
REGEXES_RUN = { REGEX : run }
plugin = Plugin(REGEXES_RUN)

if __name__ == '__main__' :
	plugin.test('test', None)
Example #52
0
    def __init__(self):
        Plugin.__init__(self, "France Inter",
                        "http://www.franceinter.fr/podcasts", 30)

        if os.path.exists(self.fichierCache):
            self.listeEmissions = self.chargerCache()
Example #53
0
 def __init__(self):
     Plugin.__init__(self, "mXVideos", "mXVideos.png")
Example #54
0
	def __init__(self):
		Plugin.__init__(self)
		self.requiredInput = ['MXRecord']
		self.category = 'SMTP'
Example #55
0
	def __init__(self, name, icon, url):
		self.url = url
		Plugin.__init__(self, name, icon)
Example #56
0
	def __init__(self, name, url):
		self.url = url
		self.moreEntries = True
		Plugin.__init__(self, name, "bangyoulater.png")
Example #57
0
	def __init__(self, name, url):
		self.url = url
		self.moreEntries = True
		Plugin.__init__(self, name, "mXVideos.png")
Example #58
0
	def __init__(self, name, url):
		self.url = url
		self.moreEntries = True
		Plugin.__init__(self, name, "videarn.png")