MCPcopy Index your code
hub / github.com/pyload/pyload / fetchForPlugin

Method fetchForPlugin

module/PluginThread.py:609–644  ·  view source on GitHub ↗
(self, pluginname, plugin, urls, cb, err=None)

Source from the content-addressed store, hash-verified

607 self.cache.extend(result)
608
609 def fetchForPlugin(self, pluginname, plugin, urls, cb, err=None):
610 try:
611 result = [] #result loaded from cache
612 process = [] #urls to process
613 for url in urls:
614 if url in self.m.infoCache:
615 result.append(self.m.infoCache[url])
616 else:
617 process.append(url)
618
619 if result:
620 self.m.log.debug("Fetched %d values from cache for %s" % (len(result), pluginname))
621 cb(pluginname, result)
622
623 if process:
624 self.m.log.debug("Run Info Fetching for %s" % pluginname)
625 for result in plugin.getInfo(process):
626 #result = [ .. (name, size, status, url) .. ]
627 if not type(result) == list: result = [result]
628
629 for res in result:
630 self.m.infoCache[res[3]] = res
631
632 cb(pluginname, result)
633
634 self.m.log.debug("Finished Info Fetching for %s" % pluginname)
635 except Exception, e:
636 self.m.log.warning(_("Info Fetching for %(name)s failed | %(err)s") %
637 {"name": pluginname, "err": str(e)})
638 if self.m.core.debug:
639 print_exc()
640
641 # generate default results
642 if err:
643 result = [(url, 0, 3, url) for url in urls]
644 cb(pluginname, result)
645
646
647 def decryptContainer(self, plugin, url):

Callers 1

runMethod · 0.95

Calls 3

getInfoMethod · 0.80
_Function · 0.50
appendMethod · 0.45

Tested by

no test coverage detected