run method
(self)
| 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: |
nothing calls this directly
no test coverage detected