# 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. #BASIC config #What is the full path to the root directory of your zcc config files? #(Previously this would have been something like /home/jason/.zcc) # Leave off the trailing slash / root: /home/[put your username here]/.zcc #What is the maximum number of records you want to show from each target? to_show: 40 #What is the maximum number of records you want to show on each menu page? show_per_page: 5 #Which field numbers would you like to show in the menu page? fields_to_show: [245, 260, 300] # Do you want to save your MARC files by 'search_term' or by 'timestamp'? Choosing timestamp # will save all records from a single session to the same file, while search_term will save to # separate files for each different search term used. save_filename: timestamp #Do you want scripting turned on? scripting_on: yes #Do you want subfield editing turned on? subfield_editing: yes #Do you want full record editing turned on? full_editing: yes #What editor do you want to use? Vim is suggested. Make sure to use UTF-8 character encoding!! text_editor: vim #Do you want CSV file creation turned on? csv_on: yes #Do you want to use the optional MARC linter? Perl and the MARC::Lint module are necessary for the functionality to work. linter_on: yes #How do you want your records saved? Current choices are [marc, xml, zebra] #'marc' means ISO2709, marc transmission format, not human readable #'xml' currently means marcxml #'zebra' means marc IS02709 saved to the directory of the zebra database by timestamp. # STILL TO BE IMPLEMENTED: 'koha' save directly to a koha installation using bulkmarcimport.pl # for 'zebra' a copy is also saved to the working directory. #See for more information on setting up zebra: http://zcc.rubyforge.org/zebra.html save_record_syntax: [marc, zebra] #start the zcc local zebra server on startup of zcc? #If a zebra server is already running on port 9998 this will fail start_zebra: yes #try to shutdown the zcc local zebra server on exit of zcc? kill_zebra: yes ########################### # 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 #- [Include zservers.yaml] #Optionally you can Include another file within your root directory (see "root" configuration above) that contains a list of zservers. Only include the entries in the same for as the ones below. This option must be the first line for this feature to work correctly. - [localhost, 9998, zcc, 0] #if you use the zcc zebra server setup - [z3950.loc.gov, 7090, Voyager, 1 ] # Library of Congress - [es33.uits.indiana.edu, 2200, Unicorn, 2] #IU - [bobcat.nyu.edu, 210, ADVANCE, 2] #New York University Libraries | 98% - [128.197.130.200, 210, INNOPAC, 2] #Boston U. | 100% #- [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] #- [webcat.lib.okayama-u.ac.jp, 2210, limedio ] #utf8 records by default ####################################################### # CSV files # Follows is the template for creating csv files. # Saving information to a csv file might be useful for printing 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. Scripts under 'start' will # be run before every script. Scripts under 'end' will # be run after chosen script is run. So for instance if you process # the record with the 'non_fiction' script the following scripts # will be run in order: start, non_fiction, end. # Start and end of optional. ################################################# scripting: start: - [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, 942, c, BOOK] end: - [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. non_fiction: - [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 get_cutter] #comment out for BIO biography: - [append-subfield, 952, c, BIO] # BIO, Fic - [append-subfield, 942, l, proc prompt_cutter] #BIO #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # 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 "The final cutter: |#{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 "Skipping CIP call number." 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("#{ROOT}/test-zoomer-iterator.txt", "r").gets else iterator = File.new("#{ROOT}/zoomer-iterator.txt", "r").gets end #iterator = File.new("test-zoomer-iterator.txt").gets if $testing == 't' puts "iterator: #{iterator}" iterator = iterator.chomp barcode = "MRML-%05d" % iterator new_iterator = iterator.to_i + 1 File.open("#{ROOT}/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))