Ensure fixed fields are correct and avoid bad public notes
authorDan Scott <dan@coffeecode.net>
Fri, 12 Aug 2011 15:52:45 +0000 (11:52 -0400)
committerDan Scott <dscott@laurentian.ca>
Tue, 7 May 2013 18:37:23 +0000 (14:37 -0400)
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 <dscott@laurentian.ca>
tools/ebooks/prep_ebook_records.py

index 242eea2..80949de 100644 (file)
@@ -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([