[19] added tmdb_upcoming, tmdb_airing_today, and tmdb_on_the_air builders

This commit is contained in:
meisnate12 2022-03-22 14:16:30 -04:00
parent e09bd609e4
commit c290a08ea4
3 changed files with 28 additions and 15 deletions

View file

@ -1 +1 @@
1.16.2-develop18 1.16.2-develop19

View file

@ -73,11 +73,14 @@ modifier_alias = {".greater": ".gt", ".less": ".lt"}
all_builders = anidb.builders + anilist.builders + flixpatrol.builders + icheckmovies.builders + imdb.builders + \ all_builders = anidb.builders + anilist.builders + flixpatrol.builders + icheckmovies.builders + imdb.builders + \
letterboxd.builders + mal.builders + plex.builders + reciperr.builders + tautulli.builders + \ letterboxd.builders + mal.builders + plex.builders + reciperr.builders + tautulli.builders + \
tmdb.builders + trakt.builders + tvdb.builders + mdblist.builders tmdb.builders + trakt.builders + tvdb.builders + mdblist.builders
show_only_builders = ["tmdb_network", "tmdb_show", "tmdb_show_details", "tvdb_show", "tvdb_show_details", "collection_level", "item_tmdb_season_titles"] show_only_builders = [
"tmdb_network", "tmdb_show", "tmdb_show_details", "tvdb_show", "tvdb_show_details", "tmdb_airing_today",
"tmdb_on_the_air", "collection_level", "item_tmdb_season_titles"
]
movie_only_builders = [ movie_only_builders = [
"letterboxd_list", "letterboxd_list_details", "icheckmovies_list", "icheckmovies_list_details", "stevenlu_popular", "letterboxd_list", "letterboxd_list_details", "icheckmovies_list", "icheckmovies_list_details", "stevenlu_popular",
"tmdb_collection", "tmdb_collection_details", "tmdb_movie", "tmdb_movie_details", "tmdb_now_playing", "tmdb_collection", "tmdb_collection_details", "tmdb_movie", "tmdb_movie_details", "tmdb_now_playing",
"tvdb_movie", "tvdb_movie_details", "trakt_boxoffice", "reciperr_list" "tvdb_movie", "tvdb_movie_details", "tmdb_upcoming", "trakt_boxoffice", "reciperr_list"
] ]
music_only_builders = ["item_album_sorting"] music_only_builders = ["item_album_sorting"]
summary_details = [ summary_details = [
@ -171,8 +174,8 @@ smart_url_invalid = ["minimum_items", "filters", "run_again", "sync_mode", "show
custom_sort_builders = [ custom_sort_builders = [
"plex_search", "plex_pilots", "tmdb_list", "tmdb_popular", "tmdb_now_playing", "tmdb_top_rated", "plex_search", "plex_pilots", "tmdb_list", "tmdb_popular", "tmdb_now_playing", "tmdb_top_rated",
"tmdb_trending_daily", "tmdb_trending_weekly", "tmdb_discover", "reciperr_list", "tmdb_trending_daily", "tmdb_trending_weekly", "tmdb_discover", "reciperr_list",
"tvdb_list", "imdb_chart", "imdb_list", "stevenlu_popular", "anidb_popular", "tvdb_list", "imdb_chart", "imdb_list", "stevenlu_popular", "anidb_popular", "tmdb_upcoming", "tmdb_airing_today",
"trakt_list", "trakt_watchlist", "trakt_collection", "trakt_trending", "trakt_popular", "trakt_boxoffice", "tmdb_on_the_air", "trakt_list", "trakt_watchlist", "trakt_collection", "trakt_trending", "trakt_popular", "trakt_boxoffice",
"trakt_collected_daily", "trakt_collected_weekly", "trakt_collected_monthly", "trakt_collected_yearly", "trakt_collected_all", "trakt_collected_daily", "trakt_collected_weekly", "trakt_collected_monthly", "trakt_collected_yearly", "trakt_collected_all",
"flixpatrol_url", "flixpatrol_demographics", "flixpatrol_popular", "flixpatrol_top", "flixpatrol_url", "flixpatrol_demographics", "flixpatrol_popular", "flixpatrol_top",
"trakt_recommended_personal", "trakt_recommended_daily", "trakt_recommended_weekly", "trakt_recommended_monthly", "trakt_recommended_yearly", "trakt_recommended_all", "trakt_recommended_personal", "trakt_recommended_daily", "trakt_recommended_weekly", "trakt_recommended_monthly", "trakt_recommended_yearly", "trakt_recommended_all",
@ -1229,11 +1232,11 @@ class CollectionBuilder:
self.builders.append((method_name, new_dictionary)) self.builders.append((method_name, new_dictionary))
else: else:
raise Failed(f"{self.Type} Error: {method_name} had no valid fields") raise Failed(f"{self.Type} Error: {method_name} had no valid fields")
elif method_name in ["tmdb_popular", "tmdb_top_rated", "tmdb_now_playing", "tmdb_trending_daily", "tmdb_trending_weekly"]: elif method_name in tmdb.int_builders:
self.builders.append((method_name, util.parse(self.Type, method_name, method_data, datatype="int", default=10))) self.builders.append((method_name, util.parse(self.Type, method_name, method_data, datatype="int", default=10)))
else: else:
values = self.config.TMDb.validate_tmdb_ids(method_data, method_name) values = self.config.TMDb.validate_tmdb_ids(method_data, method_name)
if method_name.endswith("_details"): if method_name in tmdb.details_builders:
if method_name.startswith(("tmdb_collection", "tmdb_movie", "tmdb_show")): if method_name.startswith(("tmdb_collection", "tmdb_movie", "tmdb_show")):
item = self.config.TMDb.get_movie_show_or_collection(values[0], self.library.is_movie) item = self.config.TMDb.get_movie_show_or_collection(values[0], self.library.is_movie)
if item.overview: if item.overview:
@ -1253,7 +1256,7 @@ class CollectionBuilder:
if item.description: if item.description:
self.summaries[method_name] = item.description self.summaries[method_name] = item.description
for value in values: for value in values:
self.builders.append((method_name[:-8] if method_name.endswith("_details") else method_name, value)) self.builders.append((method_name[:-8] if method_name in tmdb.details_builders else method_name, value))
def _trakt(self, method_name, method_data): def _trakt(self, method_name, method_data):
if method_name.startswith("trakt_list"): if method_name.startswith("trakt_list"):

View file

@ -4,13 +4,17 @@ from tmdbapis import TMDbAPIs, TMDbException, NotFound
logger = util.logger logger = util.logger
builders = [ int_builders = [
"tmdb_actor", "tmdb_actor_details", "tmdb_collection", "tmdb_collection_details", "tmdb_company", "tmdb_airing_today", "tmdb_popular", "tmdb_top_rated", "tmdb_now_playing", "tmdb_on_the_air",
"tmdb_crew", "tmdb_crew_details", "tmdb_director", "tmdb_director_details", "tmdb_discover", "tmdb_trending_daily", "tmdb_trending_weekly", "tmdb_upcoming"
"tmdb_keyword", "tmdb_list", "tmdb_list_details", "tmdb_movie", "tmdb_movie_details", "tmdb_network",
"tmdb_now_playing", "tmdb_popular", "tmdb_producer", "tmdb_producer_details", "tmdb_show", "tmdb_show_details",
"tmdb_top_rated", "tmdb_trending_daily", "tmdb_trending_weekly", "tmdb_writer", "tmdb_writer_details"
] ]
info_builders = [
"tmdb_actor", "tmdb_collection", "tmdb_crew", "tmdb_director", "tmdb_list",
"tmdb_movie", "tmdb_producer", "tmdb_show", "tmdb_writer"
]
details_builders = [f"{d}_details" for d in info_builders]
builders = ["tmdb_company", "tmdb_discover", "tmdb_keyword", "tmdb_network"] \
+ int_builders + info_builders + details_builders
type_map = { type_map = {
"tmdb_actor": "Person", "tmdb_actor_details": "Person", "tmdb_crew": "Person", "tmdb_crew_details": "Person", "tmdb_actor": "Person", "tmdb_actor_details": "Person", "tmdb_crew": "Person", "tmdb_crew_details": "Person",
"tmdb_collection": "Collection", "tmdb_collection_details": "Collection", "tmdb_company": "Company", "tmdb_collection": "Collection", "tmdb_collection_details": "Collection", "tmdb_company": "Company",
@ -280,13 +284,19 @@ class TMDb:
logger.info(f"Processing {pretty}: {amount} {media_type}{'' if amount == 1 else 's'}") logger.info(f"Processing {pretty}: {amount} {media_type}{'' if amount == 1 else 's'}")
for attr, value in attrs.items(): for attr, value in attrs.items():
logger.info(f" {attr}: {value}") logger.info(f" {attr}: {value}")
elif method in ["tmdb_popular", "tmdb_top_rated", "tmdb_now_playing", "tmdb_trending_daily", "tmdb_trending_weekly"]: elif method in int_builders:
if method == "tmdb_popular": if method == "tmdb_popular":
results = self.TMDb.popular_movies() if is_movie else self.TMDb.popular_tv() results = self.TMDb.popular_movies() if is_movie else self.TMDb.popular_tv()
elif method == "tmdb_top_rated": elif method == "tmdb_top_rated":
results = self.TMDb.top_rated_movies() if is_movie else self.TMDb.top_rated_tv() results = self.TMDb.top_rated_movies() if is_movie else self.TMDb.top_rated_tv()
elif method == "tmdb_now_playing": elif method == "tmdb_now_playing":
results = self.TMDb.now_playing_movies() results = self.TMDb.now_playing_movies()
elif method == "tmdb_upcoming":
results = self.TMDb.upcoming_movies()
elif method == "tmdb_airing_today":
results = self.TMDb.tv_airing_today()
elif method == "tmdb_on_the_air":
results = self.TMDb.tv_on_the_air()
else: else:
results = self.TMDb.trending("movie" if is_movie else "tv", "day" if method == "tmdb_trending_daily" else "week") results = self.TMDb.trending("movie" if is_movie else "tv", "day" if method == "tmdb_trending_daily" else "week")
ids = [(i.id, result_type) for i in results.get_results(data)] ids = [(i.id, result_type) for i in results.get_results(data)]