diff options
Diffstat (limited to 'python/ia_pdf_match.py')
-rwxr-xr-x | python/ia_pdf_match.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/python/ia_pdf_match.py b/python/ia_pdf_match.py index 137110c..c3d9c16 100755 --- a/python/ia_pdf_match.py +++ b/python/ia_pdf_match.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 - """ Input is IA item metadata JSON. Ouput is insertable fatcat "match" JSON @@ -81,21 +80,23 @@ def parse(obj): 'size': int(pdf_file['size']), 'mimetype': 'application/pdf', 'urls': [ - "https://archive.org/download/{}/{}".format( - obj['metadata']['identifier'], - pdf_file['name']), + "https://archive.org/download/{}/{}".format(obj['metadata']['identifier'], + pdf_file['name']), ], 'cdx': [], 'dois': [], } if extid_type == 'doi': - match['dois'] = [extid,] + match['dois'] = [ + extid, + ] else: match[extid_type] = extid return match + def run(): for line in sys.stdin: if not line: @@ -105,5 +106,6 @@ def run(): if match: print(json.dumps(match, sort_keys=True)) + if __name__ == '__main__': run() |