ltp.py¶
This module contains functions to create SIP package for the LTP system.
API¶
-
ltp.ltp.
_get_package_name
(prefix='/tmp', book_id=None)[source]¶ Return package path. Use uuid to generate package’s directory name.
Parameters: - book_id (str, default None) – UUID of the book.
- prefix (str, default settings.TEMP_DIR) – Where the package will be
stored. Default
settings.TEMP_DIR
.
Returns: Path to the root directory.
Return type:
-
ltp.ltp.
_create_package_hierarchy
(prefix='/tmp', book_id=None)[source]¶ Create hierarchy of directories, at it is required in specification.
root_dir is root of the package generated using
settings.TEMP_DIR
and_get_package_name()
.orig_dir is path to the directory, where the data files are stored.
metadata_dir is path to the directory with MODS metadata.
Parameters: - book_id (str, default None) – UUID of the book.
- prefix (str, default settings.TEMP_DIR) – Where the package will be
stored. Default
settings.TEMP_DIR
.
Warning
If the root_dir exists, it is REMOVED!
Returns: root_dir, orig_dir, metadata_dir Return type: list of str