MCPcopy
hub / github.com/pyload/pyload / run

Method run

module/PluginThread.py:491–578  ·  view source on GitHub ↗

run method

(self)

Source from the content-addressed store, hash-verified

489 self.start()
490
491 def run(self):
492 """run method"""
493
494 plugins = {}
495 container = []
496
497 for url, plugin in self.data:
498 if plugin in plugins:
499 plugins[plugin].append(url)
500 else:
501 plugins[plugin] = [url]
502
503
504 # filter out container plugins
505 for name in self.m.core.pluginManager.containerPlugins:
506 if name in plugins:
507 container.extend([(name, url) for url in plugins[name]])
508
509 del plugins[name]
510
511 #directly write to database
512 if self.pid > -1:
513 for pluginname, urls in plugins.iteritems():
514 plugin = self.m.core.pluginManager.getPlugin(pluginname, True)
515 if hasattr(plugin, "getInfo"):
516 self.fetchForPlugin(pluginname, plugin, urls, self.updateDB)
517 self.m.core.files.save()
518
519 elif self.add:
520 for pluginname, urls in plugins.iteritems():
521 plugin = self.m.core.pluginManager.getPlugin(pluginname, True)
522 if hasattr(plugin, "getInfo"):
523 self.fetchForPlugin(pluginname, plugin, urls, self.updateCache, True)
524
525 else:
526 #generate default result
527 result = [(url, 0, 3, url) for url in urls]
528
529 self.updateCache(pluginname, result)
530
531 packs = parseNames([(name, url) for name, x, y, url in self.cache])
532
533 self.m.log.debug("Fetched and generated %d packages" % len(packs))
534
535 for k, v in packs:
536 self.m.core.api.addPackage(k, v)
537
538 #empty cache
539 del self.cache[:]
540
541 else: #post the results
542
543
544 for name, url in container:
545 #attach container content
546 try:
547 data = self.decryptContainer(name, url)
548 except:

Callers

nothing calls this directly

Calls 12

fetchForPluginMethod · 0.95
updateCacheMethod · 0.95
decryptContainerMethod · 0.95
updateResultMethod · 0.95
parseNamesFunction · 0.90
extendMethod · 0.80
appendMethod · 0.45
iteritemsMethod · 0.45
getPluginMethod · 0.45
saveMethod · 0.45
addPackageMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected