fn_composers submodule

This module holds few functions used to dynamically construct filenames for files in SIP package.

API

Filenames are generated dynamically. Here is set of constructors for those filanames.

ltp.fn_composers._get_suffix(path)[source]

Return suffix from path.

/home/xex/somefile.txt –> txt.

Parameters:path (str) – Full file path.
Returns:Suffix.
Return type:str
Raises:UserWarning – When / is detected in suffix.
ltp.fn_composers.original_fn(book_id, ebook_fn)[source]

Construct original filename from book_id and ebook_fn.

Parameters:
  • book_id (int/str) – ID of the book, without special characters.
  • ebook_fn (str) – Original name of the ebook. Used to get suffix.
Returns:

Filename in format oc_nk-BOOKID.suffix.

Return type:

str

ltp.fn_composers.metadata_fn(book_id)[source]

Construct filename for metadata file.

Parameters:book_id (int/str) – ID of the book, without special characters.
Returns:Filename in format meds_nk-BOOKID.xml.
Return type:str
ltp.fn_composers.volume_fn(cnt)[source]

Construct filename for ‘volume’ metadata file.

Parameters:cnt (int) – Number of the MODS record.
Returns:Filename in format mods_volume.xml or mods_volume_cnt.xml.
Return type:str
ltp.fn_composers.checksum_fn(book_id)[source]

Construct filename for checksum file.

Parameters:book_id (int/str) – ID of the book, without special characters.
Returns:Filename in format MD5_BOOKID.md5.
Return type:str
ltp.fn_composers.info_fn(book_id)[source]

Construct filename for info.xml file.

Parameters:book_id (int/str) – ID of the book, without special characters.
Returns:Filename in format info_BOOKID.xml.
Return type:str

Table Of Contents

Previous topic

ltp.py

Next topic

xslt_transformer submodule

This Page