From 95228a4addbaa2d95f7090fca78366a355735e73 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Tue, 17 Apr 2018 14:11:15 -0400 Subject: [PATCH] Prefer RDA fields (33x) to GMD Strip out the GMD (245 $h) and add 336, 337, 338 fields that include our desired content, media, and carrier. These should probably be made optional as well, for example for different content types, or for records that are already RDA-compliant. Signed-off-by: Dan Scott --- tools/ebooks/prep_ebook_records.py | 43 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/tools/ebooks/prep_ebook_records.py b/tools/ebooks/prep_ebook_records.py index 33dea86f0b..6de5e7ad06 100755 --- a/tools/ebooks/prep_ebook_records.py +++ b/tools/ebooks/prep_ebook_records.py @@ -489,6 +489,7 @@ def process_fields(record, options): record.add_ordered_field(note) add_marc_source(record, options) # 598 + add_rda_fields(record, options) # 336,337,338 publisher = add_publisher(record, options) # 710 add_restriction(record, options, publisher) # 506 add_platform(record, options) # 710 @@ -526,6 +527,13 @@ def process_fields(record, options): data=field.value()[:23] + 's' + field.value()[24:] ) new_record.add_ordered_field(fixed_field) + # Strip out GMD + elif field.tag == '245': + if 'h' in field: + suffix = field['h'][-3:] + field.delete_subfield('h') + field['a'] = field['a'] + suffix + new_record.add_ordered_field(field) else: new_record.add_ordered_field(field) @@ -945,6 +953,41 @@ def add_cat_source(record, options): ) record.add_ordered_field(forty) +def add_rda_fields(record, options): + """ + Add 336,337,338 fields identifying the content as an ebook + """ + content = pymarc.Field(tag = '336', + indicators = [' ', ' '], + subfields = [ + 'a', 'text', + 'b', 'txt', + '2', 'rdacontent', + '0', 'http://id.loc.gov/vocabulary/contentTypes/txt' + ] + ) + media = pymarc.Field(tag = '337', + indicators = [' ', ' '], + subfields = [ + 'a', 'computer', + 'b', 'c', + '2', 'rdamedia', + '0', 'http://id.loc.gov/vocabulary/mediaTypes/c' + ] + ) + carrier = pymarc.Field(tag = '338', + indicators = [' ', ' '], + subfields = [ + 'a', 'online resource', + 'b', 'cr', + '2', 'rdacarrier', + '0', 'http://id.loc.gov/vocabulary/carriers/cr' + ] + ) + record.add_ordered_field(content) + record.add_ordered_field(media) + record.add_ordered_field(carrier) + def add_marc_source(record, options): """ Add a 598 field identifying the source MARC file name and processing date -- 2.11.0