Esempio n. 1
0
    def initialize(self):
        """ Do initializations per project """

        # Url thread group class for multithreaded downloads
        if self._cfg.usethreads:
            self._urlThreadPool = HarvestManUrlThreadPool()
            self._urlThreadPool.spawn_threads()
        else:
            self._urlThreadPool = None

        # URL database, a BST with disk-caching
        self._urldb = BST()
        # Collections database, a BST with disk-caching
        self.collections = BST()
        # For testing, don't set this otherwise we might
        # be left with many orphaned .bidx... folders!
        if not self._cfg.testing:
            self._urldb.set_auto(2)
            self.collections.set_auto(2)

        # Load any mirrors
        self.mirrormgr.load_mirrors(self._cfg.mirrorfile)
        # Set mirror search flag
        self.mirrormgr.mirrorsearch = self._cfg.mirrorsearch