예제 #1
0
    def _download(self):
        self.log.info('Downloading %s' % self.name)
        download_release = True
        rc = 1
        if self.deploy_type == 'repository':
            download_release = False

        if download_release:
            rc = util.download_file(self.release_location,
                                    self.tmp_dir,
                                    self.release_file_name)
        else:
            if self.local_repository:
                # Copy local repository into tmp_dir.
                rc = util.copytree(self.repository_location,
                                   os.path.join(self.tmp_dir,
                                                self.repository_local_name))
            else:
                if self.repository_type == 'svn':
                    rc = util.svn_checkout(self.repository_location,
                                           self.tmp_dir,
                                           self.repository_local_name,
                                           self.repository_options)
                elif self.repository_type == 'git':
                    rc = util.git_clone(self.repository_location,
                                        self.tmp_dir,
                                        self.repository_local_name,
                                        self.repository_options)

        return rc
예제 #2
0
    def _download(self):
        self.log.info('Downloading %s' % self.name)
        download_release = True
        rc = 1
        if self.deploy_type == 'repository':
            download_release = False

        if download_release:
            rc = util.download_file(self.release_location, self.tmp_dir,
                                    self.release_file_name)
        else:
            if self.local_repository:
                # Copy local repository into tmp_dir.
                rc = util.copytree(
                    self.repository_location,
                    os.path.join(self.tmp_dir, self.repository_local_name))
            else:
                if self.repository_type == 'svn':
                    rc = util.svn_checkout(self.repository_location,
                                           self.tmp_dir,
                                           self.repository_local_name,
                                           self.repository_options)
                elif self.repository_type == 'git':
                    rc = util.git_clone(self.repository_location, self.tmp_dir,
                                        self.repository_local_name,
                                        self.repository_options)

        return rc
예제 #3
0
 def _download(self):
     self.log.info('Downloading %s' % self.name)
     rc = util.download_file(self.remote_file,
                             self.base_deploy_dir,
                             self.local_file)
     return rc
예제 #4
0
 def _download(self):
     self.log.info('Downloading %s' % self.name)
     rc = util.download_file(self.remote_file, self.base_deploy_dir,
                             self.local_file)
     return rc
예제 #5
0
        ]
        links = [
            urllib.parse.urljoin(end_url, x) + '?javascript-disabled=true'
            for x in links
        ]

        book_title = p.title[0].split(' |')[0]
        book_path = os.path.join(dl_path, book_title)
        os.makedirs(book_path, exist_ok=True)

        if 'epub' in links[1]:
            links = links[:2]
        else:
            links = links[:1]

        for link in links:
            filename = '%s - %s' % (book_title, isbn) + os.path.splitext(
                urllib.parse.urlparse(link).path)[-1]
            filepath = os.path.join(book_path, filename)
            if os.path.exists(filepath):
                continue
            try:
                print('[+] %s' % filename)
                download_file(link, HEADERS, filepath)
            except KeyboardInterrupt:
                if os.path.exists(filepath):
                    os.remove(filepath)
                sys.exit()
            except:
                print('[x] error downloading %s, skipping...' % filename)