-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.
_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':
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:
# 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):