(Note: If you are reading this on Github, you can find the original Fossil repository here).
This repository contains scripts to manipulate MARC records, which I wrote to help convert a Mandarin-hosted library catalog to a Koha-hosted catalog. There are also a few related scripts that do not deal with MARC records, and two Koha plugins.
All of the scripts are written in Ruby. Some of them use the 'marc' Ruby gem, so you'll need to install that first.
To clone this repository:
fossil clone https://www.bloovis.com/fossil/home/marka/fossils/marc
m2k.rb
This script converts a MARC catalog exported by Mandarin into a form that we can use in Koha. There's a bunch of library-specific logic to convert holding record information; you'll need to change this logic for your library. The script also converts the MARC-8 character encoding to UTF-8.
printmarc.rb
This script prints a MARC catalog (UTF-8 encoded) in human readable format. It prints a subset of the fields, mainly those related to holdings.
printraw.rb
This script prints a MARC catalog in a more raw format, with no interpretation.
splitmarc.rb
This script splits a MARC catalog into smaller chunks. This is useful when importing a catalog into Koha, because large catalogs can cause Koha to use all of available memory and abort. A size of 2000 records works for a Koha installation that has 2 GB of RAM.
patroncsv.rb
This script converts a Mandarin patron list in MARC format to a CSV file that can be imported into Koha. There are a couple of library-specific variables at the top of the script that you'll need to change.
diffmarc.rb
This script compares two Mandarin-generated catalogs in MARC format, one old and one new, and outputs a third MARC catalog contain just those records that are found in the new catalog but not the old catalog.
pdf2koc.rb
This script reads a PDF of the "loan list by patron" report generated by the Mandarin report generator, and creates a KOC (Koha Offline Circulation) file that can be uploaded to Koha. This is useful for transferring checkout information from Mandarin to Koha.
marc2yaml.rb
This script reads a MARC file and outputs it in YAML format. If you redirect the output to a file, you can edit the file and then convert it back to MARC with yaml2marc.rb.
yaml2marc.rb
This script reads a YAML file that was previously created with marc2yaml.rb, and converts it back to MARC.
text2marc.rb
This script reads a file containing a textual representation of a MARC record, as described here:
https://www.loc.gov/marc/makrbrkr.html
and converts it to MARC.
Koha plugins
The two Koha plugins are found in the koha-plugins
directory. They
are:
- Html2marc.pm - a plugin to convert HTML to MARC when importing MARC
records. This requires that the
html2marc.rb
script be copied to/usr/local/bin
. - Sip2patron.pm - a plugin that provides SIP2 validation for GMLC (Overdrive),
Kanopy, and Mango Languages. This requires that the patch
SIP-plugin.patch
be copied to/usr/share/koha/lib
and be applied usingpatch -p0 <SIP-plugin.patch
.