Skip to content

Merge EPUB Resource Caption and Alternative Text with Resource Metadata

Timothy W Belch edited this page Apr 14, 2020 · 5 revisions

Merge EPUB Resource Caption and Alternative Text with Resource Metadata

This monograph processing step can be completed by using the following project script:

bundle exec ruby script/update_fmsl [-map] [-nofmsl] monograph_dir [monograph_dir...]
monograph_dir
Name of the monograph directory found on the publisher share drive.
-map
Forced generation of the monograph resource map. Otherwise, if a map exists, it will be used.
-nofmsl
Do not update the monograph FMSL file.

The script will perform the following:

  1. Locate the monograph resource metadata file (METADATA_CSV=<monograph_dir>/resources/<ebook_isbn>_<author>.csv).

  2. Locate the monograph EPUB file (EPUB_FILE=<monograph_dir>/<ebook_isbn>_<author>.epub).

  3. Scan EPUB_FILE and determine a mapping from each resource reference to a resource file. This information is saved in the file RESOURCE_MAP=<monograph_dir>/resource_processing/resource_map.xml.

    NOTE: Currently, a CSV version of RESOURCE_MAP is saved as well, but this file is deprecated.

  4. Scan EPUB_FILE and extract the resource caption and alternative text. Load the METADATA_CSV and for each resource, merge the caption and alternative text. Save the modified resource metadata in the file NEW_METADATA_CSV=<monograph_dir>/resource_processing/<ebook_isbn>_<author>.csv.

After successful completion of the script, perform the following manual steps:

  1. Copy METADATA_CSV to the <monograph_dir>/Archive directory.

  2. Replace METADATA_CSV with NEW_METADATA_CSV within the <monograph_dir>/resources directory.