From 9ba1556a1aa35d85e1670af57c6992e8c65f2824 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Fri, 12 Aug 2011 11:52:45 -0400 Subject: [PATCH] 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 --- tools/ebooks/prep_ebook_records.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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([ -- 2.11.0