| 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)) |