Skip to content

Process EPUB Resource References

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

Process EPUB Resource References

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

bundle exec ruby script/process_monograph [-e] [-p <publisher_directory>] <action> <monograph_noid> [<monograph_noid>...]
action
Specified default resource action, either embed_resources|link_resources. The action for each resource is assigned in the monograph resource_map.xml file.
-e
Execute the specified resource actions. Otherwise, actions are identified and displayed, but not executed.
publisher_directory
Directory that contains a specific publisher monographs.
monograph_noid
Monograph NOID

The script will perform the following:

  1. Download the manifest for the specified monograph NOID.

  2. Use the monograph manifest to locate the monograph directory (MONOGRAPH_DIR=FULCRUM_DRIVE/<publisher>/<ebook_isbn>_<author_last_name>) found in the publisher directory which is specified either by the -p <publisher_directory> option, or by the current working directory.

  3. Locate the monograph EPUB file (EPUB_FILE=MONOGRAPH_DIR/<ebook_isbn>_<author_last_name>.epub.

  4. Assign an action for each resource, either embed a resource viewer or insert a link to the Fulcrum resource page. This is determined by the monograph MONOGRAPH_DIR/resource_processing/resource_map.xml with the default action determined by the command line argument action, either embed_resources or link_resources.

  5. Scan EPUB_FILE and for each resource reference encountered, report the action assigned. If the -e option has been specified, then execute the action and save the file in the MONOGRAPH_DIR/resource_processing/epub directory.

  6. Create a new EPUB file (NEW_EPUB_FILE=MONOGRAPH_DIR/resource_processing/<ebook_isbn>_<author_last_name>.epub) that is a copy of the original except for replacing any modified files with the ones found in the MONOGRAPH_DIR/resource_processing/epub directory.

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

  1. The original EPUB_FILE file can be copied to the MONOGRAPH_DIR/Archive directory.

  2. The new NEW_EPUB_FILE file can be moved into the MONOGRAPH_DIR. Overnight, this file will be uploaded to Fulcrum, replacing the existing monograph EPUB representative.