toktokkie.commands package¶
Submodules¶
toktokkie.commands.AlbumArtFetchCommand module¶
-
class
toktokkie.commands.AlbumArtFetchCommand.
AlbumArtFetchCommand
(args: argparse.Namespace)¶ Bases:
toktokkie.commands.Command.Command
Class that encapsulates behaviour of the album-art-fetch command
-
download_cover_file
(urls: List[str], dest: str)¶ Downloads a cover file, then trims it correctly and/or converts it to PNG :param urls: The URLs to try :param dest: The destination file location :return: None
-
execute
()¶ Executes the commands :return: None
-
classmethod
help
() → str¶ - Returns
The help message for the command
-
load_anilist_cover_url
(anilist_id: str) → List[str]¶ Loads cover image URLs using anilist IDs :param anilist_id: The anilist ID to use :return: The cover images that were found
-
load_musicbrainz_cover_url
(musicbrainz_id: str) → List[str]¶ Loads cover image URls using musicbrainz release IDs :param musicbrainz_id: The musicbrainz release ID to use :return: The musicbrainz cover image URLs
-
classmethod
name
() → str¶ - Returns
The command name
-
classmethod
prepare_parser
(parser: argparse.ArgumentParser)¶ Prepares an argumentparser for this command :param parser: The parser to prepare :return: None
-
toktokkie.commands.AnimeThemeDlCommand module¶
-
class
toktokkie.commands.AnimeThemeDlCommand.
AnimeThemeDlCommand
(args: argparse.Namespace)¶ Bases:
toktokkie.commands.Command.Command
Class that encapsulates behaviour of the anitheme-dl command
-
execute
()¶ Executes the commands :return: None
-
generate_artist_album_structure
(selected_songs: List[toktokkie.utils.anithemes.AniTheme.AniTheme])¶ - Generates a folder structure for OPs and EDs following the schema:
Artist - Album
Song
Songs are copied from the mp3 directory. :param selected_songs: The song data :return: None
-
handle_excludes
(selected_songs: List[toktokkie.utils.anithemes.AniTheme.AniTheme]) → List[toktokkie.utils.anithemes.AniTheme.AniTheme]¶ Allows the user to exclude certain songs from being downloaded Deletes any files that may already exist for excluded songs :param selected_songs: All currently selected songs :return: The selected songs minus any excluded songs
-
classmethod
help
() → str¶ - Returns
The help message for the command
-
load_titles
(year: int, season: str, include_previous_season: bool = True) → List[str]¶ Loads a list of titles which can then be selected by the user :param year: The year for which to fetch titles :param season: The season for which to fetch titles :param include_previous_season: Whether to include the previous season :return: The list of titles
-
classmethod
name
() → str¶ - Returns
The command name
-
post_commands
()¶ Commands executed after the core anitheme-dl functionality has been completed :return: None
-
classmethod
prepare_parser
(parser: argparse.ArgumentParser)¶ Prepares an argumentparser for this command :param parser: The parser to prepare :return: None
-
prompt_selection
(shows: List[str]) → List[str]¶ Prompts the user for a selection of series for which to download songs :param shows: All series that are up for selection :return: A list of series names that were selected
-
static
resolve_selected_songs
(selected_series: List[str], data: Dict[str, List[Dict[str, str]]]) → List[Dict[str, str]]¶ Retrieves a list of all songs that are included in a selection of series :param selected_series: The selection of series :param data: The song data from reddit :return: The list of selected songs
-
static
segmentize
(titles: List[str]) → List[List[str]]¶ Segments a list of titles into segments (seasons) :param titles: The titles to segmentize :return: The segments
-
toktokkie.commands.ArchiveCommand module¶
-
class
toktokkie.commands.ArchiveCommand.
ArchiveCommand
(args: argparse.Namespace)¶ Bases:
toktokkie.commands.Command.Command
Class that encapsulates behaviour of the archive command
-
archive
(source: str, dest: str)¶ Creates a low-filesize archive of a directory into a new directory :param source: The source directory :param dest: The destination directory :return: None
-
execute
()¶ Executes the commands :return: None
-
classmethod
help
() → str¶ - Returns
The help message for the command
-
classmethod
name
() → str¶ - Returns
The command name
-
classmethod
prepare_parser
(parser: argparse.ArgumentParser)¶ Prepares an argumentparser for this command :param parser: The parser to prepare :return: None
-
toktokkie.commands.Command module¶
-
class
toktokkie.commands.Command.
Command
(args: argparse.Namespace)¶ Bases:
object
Class that encapsulates behaviour of a command for the toktokkie script
-
__init__
(args: argparse.Namespace)¶ Initializes the command object :param args: The command line arguments
-
static
add_directories_arg
(parser: argparse.ArgumentParser)¶ Adds a directories argument to a parser :param parser: The parser to which to add the argument :return: None
-
execute
()¶ Executes the commands :return: None
-
classmethod
help
() → str¶ - Returns
The help message for the command
-
classmethod
name
() → str¶ - Returns
The command name
-
classmethod
prepare_parser
(parser: argparse.ArgumentParser)¶ Prepares an argumentparser for this command :param parser: The parser to prepare :return: None
-
toktokkie.commands.IconizeCommand module¶
-
class
toktokkie.commands.IconizeCommand.
IconizeCommand
(args: argparse.Namespace)¶ Bases:
toktokkie.commands.Command.Command
Class that encapsulates behaviour of the iconize command
-
execute
()¶ Executes the commands :return: None
-
classmethod
help
() → str¶ - Returns
The help message for the command
-
classmethod
name
() → str¶ - Returns
The command name
-
classmethod
prepare_parser
(parser: argparse.ArgumentParser)¶ Prepares an argumentparser for this command :param parser: The parser to prepare :return: None
-
toktokkie.commands.IdFetchCommand module¶
-
class
toktokkie.commands.IdFetchCommand.
IdFetchCommand
(args: argparse.Namespace)¶ Bases:
toktokkie.commands.Command.Command
Class that encapsulates behaviour of the id-fetch command
-
execute
()¶ Executes the commands :return: None
-
fetch_season_ids
(metadata: toktokkie.metadata.tv.Tv.Tv, fetcher: toktokkie.utils.IdFetcher.IdFetcher)¶ Fetches season IDs for a Tv metadata :param metadata: The Tv metadata :param fetcher: The ID fetcher to use :return: None
-
fill_ids
(ids: Dict[toktokkie.enums.IdType, List[str]], valid_id_types: List[toktokkie.enums.IdType], fetcher: toktokkie.utils.IdFetcher.IdFetcher)¶ Fills IDs using an ID Fetcher :param ids: The IDs to fill :param valid_id_types: List of valid ID types :param fetcher: The IdFetcher object to use :return: None
-
classmethod
help
() → str¶ - Returns
The help message for the command
-
classmethod
name
() → str¶ - Returns
The command name
-
classmethod
prepare_parser
(parser: argparse.ArgumentParser)¶ Prepares an argumentparser for this command :param parser: The parser to prepare :return: None
-
toktokkie.commands.MangaCreateCommand module¶
-
class
toktokkie.commands.MangaCreateCommand.
MangaCreateCommand
(args: argparse.Namespace)¶ Bases:
toktokkie.commands.Command.Command
Class that encapsulates behaviour of the manga-create command
-
execute
()¶ Executes the commands :return: None
-
get_ids
(media_id: str, media_site: str) → Dict[str, str]¶
-
classmethod
help
() → str¶ - Returns
The help message for the command
-
load_anilist_info
(anilist_id: str, prompt_for_mangadex: bool = True) → Dict[str, str]¶
-
load_mangadex_info
(mangadex_id: str) → Dict[str, str]¶
-
classmethod
name
() → str¶ - Returns
The command name
-
prepare_directory
(title: str, cover_url: str)¶
-
classmethod
prepare_parser
(parser: argparse.ArgumentParser)¶ Prepares an argumentparser for this command :param parser: The parser to prepare :return: None
-
toktokkie.commands.MetadataAddCommand module¶
-
class
toktokkie.commands.MetadataAddCommand.
MetadataAddCommand
(args: argparse.Namespace)¶ Bases:
toktokkie.commands.Command.Command
Class that encapsulates behaviour of the metadata-add command
-
add_exclude
()¶ Adds an excluded episode to a tv series metadata :return: None
-
add_multi_episode
()¶ Adds a multi-episode to a tv series metadata :return: None
-
add_season
()¶ Adds a season to a TV series metadata :return: None
-
execute
()¶ Executes the commands :return: None
-
classmethod
help
() → str¶ - Returns
The help message for the command
-
classmethod
name
() → str¶ - Returns
The command name
-
classmethod
prepare_parser
(parser: argparse.ArgumentParser)¶ Prepares an argumentparser for this command :param parser: The parser to prepare :return: None
-
toktokkie.commands.MetadataGenCommand module¶
-
class
toktokkie.commands.MetadataGenCommand.
MetadataGenCommand
(args: argparse.Namespace)¶ Bases:
toktokkie.commands.Command.Command
Class that encapsulates behaviour of the metadata-gen command
-
execute
()¶ Executes the commands :return: None
-
classmethod
help
() → str¶ - Returns
The help message for the command
-
classmethod
name
() → str¶ - Returns
The command name
-
classmethod
prepare_parser
(parser: argparse.ArgumentParser)¶ Prepares an argumentparser for this command :param parser: The parser to prepare :return: None
-
toktokkie.commands.MetadataValidateCommand module¶
-
class
toktokkie.commands.MetadataValidateCommand.
MetadataValidateCommand
(args: argparse.Namespace)¶ Bases:
toktokkie.commands.Command.Command
Class that encapsulates behaviour of the metadata-validate command
-
execute
()¶ Executes the commands :return: None
-
classmethod
help
() → str¶ - Returns
The help message for the command
-
classmethod
name
() → str¶ - Returns
The command name
-
classmethod
prepare_parser
(parser: argparse.ArgumentParser)¶ Prepares an argumentparser for this command :param parser: The parser to prepare :return: None
-
toktokkie.commands.MusicMergeCommand module¶
-
class
toktokkie.commands.MusicMergeCommand.
MusicMergeCommand
(args: argparse.Namespace)¶ Bases:
toktokkie.commands.Command.Command
Class that encapsulates behaviour of the music-merge command
-
execute
()¶ Executes the commands :return: None
-
classmethod
help
() → str¶ - Returns
The help message for the command
-
merge_artists
(target_artist: toktokkie.Directory.Directory, source_artist: toktokkie.Directory.Directory)¶ Merges two artists :param target_artist: The target artist :param source_artist: The artist to merge into the target :return: None
-
classmethod
name
() → str¶ - Returns
The command name
-
classmethod
prepare_parser
(parser: argparse.ArgumentParser)¶ Prepares an argumentparser for this command :param parser: The parser to prepare :return: None
-
toktokkie.commands.MusicTagCommand module¶
-
class
toktokkie.commands.MusicTagCommand.
MusicTagCommand
(args: argparse.Namespace)¶ Bases:
toktokkie.commands.Command.Command
Class that encapsulates behaviour of the music-tag command
-
execute
()¶ Executes the commands :return: None
-
classmethod
help
() → str¶ - Returns
The help message for the command
-
classmethod
name
() → str¶ - Returns
The command name
-
classmethod
prepare_parser
(parser: argparse.ArgumentParser)¶ Prepares an argumentparser for this command :param parser: The parser to prepare :return: None
-
toktokkie.commands.PlaylistCreateCommand module¶
-
class
toktokkie.commands.PlaylistCreateCommand.
PlaylistCreateCommand
(args: argparse.Namespace)¶ Bases:
toktokkie.commands.Command.Command
Class that encapsulates behaviour of the playlist-create command
-
execute
()¶ Executes the commands :return: None
-
classmethod
help
() → str¶ - Returns
The help message for the command
-
classmethod
name
() → str¶ - Returns
The command name
-
classmethod
prepare_parser
(parser: argparse.ArgumentParser)¶ Prepares an argumentparser for this command :param parser: The parser to prepare :return: None
-
toktokkie.commands.PrintCommand module¶
-
class
toktokkie.commands.PrintCommand.
PrintCommand
(args: argparse.Namespace)¶ Bases:
toktokkie.commands.Command.Command
Class that encapsulates behaviour of the print command
-
execute
()¶ Executes the commands :return: None
-
classmethod
help
() → str¶ - Returns
The help message for the command
-
classmethod
name
() → str¶ - Returns
The command name
-
classmethod
prepare_parser
(parser: argparse.ArgumentParser)¶ Prepares an argumentparser for this command :param parser: The parser to prepare :return: None
-
toktokkie.commands.RenameCommand module¶
-
class
toktokkie.commands.RenameCommand.
RenameCommand
(args: argparse.Namespace)¶ Bases:
toktokkie.commands.Command.Command
Class that encapsulates behaviour of the rename command
-
execute
()¶ Executes the command :return: None
-
classmethod
help
() → str¶ - Returns
The help message for the command
-
classmethod
name
() → str¶ - Returns
The command name
-
classmethod
prepare_parser
(parser: argparse.ArgumentParser)¶ Prepares an argumentparser for this command :param parser: The parser to prepare :return: None
-
toktokkie.commands.SetComicCoverCommand module¶
-
class
toktokkie.commands.SetComicCoverCommand.
SetComicCoverCommand
(args: argparse.Namespace)¶ Bases:
toktokkie.commands.Command.Command
Class that encapsulates behaviour of the set-comic-cover command
-
execute
()¶ Executes the commands :return: None
-
classmethod
help
() → str¶ - Returns
The help message for the command
-
classmethod
name
() → str¶ - Returns
The command name
-
classmethod
prepare_parser
(parser: argparse.ArgumentParser)¶ Prepares an argumentparser for this command :param parser: The parser to prepare :return: None
-
toktokkie.commands.SuperCutCommand module¶
-
class
toktokkie.commands.SuperCutCommand.
SuperCutCommand
(args: argparse.Namespace)¶ Bases:
toktokkie.commands.Command.Command
Class that encapsulates behaviour of the supercut command
-
static
adjust_chapter_names
(supercut_result: str, chapters: List[str])¶ Changes the chapter names of a file to a given list of chapter names :param supercut_result: The file of which the chapters should be
renamed
- Parameters
chapters – The chapter names
- Returns
None
-
static
calculate_clip_duration
(start: str, end: str) → int¶ Calculates the tme delta in seconds between two timestamps :param start: The starting timestamp :param end: The ending timestamp :return: The time delta in seconds
-
create_supercut
(directory: toktokkie.Directory.Directory)¶ Creates the supercut file :param directory: The directory for which to create a supercut :return: None
-
cut_part
(supercut_dir: str, instruction: Dict[str, str]) → Dict[str, str]¶ Cuts a part of a video file based on a supercut instruction using ffmpeg :param supercut_dir: The supercut directory in which to
store the output
- Parameters
instruction – The instruction to use
- Returns
A dictionary detailing the path to the cut clip and its title
-
execute
()¶ Executes the commands :return: None
-
static
generate_instructions
(directory: toktokkie.Directory.Directory)¶ Generates a supercut instructions file based on the the existing season metadata and episode files :param directory: The directory for which to generate the instructions :return: None
-
classmethod
help
() → str¶ - Returns
The help message for the command
-
static
is_installed
(command: str) → bool¶ Checks whether or not a command is installed/in the path :param command: THe command to check :return: True if installed, else False
-
static
merge_parts
(supercut_dir: str, files: List[str]) → str¶ Merges a list of MKV files and stores them in supercut.mkv :param supercut_dir: The supercut directory :param files: The files to combine :return: The path to the combined file
-
classmethod
name
() → str¶ - Returns
The command name
-
classmethod
prepare_parser
(parser: argparse.ArgumentParser)¶ Prepares an argumentparser for this command :param parser: The parser to prepare :return: None
-
read_supercut_instructions
(metadata: toktokkie.metadata.tv.Tv.Tv, supercut_file: str) → List[Dict[str, str]]¶ Reads the supercut instructions file and generates an easily processable configuration list :param metadata: The metadata used for additional information :param supercut_file: The supercut file to parse :return: A list of dicitonaries modelling the individual parts of the
supercut in order
-
static
toktokkie.commands.UpdateCommand module¶
-
class
toktokkie.commands.UpdateCommand.
UpdateCommand
(args: argparse.Namespace)¶ Bases:
toktokkie.commands.Command.Command
Class that encapsulates behaviour of the update command
-
execute
()¶ Executes the commands :return: None
-
classmethod
help
() → str¶ - Returns
The help message for the command
-
classmethod
name
() → str¶ - Returns
The command name
-
classmethod
prepare_parser
(parser: argparse.ArgumentParser)¶ Prepares an argumentparser for this command :param parser: The parser to prepare :return: None
-
toktokkie.commands.UrlOpenCommand module¶
-
class
toktokkie.commands.UrlOpenCommand.
UrlOpenCommand
(args: argparse.Namespace)¶ Bases:
toktokkie.commands.Command.Command
Class that encapsulates behaviour of the urlopen command
-
execute
()¶ Executes the command :return: None
-
classmethod
help
() → str¶ - Returns
The help message for the command
-
classmethod
name
() → str¶ - Returns
The command name
-
classmethod
prepare_parser
(parser: argparse.ArgumentParser)¶ Prepares an argumentparser for this command :param parser: The parser to prepare :return: None
-
toktokkie.commands.YoutubeMusicDlCommand module¶
-
class
toktokkie.commands.YoutubeMusicDlCommand.
YoutubeMusicDlCommand
(args: argparse.Namespace)¶ Bases:
toktokkie.commands.Command.Command
Class that encapsulates behaviour of the youtube-music-dl command
-
create_albums
(music: toktokkie.metadata.music.Music.Music, info: List[Dict[str, Union[str, Dict[str, str]]]])¶ Creates album objects based on downloaded info :param music: The music metadata :param info: The info from youtube download :return: None
-
download_from_youtube
(target_dir: str) → List[Dict[str, Union[str, Dict[str, str]]]]¶ Downloads all youtube URLs from the command line arguments into a directory. Both mp4 and mp3 files will be downloaded if not specified otherwise by command line arguments. Playlists will be resolved to their own video IDs and downloaded seperately :param target_dir: The directory in which to store the downloaded files :return: The downloaded songs in the following form:
[{“files”: {extension: path}}, “id”: “ID”}, …]
-
execute
()¶ Executes the commands :return: None
-
classmethod
help
() → str¶ - Returns
The help message for the command
-
classmethod
name
() → str¶ - Returns
The command name
-
classmethod
prepare_parser
(parser: argparse.ArgumentParser)¶ Prepares an argumentparser for this command :param parser: The parser to prepare :return: None
-
static
prompt_song_order
(names: List[str]) → List[str]¶ Prompts the user for the song order in an album :param names: The names of the songs :return: List of ordered song names
-
Module contents¶
-
toktokkie.commands.
toktokkie_commands
= [<class 'toktokkie.commands.PrintCommand.PrintCommand'>, <class 'toktokkie.commands.UrlOpenCommand.UrlOpenCommand'>, <class 'toktokkie.commands.IconizeCommand.IconizeCommand'>, <class 'toktokkie.commands.RenameCommand.RenameCommand'>, <class 'toktokkie.commands.ArchiveCommand.ArchiveCommand'>, <class 'toktokkie.commands.MangaCreateCommand.MangaCreateCommand'>, <class 'toktokkie.commands.MetadataGenCommand.MetadataGenCommand'>, <class 'toktokkie.commands.UpdateCommand.UpdateCommand'>, <class 'toktokkie.commands.MetadataAddCommand.MetadataAddCommand'>, <class 'toktokkie.commands.SetComicCoverCommand.SetComicCoverCommand'>, <class 'toktokkie.commands.SuperCutCommand.SuperCutCommand'>, <class 'toktokkie.commands.AnimeThemeDlCommand.AnimeThemeDlCommand'>, <class 'toktokkie.commands.AlbumArtFetchCommand.AlbumArtFetchCommand'>, <class 'toktokkie.commands.MusicTagCommand.MusicTagCommand'>, <class 'toktokkie.commands.MusicMergeCommand.MusicMergeCommand'>, <class 'toktokkie.commands.PlaylistCreateCommand.PlaylistCreateCommand'>, <class 'toktokkie.commands.IdFetchCommand.IdFetchCommand'>, <class 'toktokkie.commands.YoutubeMusicDlCommand.YoutubeMusicDlCommand'>, <class 'toktokkie.commands.MetadataValidateCommand.MetadataValidateCommand'>]¶ A list of commands for the toktokkie script