# ZOOMER CONFIG FILE # This is in YAML format # Configure this file if you want: # 1. to search multiple Z39.50 servers # 2. the added functionality of scripting # 3. creation of csv files. # See below in each section for more information. ########################### # Z39.50 servers # Place zservers in the order of your preferences for records. # The current zservers are preceded with a minus sign and a space. # Each server is enclosed in brackets and values are separated by commas. # Columns and tabs are not important and are only done for readability. # For a list of other servers see: http://targettest.indexdata.com/ # ########################## zservers: # server port service # [128.148.19.6, 210, INNOPAC ] #bad server, for testing #-[81.144.245.7, 210, INNOPAC] #wellcome.ac.uk latin1 charset #- [142.51.8.7, 2200, unicorn] - [z3950.loc.gov, 7090, Voyager ] # Library of Congress # [bobcat.nyu.edu, 210, ADVANCE] #New York University Libraries | 98% # [128.197.130.200, 210, INNOPAC] #Boston U. | 100% ####################################################### # CSV files # Follows is the template for creating csv files. # Saving information to a csv file might be useful for print labels in # a program like glabels or for statistics. ####################################################### labels: - [245, a, 30] - [1XX, a, 30] - [952, c] - [942, k] - [942, j] - [942, l] - [952, m] - [952, t] - [952, p] ################################################# # Scripting # Scripting allows you to change the record before saving it. # Below is where you make changes to the scripting # that will be run on each record. This feature is # turned on in the main script with the value of the # constant SCRIPTING at the head of the file. ################################################# scripting: - [remove, 9XX] - [create-field, 942, " ", " "] #create new field with empty indicators - [create-field, 952, " ", " "] - [append-subfield, 952, 2, DLC] - [append-subfield, 952, b, MRML] #- [append-subfield, 952, c, BIO] # BIO, Fic - [append-subfield, 942, c, BOOK] - [append-subfield, 942, k, proc get_dewey] # "proc name" is the way to get # the script to evaluate a block # of code. See below. comment out for BIO - [append-subfield, 942, j, proc get_decimal] #comment out for BIO #- [append-subfield, 942, l, proc prompt_cutter] #BIO - [append-subfield, 942, l, proc get_cutter] #comment out for BIO - [append-subfield, 952, k, proc get_combined_callnum] - [prompt, 942, x, IS THERE A CIP] - [append-subfield, 942, y, proc get_cip_callnum] - [prompt, 942, z, OLD CALL NUMBER] - [prompt, 952, z, PUBLIC NOTE FOR ITEM] - [prompt, 952, x, INTERNAL NOTE] - [proc barcode_and_itemnum] # [sort-tags] #This currently doesn't work. #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # This is where the procs go for added scripting power. # If you know some Ruby you can try to create one of these. # If the block of code is placed in the last position, # the last value evaluated will be returned and entered in the field. # If the block of code is the only value within barckets, # then you need to do the work yourself. For instance, if you want # to create a field you need to do that yourself. # The word variable record refers to the record the script is # being run on. # All blocks of code below must begin the this way: # 1. Indent. # 2. Name of the block exactly as you enter it above. # 3. Colon, space, pipe. # 4. The block of code starts on the next line with two indentations. # 5. The block of code ends with a line between it and the next #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! procs: prompt_cutter: | print "What do you want the cutter to be?" cutter = STDIN.gets.chomp cutter get_dewey: | puts "in the get dewey proc" if $testing if record['082'] dewey = record['082']['a'] callnum = dewey.gsub(/\//, '') callnum = callnum.split(/\./) callnum[0] else print "What is the dewey (just the part before the decimal!)? " dewey = STDIN.gets.chomp dewey end get_decimal: | puts "in the get decimal proc" if $testing if record['082'] dewey = record['082']['a'] dewey = dewey.gsub(/\//, '') puts "dewey: #{dewey} #{dewey.class}" if $testing puts "#{record['082']['a']}" #STDIN.gets if $testing #exit decimal = dewey.split(/\./) next if decimal[1] == nil decimal = decimal[1].slice(0, 3) decimal = decimal.gsub(/[0]+$/, '') decimal = "." + decimal #puts decimal decimal = nil if decimal == '.' #puts decimal decimal else print "What is the decimal (leaving off the decimal point!)? " decimal = STDIN.gets.chomp decimal = "." + decimal decimal = nil if decimal == '.' decimal end get_cutter: | #puts "|" , record , "|" #puts "in the cutter proc" if (record['952']) and (record['952']['c'] == ('BIO' or 'F')) print "This is a |#{record['952']['c']}|, so choose your cutter accordingly: " cutter = STDIN.gets.chomp cutter.upcase! return cutter elsif record['100'] cutter = record['100']['a'].dup elsif record['110'] cutter = record['110']['a'].dup elsif record['111'] cutter = record['111']['a'].dup elsif record['130'] cutter = record['130']['a'].dup elsif record['245'].indicator1 == '0' cutter = record['245']['a'] i = record['245'].indicator2.to_i cutter = cutter[i,99] else print "What is the cutter for this book? " cutter = STDIN.gets.chomp end #puts cutter #puts cutter.length #puts cutter.jlength #STDIN.gets #puts cutter.usubstr(0, 3) #STDIN.gets if cutter.length == cutter.jlength cutter = cutter[0,4] #puts "cutter after slice", cutter cutter.gsub!("'", '') cutter.gsub!(" ", '') cutter = cutter[0,3] else puts "This cutter appears to have multi-byte characters." print "What is the cutter for this book? " cutter = STDIN.gets.chomp end cutter.upcase! puts "|#{cutter}|" puts cutter.jlength cutter get_cip_callnum: | if record['942']['x'] == 'y' print "What is the CIP call number? " cipcall = STDIN.gets.chomp cipcall else puts "value is nil" end get_combined_callnum: | #puts "into get_combined_callnum" #puts record #puts "**942 #{record['942']}" #puts "**942k #{record['942']['k']}" combined_callnum = record['942']['k'] if record['942']['k'] combined_callnum = combined_callnum + record['942']['j'] if record['942']['j'] if record['942']['k'] combined_callnum = combined_callnum.to_s + " " + record['942']['l'] else combined_callnum = record['942']['l'] end barcode_and_itemnum: | puts "BARCODE AND ITEMNUM!!!\a" if $testing #STDIN.gets #Dir.chdir("..") if Dir.pwd.include?('zoomer/saved') #puts Dir.pwd if $testing == 't' iterator = File.new("~/.zcc/test-zoomer-iterator.txt", "r").gets else iterator = File.new("#{File.expand_path("~")}/.zcc/zoomer-iterator.txt", "r").gets end #iterator = File.new("test-zoomer-iterator.txt").gets if $testing == 't' puts iterator iterator = iterator.chomp barcode = "MRML-%05d" % iterator new_iterator = iterator.to_i + 1 File.open("#{File.expand_path("~")}/.zcc/zoomer-iterator.txt", "w+") do |myfile| myfile.write(new_iterator) unless $testing == 't' end record['952'].append(MARC::Subfield.new('p', barcode)) record['952'].append(MARC::Subfield.new('u', iterator))