All Downloads are FREE. Search and download functionalities are using the official Maven repository.

doc.scripts.FilesetRenamer.html Maven / Gradle / Ivy

The newest version!




	
	Pipeline Script: Fileset renamer
	


Pipeline Script: Fileset renamer

Overview

This script renames the members of a fileset (such as the files of a DTB). The renaming process can be customized by

  • Selecting a specific name pattern to apply (see Configuration)
  • Defining a set of file types (such images, SMIL files, etc ) that should be excluded from the renaming process.

The script is primarily written to support DTBs - other fileset types are not explicitly supported.

Input Requirements

The input fileset manifest file (NCC, OPF, etc)

Output

A fileset in which certain members have been renamed according to the configuration.

Configuration

Input file
Required. Select the input manifest file (NCC, OPF, etc)
Output directory
Required. Select the directory to store the result in. This directory can not be the same as the input directory, or the script will abort.
Renaming pattern
Optional. Renaming pattern to apply.

A renaming pattern consists of a sequence of tokens. A token is a symbol for a certain kind of information.

The following table defines the available tokens.

tokenmeaning
labelA label of the current file - typically corresponding to the first heading in the file. This cannot always be set.
uidA unique identifier from the fileset (such as a DTB) to which the file belongs. This can be values of dc:identifier or dtb:uid metadata.
seqRepresents the sequential position of this file within the presentation. If this is audio file 34 out of 100 audio files, the value will be '034'.
echoAn echo of the input filename.
fixedA fixed string. The string is expressed within parenthesis; fixed(the string)
rndA random string. The length of the string is expressed within parenthesis; rnd(2), where each increment will add 4 random characters to the name.

If a renaming pattern contains several tokens, they are separated by plus signs. Pattern examples:

seq+label
uid+seq
fixed(dtb)+seq
echo
uid+rnd(2)
uid+seq+label
File types to exclude
Optional. A comma separated list of file types to exclude from the renaming process.

The default is to exclude images, CSS files and XML files, which means that the default value is XmlFile, CssFile, ImageFile.

Names for file types that can be used in the exclude list are:
XmlFile, Xhtml10File, DtbookFile, OpfFile, SmilFile, ImageFile, JpgFile, BmpFile, PngFile, SvgFile, CssFile, AudioFile, Mp3File, Mp2File, WavFile.

Note that some file types infer others: if you add XmlFile to the exclude list, then all XML files will be excluded (Smil, Dtbook, Opf, Xhtml etc).

Use filesystem safe names
Optional. Use only the characters A-Z,a-z,0-9, hyphen and underscore in output filenames. Default is true.
Max filename length
Optional. The maximum number of characters in the output filename, excluding extension. Default is 60.

Appendix: List of Transformers used

The documents linked below are parts of the Transformer technical documentation. These are developer and systems-administrator centric documents.

  1. Fileset Renamer




© 2015 - 2025 Weber Informatics LLC | Privacy Policy