MCPcopy
hub / github.com/HelloZeroNet/ZeroNet / download

Method download

src/Site/Site.py:311–331  ·  view source on GitHub ↗
(self, check_size=False, blind_includes=False)

Source from the content-addressed store, hash-verified

309 # Download all files of the site
310 @util.Noparallel(blocking=False)
311 def download(self, check_size=False, blind_includes=False):
312 if not self.connection_server:
313 self.log.debug("No connection server found, skipping download")
314 return False
315
316 self.log.debug(
317 "Start downloading, bad_files: %s, check_size: %s, blind_includes: %s" %
318 (self.bad_files, check_size, blind_includes)
319 )
320 gevent.spawn(self.announce, force=True)
321 if check_size: # Check the size first
322 valid = self.downloadContent("content.json", download_files=False) # Just download content.json files
323 if not valid:
324 return False # Cant download content.jsons or size is not fits
325
326 # Download everything
327 valid = self.downloadContent("content.json", check_modifications=blind_includes)
328
329 self.onComplete.once(lambda: self.retryBadFiles(force=True))
330
331 return valid
332
333 def pooledDownloadContent(self, inner_paths, pool_size=100, only_if_bad=False):
334 self.log.debug("New downloadContent pool: len: %s, only if bad: %s" % (len(inner_paths), only_if_bad))

Callers 15

needMethod · 0.95
actionSiteSetLimitMethod · 0.80
testRenameMethod · 0.80
testRenameOptionalMethod · 0.80
testArchivedDownloadMethod · 0.80
testOptionalDownloadMethod · 0.80
testFindOptionalMethod · 0.80
testUpdateMethod · 0.80
testBigUpdateMethod · 0.80
testOpenBigfileMethod · 0.80

Calls 3

downloadContentMethod · 0.95
retryBadFilesMethod · 0.95
onceMethod · 0.80

Tested by 15

testRenameMethod · 0.64
testRenameOptionalMethod · 0.64
testArchivedDownloadMethod · 0.64
testOptionalDownloadMethod · 0.64
testFindOptionalMethod · 0.64
testUpdateMethod · 0.64
testBigUpdateMethod · 0.64
testOpenBigfileMethod · 0.64
testFileGetMethod · 0.64
testDownloadStatsMethod · 0.64