From 523915feb090590e91a2acfd4b9ecd45c07a4f8a Mon Sep 17 00:00:00 2001 From: Cole Deck Date: Sat, 17 Feb 2024 20:31:43 -0600 Subject: [PATCH] add partnum to parsing --- get_specs.py | 4 ++-- read_datasheet.py | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/get_specs.py b/get_specs.py index 419421b..83fcfc5 100755 --- a/get_specs.py +++ b/get_specs.py @@ -157,7 +157,7 @@ def get_multi(partnums): bar(skipped=True) fprint("Parsing Datasheet contents of " + partnum) bar.text = "Parsing Datasheet contents of " + partnum + ".pdf..." - read_datasheet.parse(path, output_dir) + read_datasheet.parse(path, output_dir, partnum) bar(skipped=False) def __downloaded_datasheet(partnum, path, output_dir): @@ -166,7 +166,7 @@ def get_multi(partnums): bar(skipped=False) fprint("Parsing Datasheet contents of " + partnum) bar.text = "Parsing Datasheet contents of " + partnum + ".pdf..." - read_datasheet.parse(path, output_dir) + read_datasheet.parse(path, output_dir, partnum) bar(skipped=False) for partnum in partnums: diff --git a/read_datasheet.py b/read_datasheet.py index a919f8d..13d0bfb 100755 --- a/read_datasheet.py +++ b/read_datasheet.py @@ -10,7 +10,7 @@ import io import json from util import fprint -def parse(filename, output_dir): +def parse(filename, output_dir, partnum): # Extract table data @@ -165,6 +165,10 @@ def parse(filename, output_dir): fprint(tables) + + # summary + + tables["partnum"] = partnum with open(output_dir + "/tables.json", 'w') as json_file: json.dump(tables, json_file) @@ -177,4 +181,4 @@ def parse(filename, output_dir): if __name__ == "__main__": - parse("test2.pdf", "10GXS13") \ No newline at end of file + parse("test2.pdf", "cables/10GXS13", "10GXS13") \ No newline at end of file