From: Dan Scott Date: Sat, 12 Nov 2011 01:59:00 +0000 (-0500) Subject: Ebrary CEL: Work towards ebook requirements X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=90f8234102fc760d724aaa46719242feb2950999;p=contrib%2FConifer.git Ebrary CEL: Work towards ebook requirements Of most importance, copy the incoming 001 value identifying the Ebrary record into the 924 for use in SFX lookups. Signed-off-by: Dan Scott --- diff --git a/tools/ebooks/prep_ebook_records.py b/tools/ebooks/prep_ebook_records.py index bc6ceeab03..99f54f10bb 100644 --- a/tools/ebooks/prep_ebook_records.py +++ b/tools/ebooks/prep_ebook_records.py @@ -96,6 +96,8 @@ Required arguments: -o / --output : The name of the output MARC file. + -e / --ebrary-id : Put Ebrary 001 into 924 as a URN for SFX lookup purposes + -a / --authorization: The name of the online platorm to be inserted in each 506$e access restriction note. @@ -141,6 +143,8 @@ def consolidate_options(opts): _options['--authorization'] = val elif key == '-c': _options['--consortium'] = val + elif key == '-e': + _options['--ebrary-id'] = val elif key == '-p': _options['--publisher'] = val elif key == '-P': @@ -262,10 +266,10 @@ def check_libraries(options): def parse_opts(): """Get command-line arguments from the script""" try: - _short_opts = 'i:o:a:c:p:ALWn:P:s:h' + _short_opts = 'i:o:a:c:p:ALWne:P:s:h' _long_opts = ['input=', 'output=', 'authorization=', 'consortium=', 'publisher=', 'algoma', 'laurentian', 'windsor', 'note=', - 'platform=', 'sample=', 'help' + 'platform=', 'sample=', 'ebrary-id', 'help' ] opts = getopt.getopt(sys.argv[1:], _short_opts, _long_opts) except getopt.GetoptError, ex: @@ -596,6 +600,20 @@ def mark_isbn_for_sfx(record, options): # Add the $9 subfield to mark this as a good one isbn.add_subfield('9', 'SFX') return True + + # For ebrary records, add a 924 for the custom URN + if options['ebrary-id'] is True: + for scn in record.get_field('001'): + urn = pymarc.Field(tag = '924', + indicators = ['8', ' '], + subfields = [ + 'a', 'urn:ebrary:' + scn.value(), + '9', 'SFX' + ] + ) + + record.add_field(urn) + return False def check_for_isbn(options, lib, isbnval):