From: Dan Scott Date: Tue, 29 Aug 2017 17:12:15 +0000 (-0400) Subject: Hack to support Oxford DOIs in 956 fields X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=3dae2cbb2912d2462c1de42404b978e58af0180b;p=contrib%2FConifer.git Hack to support Oxford DOIs in 956 fields ScholarsPortal MARC records put Oxford DOIs in their 956 fields instead of 856; let's use both of them and hope that no other records use a 956 that doesn't actually resolve. Also, if the URL is for books.scholarsportal.info, identify ScholarsPortal as the platform. Signed-off-by: Dan Scott --- diff --git a/tools/ebooks/prep_ebook_records.py b/tools/ebooks/prep_ebook_records.py index 22a2d30762..fc72b1fcab 100755 --- a/tools/ebooks/prep_ebook_records.py +++ b/tools/ebooks/prep_ebook_records.py @@ -290,7 +290,8 @@ def url_check(record, options): match = False match_id = 0 - for url in record.get_fields('856'): + # Oxford MARC files from ScholarsPortal have DOIs in 956(!) + for url in record.get_fields('856','956'): for urlval in url.get_subfields('u'): # print "urlval", urlval for library in options['libraries']: @@ -495,7 +496,8 @@ def process_fields(record, options): if 'clean' in options: field = clean_diacritics(field) # Process all of the 856 fields - if field.tag == '856': + # Oxford MARC files from ScholarsPortal have DOIs in 956(!) + if field.tag == '856' or field.tag == '956': new_fields = process_urls(field, options, publisher) if new_fields: for new_856 in new_fields: @@ -965,7 +967,11 @@ def process_urls(field, options, publisher): continue data = options['settings'].get_settings(lib) - subs = get_subfields(field, data, options['platform']) + + platform = options['platform'] + if field['u'].find('books.scholarsportal') > -1: + platform = 'ScholarsPortal' + subs = get_subfields(field, data, platform) eight_five_six = pymarc.Field(tag = '856', indicators = ['4', '0'], subfields = subs