From: Dan Scott Date: Fri, 12 Aug 2011 15:52:45 +0000 (-0400) Subject: Ensure fixed fields are correct and avoid bad public notes X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=18141e3c612bad085b93e548a614ac57e716c312;p=contrib%2FConifer.git Ensure fixed fields are correct and avoid bad public notes One more iteration based on the UWin team's set of feedback on the hopefully penultimate processing round for the CRKN records. Signed-off-by: Dan Scott --- diff --git a/tools/ebooks/prep_ebook_records.py b/tools/ebooks/prep_ebook_records.py index 242eea2bf4..80949de8f6 100644 --- a/tools/ebooks/prep_ebook_records.py +++ b/tools/ebooks/prep_ebook_records.py @@ -334,6 +334,12 @@ def process_fields(record, options): # Strip out 300 fields that only contain placeholders elif field.tag == '300' and field['a'] == 'p. cm.': pass + elif field.tag == '008' and field.value()[23] != 's': + fixed_field = pymarc.Field( + tag='008', + data=field.value()[:22] + 's' + field.value()[24:] + ) + new_record.add_field(fixed_field) else: new_record.add_field(field) @@ -867,7 +873,10 @@ def get_subfields(field, data): # Check for a $z as the first 856; in Springer records, at least, this # indicates a multi-volume set that requires keeping the $z around - if field.subfields[0] == 'z': + if field.subfields[0] == 'z' and ( + # However, we don't want to keep garbage-y public notes + not field.get_subfields('z')[0].startswith('Connect to MyiLibrary') + ): subs.extend([field.subfields[0], field.subfields[1]]) subs.extend([