toktokkie.metadata.music.components package

Submodules

toktokkie.metadata.music.components.MusicAlbum module

class toktokkie.metadata.music.components.MusicAlbum.MusicAlbum(parent_path: str, parent_ids: Dict[toktokkie.enums.IdType, List[str]], ids: Dict[toktokkie.enums.IdType, List[str]], name: str, genre: str, year: int)

Bases: toktokkie.metadata.base.components.JsonComponent.JsonComponent

Class that defines attributes of music albums

__init__(parent_path: str, parent_ids: Dict[toktokkie.enums.IdType, List[str]], ids: Dict[toktokkie.enums.IdType, List[str]], name: str, genre: str, year: int)

Initializes the MusicAlbum object :param parent_path: The path to the parent directory :param parent_ids: The IDs associated with the parent :param ids: The specific IDs for this album :param name: The name of the album :param genre: The genre of the album :param year: The year this album was released

classmethod from_json(parent_path: str, parent_ids: Dict[toktokkie.enums.IdType, List[str]], json_data: Dict[str, Any])toktokkie.metadata.music.components.MusicAlbum.MusicAlbum

Generates a new MusicAlbum object based on JSON data :param parent_path: The path to the parent metadata directory :param parent_ids: The IDs of the parent metadata :param json_data: The JSON data :return: The generated object :raises InvalidMetadataException: If the provided JSON is invalid

property json

Converts the component into a JSON-compatible dictionary :return: The JSON-compatible dictionary

load_songs(tracknumber_sort: bool = True) → List[toktokkie.metadata.music.components.MusicSong.MusicSong]

Loads songs from this album :param tracknumber_sort: Whether or not to sort the songs by

tracknumber Needed to avoid infinite recursion in MusicSong class

Returns

All songs in this album

property songs
Returns

All songs in this album

property videos
Returns

All music videos in this album

toktokkie.metadata.music.components.MusicSong module

class toktokkie.metadata.music.components.MusicSong.MusicSong(path: str, album: MusicAlbum)

Bases: object

Class that models a single song

__init__(path: str, album: MusicAlbum)

Initializes the object :param path: The path to the song file :param album: The album this song is a part of

property album_artist_name
Returns

The song’s album artist name

property album_name
Returns

The song’s album name

property artist_name
Returns

The song’s artist name

property genre
Returns

The song’s genre

save_tags()

Saves any edited tags :return: None

property title
Returns

The title of the song

property tracknumber
Returns

The song’s track number as a tuple consisting of the song’s track number and the total amount of tracks in the album

property year
Returns

The year this song was released

toktokkie.metadata.music.components.MusicThemeSong module

class toktokkie.metadata.music.components.MusicThemeSong.MusicThemeSong(album: toktokkie.metadata.music.components.MusicAlbum.MusicAlbum, name: str, theme_type: str, series_ids: Dict[toktokkie.enums.IdType, List[str]])

Bases: toktokkie.metadata.base.components.JsonComponent.JsonComponent

Class that collects data on music theme songs (like anime openings etc)

__init__(album: toktokkie.metadata.music.components.MusicAlbum.MusicAlbum, name: str, theme_type: str, series_ids: Dict[toktokkie.enums.IdType, List[str]])

Initializes the object :param album: The album object related to this theme song :param name: The name of the song :param theme_type: The type of theme song :param series_ids: The IDs of the series this is a theme song for

classmethod from_json(album: toktokkie.metadata.music.components.MusicAlbum.MusicAlbum, json_data: Dict[str, Any])toktokkie.metadata.music.components.MusicThemeSong.MusicThemeSong

Generates a new MusicThemeSong object based on JSON data :param album: The corresponding album object :param json_data: The JSON data :return: The generated object :raises InvalidMetadataException: If the provided JSON is invalid

property json

Converts the component into a JSON-compatible dictionary :return: The JSON-compatible dictionary

property theme_type
Returns

The theme type

toktokkie.metadata.music.components.MusicVideo module

class toktokkie.metadata.music.components.MusicVideo.MusicVideo(path: str, album: MusicAlbum)

Bases: object

Class that keeps track of information for music videos

__init__(path: str, album: MusicAlbum)

Initializes the music video :param path: The path to the video file :param album: The album to which the music video belongs to

property title
Returns

The title of the song

Module contents