toktokkie.metadata.tv package¶
Subpackages¶
Submodules¶
toktokkie.metadata.tv.Tv module¶
-
class
toktokkie.metadata.tv.Tv.
Tv
(directory_path: str, json_data: Optional[Dict[str, Any]] = None, no_validation: bool = False)¶ Bases:
toktokkie.metadata.base.Metadata.Metadata
,toktokkie.metadata.tv.TvRenamer.TvRenamer
,toktokkie.metadata.tv.TvValidator.TvValidator
,toktokkie.metadata.tv.TvPrompter.TvPrompter
Metadata class for TV Series
-
directory_path
: str¶ The path to the directory this metadata describes
-
json
: Dict[str, Any]¶
-
classmethod
media_type
() → toktokkie.enums.MediaType¶ - Returns
The media type of the Metadata class
-
classmethod
required_id_types
() → List[toktokkie.enums.IdType]¶ - Returns
Required ID types for TV metadata
-
classmethod
valid_id_types
() → List[toktokkie.enums.IdType]¶ - Returns
Valid ID types for TV metadata
-
toktokkie.metadata.tv.TvExtras module¶
-
class
toktokkie.metadata.tv.TvExtras.
TvExtras
¶ Bases:
toktokkie.metadata.base.MetadataBase.MetadataBase
,abc.ABC
Extra properties and methods specific to tv series
-
add_exclude
(id_type: toktokkie.enums.IdType, season: int, episode: int, end_episode: Optional[int] = None)¶ Adds an excluded episode :param id_type: The ID type :param season: The season of the excluded episode :param episode: The excluded episode number :param end_episode: Optional end episode for multi-episode excludes :return: None
-
add_multi_episode
(id_type: toktokkie.enums.IdType, season: int, start_episode: int, end_episode: int)¶ Adds a multi-episode :param id_type: The ID type :param season: The season of the multi episode :param start_episode: The start episode :param end_episode: The end episode :return: None
-
add_season_start_override
(id_type: toktokkie.enums.IdType, season: int, episode: int)¶ Adds a new season start override :param id_type: The ID type :param season: The season :param episode: The episode :return: None
-
directory_path
: str¶ The path to the directory this metadata describes
-
property
excludes
¶ Generates data for episodes to be excluded during renaming etc. :return A dictionary mapping episode anithemes to seasons and id types
Form: {idtype: {season: [ep1, ep2]}}
-
get_season
(season_name: str) → toktokkie.metadata.tv.components.TvSeason.TvSeason¶ Retrieves a single season for a provided season name :param season_name: The name of the season :return: The season :raises KeyError: If the season could not be found
-
json
: Dict[str, Any]¶
-
property
multi_episodes
¶ - Returns
A dictionary mapping lists of multi-episodes to id types Form: {idtype: {season: {start: end}}}
-
property
season_start_overrides
¶ - Returns
A dictionary mapping episodes that override a season starting point to ID types Form: {idtype: {season: episode}}
-
property
seasons
¶ - Returns
A list of TV seasons
-
toktokkie.metadata.tv.TvPrompter module¶
-
class
toktokkie.metadata.tv.TvPrompter.
TvPrompter
¶ Bases:
toktokkie.metadata.base.Prompter.Prompter
,toktokkie.metadata.tv.TvExtras.TvExtras
,abc.ABC
Prompter class for tv series
-
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 tv directory has at least one season :param directory_path: The path to the directory to check :return: None
-
classmethod
prompt
(directory_path: str) → Dict[str, Any]¶ Generates new Metadata JSON using prompts for a directory :param directory_path: The path to the directory for which to generate
the metadata object
- Returns
The generated metadata JSON
-
toktokkie.metadata.tv.TvRenamer module¶
-
class
toktokkie.metadata.tv.TvRenamer.
TvRenamer
¶ Bases:
toktokkie.metadata.base.Renamer.Renamer
,toktokkie.metadata.tv.TvExtras.TvExtras
,abc.ABC
Class that handles renaming operations for tv series
-
create_rename_operations
() → List[toktokkie.metadata.base.components.RenameOperation.RenameOperation]¶ Performs rename operations on the content referenced by this metadata object :return: The rename operations for this metadata
-
directory_path
: str¶ The path to the directory this metadata describes
-
static
generate_tv_episode_filename
(original_file: str, series_name: str, season_number: int, episode_number: int, episode_name: str, multi_end: Optional[int] = None)¶ Generates an episode name for a given episode :param original_file: The original file. Used to get the file extension :param series_name: The name of the series :param season_number: The season number :param episode_name: The episode name :param episode_number: The episode number :param multi_end: Can be provided to create a multi-episode range :return: The generated episode name
-
get_episode_files
(id_type: Optional[toktokkie.enums.IdType]) → Dict[str, Dict[int, List[str]]]¶ Generates a dictionary categorizing internal episode files for further processing. A current limitation is, that only a single service ID per season is supported. It’s currently not planned to lift this limitation, as no valid use case for more than one ID per season has come up. The episode lists are sorted by their episode name. :param id_type: The ID type for which to group the episodes :return: The generated dictionary. It will have the following form:
{service_id: {season_number: [episode_files]}}
-
json
: Dict[str, Any]¶
-
static
load_episode_name
(service_id: str, id_type: Optional[toktokkie.enums.IdType], season_number: int, episode_number: int, multi_end: Optional[int] = None) → str¶ Loads an episode name from external sources, if available :param service_id: The external service ID for the episode’s series :param id_type: The external ID type :param season_number: The season number :param episode_number: The episode number :param multi_end: If provided,
will generate a name for a range of episodes
- Returns
The episode name
-
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.
-
property
selected_renaming_id_type
¶ - Returns
The preferred ID type that’s available for renaming
-
toktokkie.metadata.tv.TvValidator module¶
-
class
toktokkie.metadata.tv.TvValidator.
TvValidator
¶ Bases:
toktokkie.metadata.base.Validator.Validator
,toktokkie.metadata.tv.TvExtras.TvExtras
,abc.ABC
Class that handles validation of tv series metadata
-
classmethod
build_schema
() → Dict[str, Any]¶ Generates the JSON schema :return: The JSON schema
-
directory_path
: str¶ The path to the directory this metadata describes
-
json
: Dict[str, Any]¶
-
validate
()¶ Performs additional validation
-
classmethod