diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2016-12-28 14:08:52 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2016-12-28 14:08:52 +0100 |
commit | 117431b9511be07db8ce53526dbb985b5fad00a2 (patch) | |
tree | abd48f2fec45184c45995d163fc7940cfeb4d423 /trygvis/eda/cli/eda_rdf.py | |
parent | de8665b0b05db10c3257f9c645a09638a4732256 (diff) | |
download | eda-rdf-117431b9511be07db8ce53526dbb985b5fad00a2.tar.gz eda-rdf-117431b9511be07db8ce53526dbb985b5fad00a2.tar.bz2 eda-rdf-117431b9511be07db8ce53526dbb985b5fad00a2.tar.xz eda-rdf-117431b9511be07db8ce53526dbb985b5fad00a2.zip |
o Adding 'digikey-download-metadata' tool that downloads everything from Digi-Key. Should support writing directly to database.
Diffstat (limited to 'trygvis/eda/cli/eda_rdf.py')
-rw-r--r-- | trygvis/eda/cli/eda_rdf.py | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/trygvis/eda/cli/eda_rdf.py b/trygvis/eda/cli/eda_rdf.py index 33018ec..ecd4ba6 100644 --- a/trygvis/eda/cli/eda_rdf.py +++ b/trygvis/eda/cli/eda_rdf.py @@ -45,19 +45,7 @@ class KicadBomToTtl(CliCommand): args = p.parse_args(argv) from trygvis.eda.cli import kicad_bom_to_ttl - - if args.input is not None: - src = open(args.input, "r") - else: - src = sys.stdin - - if args.output is not None: - dst = open(args.output, "wb") - else: - dst = sys.stdout.buffer - - with src, dst: - kicad_bom_to_ttl.run(src, dst, args) + kicad_bom_to_ttl.run(args) class DigikeyDownloadForSchematic(CliCommand): @@ -73,6 +61,19 @@ class DigikeyDownloadForSchematic(CliCommand): digikey_download_for_schematic.run(args.schematic, args) +class DigikeyDownloadMetadata(CliCommand): + def __init__(self): + super().__init__("digikey-download-metadata", "Download category tree and attribute types and values from digikey.com") + + def run(self, argv): + p = argparse.ArgumentParser(prog=self.key, description=self.description) + p.add_argument("--output-dir", dest="output_dir", required=True) + args = p.parse_args(argv) + + from trygvis.eda.cli import digikey_download_metadata + digikey_download_metadata.run(args) + + class DigikeyDownloadAttributeTypesForCategory(CliCommand): def __init__(self): super().__init__("digikey-download-attribute-types-for-category", "Download the attribute types for a category from digikey.com") @@ -124,6 +125,7 @@ def main(): KicadBomToTtl(), DigikeyDownloadForSchematic(), DigikeyDownloadAttributeTypesForCategory(), + DigikeyDownloadMetadata() ] parser = argparse.ArgumentParser( |