Skip to content

Commit

Permalink
fixed handling of multiple 945s
Browse files Browse the repository at this point in the history
  • Loading branch information
klinga committed Mar 18, 2024
1 parent cc1ce01 commit 1247980
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions google_books/hathi_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,20 @@ def clean_metadata_for_hathi_submission(

bibs2keep = []
for bib in bibs:
barcode = bib.get("945").get("i").strip()
if barcode not in rejected_barcodes:
bibs2keep.append(bib)
# print(bib)
for field in bib.get_fields("945"):
try:
barcode = field.get("i").strip()
if barcode not in rejected_barcodes:
bibs2keep.append(bib)
except AttributeError:
continue

save2marcxml(out, bibs2keep)


if __name__ == "__main__":
import sys

print(sys.argv[1])
# print(sys.argv[1])
clean_metadata_for_hathi_submission(sys.argv[1], sys.argv[2], sys.argv[3])

0 comments on commit 1247980

Please sign in to comment.