Commit 9eb4fd32 authored by Lukas Jelonek's avatar Lukas Jelonek
Browse files

Rewrite of prepare, list_recipes, list_local_databases, remove and card...

Rewrite of prepare, list_recipes, list_local_databases, remove and card download script\nOther commands will follow
parent 1996f4bd
import wget
import tarfile
import json
import datetime
import logging
def download(url):"Downloading " + url)
filename =
print("") # wget does not add a newline to its download bar
return filename
def extract(filename):"Extracting " + filename)
with, 'r') as tar:
def create_metadata(name,
metadata = {
'name': name,
'tool': tool,
'description': description,
'creation_date': creation_date,
'version': version
with open("metadata.json", "w") as metadata_file:"Writing metadata " + json.dumps(metadata))
json.dump(metadata, metadata_file)
This diff is collapsed.
#!/usr/bin/env python3
import dbman.helper as h
import json
import logging
dbname = "card"
dbdescription = "The Comprehensive Antibiotic Resistance Database"
url = ""
# the card version is either available on the homepage or inside the card.json file
# here we use the card.json file
def lookup_card_version():
with open("card.json") as card:
data = json.load(card)
version = data["_version"]
return version
# download archive
fn =
# extract archive
# detect version
version = lookup_card_version()
# write metadata file
h.create_metadata(dbname, "download", dbdescription, version=version)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment