toktokkie package

Subpackages

Submodules

toktokkie.Directory module

class toktokkie.Directory.Directory(path: str, no_validation: bool = False)

Bases: object

Class that encapsulates all of toktokkie’s functionality

__init__(path: str, no_validation: bool = False)

Initializes the metadata of the directory :param path: The directory’s path :param no_validation: Disables validation :except MissingMetadataException,

InvalidMetadataException, MetadataMismatch

static create_metadata(directory: str, media_type: Union[str, toktokkie.enums.MediaType])toktokkie.metadata.base.Metadata.Metadata

Generates a new metadata object using user prompts :param directory: The directory for which to generate the metadata :param media_type: The media type of the metadata :return: The generated metadata

static get_metadata(directory: str, no_validation: bool = False)toktokkie.metadata.base.Metadata.Metadata

Automatically resolves the metadata of a directory :param directory: The directory for which to generate the metadata :param no_validation: Disables Validation :return: The generated metadata :raises InvalidMetadataException: If the metadata is invalid

static get_metadata_class(media_type: Union[str, toktokkie.enums.MediaType]) → Type[toktokkie.metadata.base.Metadata.Metadata]

Retrieves the metadata class for a given media type :param media_type: The media type for which to get the metadata class :return: The metadata class

classmethod load_child_directories(parent_dir: str, restrictions: Optional[List[toktokkie.enums.MediaType]] = None) → List[toktokkie.Directory.Directory]

Loads all media directories in a directory :param parent_dir: The directory to search for media directories :param restrictions: Restricts the found media directories to media

directories with a specific media type

Returns

The list of Media Directories

classmethod load_directories(paths: List[str], restrictions: Optional[List[toktokkie.enums.MediaType]] = None) → List[toktokkie.Directory.Directory]

Loads the toktokkie Media Directory objects based on paths :param paths: The directories to turn into toktokkie Directory objs :param restrictions: Restricts the found media directories to media

directories with a specific media type

Returns

The list of Media Directories

logger = <Logger /usr/local/lib/python3.8/dist-packages/toktokkie-0.21.0-py3.8.egg/toktokkie/Directory.py (WARNING)>

Logger for the directory class

property path
Returns

The path to the directory

classmethod prompt(path: str, metadata_type: Union[str, toktokkie.enums.MediaType]) → Optional[toktokkie.Directory.Directory]

Prompts the user for metadata information :param path: The path to the directory for which to prompt :param metadata_type: The metadata type to generate :return: The generated directory, or None if aborted

reload()

Reloads the metadata from the metadata file :return: None

save()

Updates the metadata file with the current contents of the metadata :return: None

toktokkie.enums module

class toktokkie.enums.IdType(value)

Bases: enum.Enum

Enumeration of all possible ID types

ANILIST = 'anilist'
IMDB = 'imdb'
ISBN = 'isbn'
KITSU = 'kitsu'
MANGADEX = 'mangadex'
MUSICBRAINZ_ARTIST = 'musicbrainz_artist'
MUSICBRAINZ_RECORDING = 'musicbrainz_recording'
MUSICBRAINZ_RELEASE = 'musicbrainz_release'
MYANIMELIST = 'myanimelist'
TVDB = 'tvdb'
VNDB = 'vndb'
YOUTUBE_VIDEO = 'youtube'
class toktokkie.enums.MediaType(value)

Bases: enum.Enum

Enumeration that defines all possible media types

BOOK = 'book'
BOOK_SERIES = 'book_series'
COMIC = 'comic'
GAME = 'game'
MOVIE = 'movie'
MUSIC_ARTIST = 'music'
TV_SERIES = 'tv'

toktokkie.exceptions module

exception toktokkie.exceptions.InvalidDirectoryState

Bases: Exception

Exception that is raised if a directory is in a state that does not comply with requirements of a Metadata class

exception toktokkie.exceptions.InvalidMetadata(reason: str)

Bases: Exception

Exception that is raised whenever metadata is invalid

__init__(reason: str)
Parameters

reason – The reason why the metadata is invalid

exception toktokkie.exceptions.InvalidUpdateInstructions

Bases: Exception

Exception that is raised whenever xdcc update instructions are invalid

exception toktokkie.exceptions.MetadataMismatch

Bases: Exception

Exception that is raised whenever the metadata type in the JSON data is in conflict with the actual metadata class

exception toktokkie.exceptions.MissingMetadata

Bases: Exception

Exception that is raised whenever metadata is not found

exception toktokkie.exceptions.MissingUpdateInstructions

Bases: Exception

Exception that is raised whenever xdcc update instructions don’t exist

toktokkie.main module

toktokkie.main.define_parser() → argparse.ArgumentParser
Returns

The command line parser for this script

toktokkie.main.main(args: argparse.Namespace)

The main function of this script :param args: The command line arguments :return: None

Module contents

toktokkie.sentry_dsn = 'https://77992bd58d9a46fc812ad491ba460a7e@sentry.namibsun.net/10'

Sentry DSN used for exception logging

toktokkie.version = '0.21.0'

The current version of the package