INNER CODE UNIT · Python
download_file_job
kblin/ncbi-genome-download · ncbi_genome_download/core.py:637
def download_file_job(entry, directory, checksums, filetype='genbank', symlink_path=None):
"""Generate a DownloadJob that actually triggers a file download."""
pattern = NgdConfig.get_fileending(filetype)
filename, expected_checksum = get_name_and_checksum(checksums, pattern)
base_url = convert_ftp_url(entry['ftp_path'])
full_url = '{}/{}'.format(base_url, filename)
local_file = os.path.join(directory, filename)
full_symlink = None
if symlink_path is not None:
full_symlink = os.path.join(symlink_path, filename)
return DownloadJob(full_url, local_file, expected_checksum, full_symlink)
# pylint: enable=too-many-arguments,too-many-locals
def create_symlink_job(directory, checksums, filetype, symlink_path):
"""Create a symlink-creating DownloadJob for an already downloaded file."""
pattern = NgdConfig.get_fileending(filetype)