toktokkie.metadata.book package

Submodules

toktokkie.metadata.book.Book module

class toktokkie.metadata.book.Book.Book(directory_path: str, json_data: Optional[Dict[str, Any]] = None, no_validation: bool = False)

Bases: toktokkie.metadata.base.Metadata.Metadata, toktokkie.metadata.book.BookRenamer.BookRenamer, toktokkie.metadata.book.BookPrompter.BookPrompter, toktokkie.metadata.book.BookValidator.BookValidator

Metadata class that handles books

directory_path: str

The path to the directory this metadata describes

json: Dict[str, Any]
classmethod media_type()toktokkie.enums.MediaType
Returns

The Book media type

classmethod valid_id_types() → List[toktokkie.enums.IdType]
Returns

A list of valid ID types

toktokkie.metadata.book.BookExtras module

class toktokkie.metadata.book.BookExtras.BookExtras

Bases: toktokkie.metadata.base.MetadataBase.MetadataBase, abc.ABC

Additional methods and attributes for book metadata objects

property book_path
Returns

The path to the book file

directory_path: str

The path to the directory this metadata describes

json: Dict[str, Any]

toktokkie.metadata.book.BookPrompter module

class toktokkie.metadata.book.BookPrompter.BookPrompter

Bases: toktokkie.metadata.base.Prompter.Prompter, toktokkie.metadata.book.BookExtras.BookExtras, abc.ABC

Implements the Prompter functionality for book metadata

directory_path: str

The path to the directory this metadata describes

json: Dict[str, Any]
classmethod pre_prompt_check(directory_path: str)

Makes sure that the book directory has exactly one book file :param directory_path: The path to the directory to check :return: None

toktokkie.metadata.book.BookRenamer module

class toktokkie.metadata.book.BookRenamer.BookRenamer

Bases: toktokkie.metadata.base.Renamer.Renamer, toktokkie.metadata.book.BookExtras.BookExtras, abc.ABC

Implements the Renamer functionality for book metadata

create_rename_operations() → List[toktokkie.metadata.base.components.RenameOperation.RenameOperation]

Creates renaming operations for book metadata :return: The renaming operations

directory_path: str

The path to the directory this metadata describes

json: Dict[str, Any]
resolve_title_name() → str

If possible, will fetch the appropriate name for the metadata based on IDs, falling back to the directory name if this is not possible or supported.

toktokkie.metadata.book.BookValidator module

class toktokkie.metadata.book.BookValidator.BookValidator

Bases: toktokkie.metadata.base.Validator.Validator, toktokkie.metadata.book.BookExtras.BookExtras, abc.ABC

Implements the Validator functionality for book metadata

directory_path: str

The path to the directory this metadata describes

json: Dict[str, Any]
validate()

Ensures that book files exist :return: None

Module contents