added tmdb_person

pull/16/head
meisnate12 4 years ago
parent e17ba7945c
commit c5c1ee25dc

File diff suppressed because it is too large Load Diff

@ -408,8 +408,16 @@ class Config:
logger.info("") logger.info("")
util.seperator("{} Collection".format(c)) util.seperator("{} Collection".format(c))
logger.info("") logger.info("")
map = {}
details = {}
methods = []
filters = []
posters_found = []
backgrounds_found = []
collectionless = "plex_collectionless" in collections[c] collectionless = "plex_collectionless" in collections[c]
skip_collection = True skip_collection = True
if "schedule" not in collections[c]: if "schedule" not in collections[c]:
skip_collection = False skip_collection = False
elif not collections[c]["schedule"]: elif not collections[c]["schedule"]:
@ -464,18 +472,10 @@ class Config:
logger.error("Collection Error: failed to parse schedule: {}".format(schedule)) logger.error("Collection Error: failed to parse schedule: {}".format(schedule))
else: else:
logger.error("Collection Error: schedule attribute {} invalid".format(schedule)) logger.error("Collection Error: schedule attribute {} invalid".format(schedule))
if skip_collection: if skip_collection:
logger.info("Skipping Collection {}".format(c)) logger.info("Skipping Collection {}".format(c))
continue continue
map = {}
details = {}
methods = []
filters = []
posters_found = []
backgrounds_found = []
try: try:
collection_obj = library.get_collection(c) collection_obj = library.get_collection(c)
collection_name = collection_obj.title collection_name = collection_obj.title
@ -483,7 +483,6 @@ class Config:
collection_obj = None collection_obj = None
collection_name = c collection_name = c
sync_collection = library.sync_mode == "sync" sync_collection = library.sync_mode == "sync"
if "sync_mode" in collections[c]: if "sync_mode" in collections[c]:
if not collections[c]["sync_mode"]: logger.warning("Collection Warning: sync_mode attribute is blank using general: {}".format(library.sync_mode)) if not collections[c]["sync_mode"]: logger.warning("Collection Warning: sync_mode attribute is blank using general: {}".format(library.sync_mode))
@ -497,6 +496,25 @@ class Config:
else: else:
logger.info("Sync Mode: append") logger.info("Sync Mode: append")
if "tmdb_person" in collections[c]:
if collections[c]["tmdb_person"]:
valid_names = []
for tmdb_id in util.get_int_list(collections[c]["tmdb_person"], "TMDb Person ID"):
try:
person = self.TMDb.get_person(tmdb_id)
valid_names.append(person.name)
if "summary" not in details and hasattr(person, "biography") and person.biography:
details["summary"] = person.biography
if "poster" not in details and hasattr(person, "profile_path") and person.profile_path:
details["poster"] = ("url", "{}{}".format(self.TMDb.image_url, person.profile_path), "tmdb_person")
except Failed as e:
util.print_stacktrace()
logger.error(e)
if len(valid_names) > 0: details["tmdb_person"] = valid_names
else: logger.error("Collection Error: No valid TMDb Person IDs in {}".format(collections[c]["tmdb_person"]))
else:
logger.error("Collection Error: tmdb_person attribute is blank")
for m in collections[c]: for m in collections[c]:
try: try:
if "tmdb" in m and not self.TMDb: if "tmdb" in m and not self.TMDb:
@ -508,7 +526,7 @@ class Config:
elif "imdb" in m and not self.IMDb: elif "imdb" in m and not self.IMDb:
logger.info("Collection Error: {} skipped. TMDb or Trakt must be configured".format(m)) logger.info("Collection Error: {} skipped. TMDb or Trakt must be configured".format(m))
map = {} map = {}
elif m == "tautulli" and not library.Tautulli: elif "tautulli" in m and not library.Tautulli:
logger.info("Collection Error: {} skipped. Tautulli must be configured".format(m)) logger.info("Collection Error: {} skipped. Tautulli must be configured".format(m))
map = {} map = {}
elif "mal" in m and not self.MyAnimeList: elif "mal" in m and not self.MyAnimeList:
@ -537,8 +555,8 @@ class Config:
if collections[c][m] in ["release", "alpha"]: details[method_name] = collections[c][m] if collections[c][m] in ["release", "alpha"]: details[method_name] = collections[c][m]
else: raise Failed("Collection Error: {} collection_order Invalid\n| \trelease (Order Collection by release dates)\n| \talpha (Order Collection Alphabetically)".format(collections[c][m])) else: raise Failed("Collection Error: {} collection_order Invalid\n| \trelease (Order Collection by release dates)\n| \talpha (Order Collection Alphabetically)".format(collections[c][m]))
elif method_name == "url_poster": posters_found.append(("url", collections[c][m], method_name)) elif method_name == "url_poster": posters_found.append(("url", collections[c][m], method_name))
elif method_name == "tmdb_poster": posters_found.append(("url", "{}{}".format(self.TMDb.image_url, self.get_movie_show_or_collection(util.regex_first_int(collections[c][m], "TMDb ID"), library.is_movie).poster_path), method_name)) elif method_name == "tmdb_poster": posters_found.append(("url", "{}{}".format(self.TMDb.image_url, self.TMDb.get_movie_show_or_collection(util.regex_first_int(collections[c][m], "TMDb ID"), library.is_movie).poster_path), method_name))
elif method_name == "tmdb_profile": posters_found.append(("url", "{}{}".format(self.TMDb.image_url, self.get_person(util.regex_first_int(collections[c][m], "TMDb Person ID")).profile_path), method_name)) elif method_name == "tmdb_profile": posters_found.append(("url", "{}{}".format(self.TMDb.image_url, self.TMDb.get_person(util.regex_first_int(collections[c][m], "TMDb Person ID")).profile_path), method_name))
elif method_name == "file_poster": elif method_name == "file_poster":
if os.path.exists(collections[c][m]): posters_found.append(("file", os.path.abspath(collections[c][m]), method_name)) if os.path.exists(collections[c][m]): posters_found.append(("file", os.path.abspath(collections[c][m]), method_name))
else: raise Failed("Collection Error: Poster Path Does Not Exist: {}".format(os.path.abspath(collections[c][m]))) else: raise Failed("Collection Error: Poster Path Does Not Exist: {}".format(os.path.abspath(collections[c][m])))
@ -553,22 +571,15 @@ class Config:
elif method_name in util.all_details: details[method_name] = collections[c][m] elif method_name in util.all_details: details[method_name] = collections[c][m]
elif method_name in ["year", "year.not"]: methods.append(("plex_search", [[(method_name, util.get_year_list(collections[c][m], method_name))]])) elif method_name in ["year", "year.not"]: methods.append(("plex_search", [[(method_name, util.get_year_list(collections[c][m], method_name))]]))
elif method_name in ["decade", "decade.not"]: methods.append(("plex_search", [[(method_name, util.get_int_list(collections[c][m], util.remove_not(method_name)))]])) elif method_name in ["decade", "decade.not"]: methods.append(("plex_search", [[(method_name, util.get_int_list(collections[c][m], util.remove_not(method_name)))]]))
elif method_name in ["actor_details_tmdb", "director_details_tmdb", "writer_details_tmdb"]: elif method_name in util.tmdb_searches:
valid_ids = [] final_values = []
for tmdb_id in util.get_int_list(collections[c][m], "TMDb Person ID"): for value in util.get_list(collections[c][m]):
try: if value.lower() == "tmdb" and "tmdb_person" in details:
person = self.TMDb.get_person(tmdb_id) for name in details["tmdb_person"]:
valid_ids.append(person.name) final_values.append(name)
if "summary" not in details and hasattr(person, "biography") and person.biography: else:
details["summary"] = person.biography final_values.append(value)
if "poster" not in details and hasattr(person, "profile_path") and person.profile_path: methods.append(("plex_search", [[(method_name, final_values)]]))
details["poster"] = ("url", "{}{}".format(self.TMDb.image_url, person.profile_path), method_name)
except Failed as e:
util.print_stacktrace()
logger.error(e)
if len(valid_ids) == 0:
raise Failed("Collection Error: No valid TMDb Person IDs in {}".format(collections[c][m]))
methods.append(("plex_search", [[(method_name[:-13], valid_ids)]]))
elif method_name in util.plex_searches: methods.append(("plex_search", [[(method_name, util.get_list(collections[c][m]))]])) elif method_name in util.plex_searches: methods.append(("plex_search", [[(method_name, util.get_list(collections[c][m]))]]))
elif method_name == "plex_all": methods.append((method_name, [""])) elif method_name == "plex_all": methods.append((method_name, [""]))
elif method_name == "plex_collection": methods.append((method_name, library.validate_collections(collections[c][m] if isinstance(collections[c][m], list) else [collections[c][m]]))) elif method_name == "plex_collection": methods.append((method_name, library.validate_collections(collections[c][m] if isinstance(collections[c][m], list) else [collections[c][m]])))
@ -810,7 +821,7 @@ class Config:
else: else:
methods.append((method_name, values)) methods.append((method_name, values))
elif method_name in util.all_lists: methods.append((method_name, util.get_list(collections[c][m]))) elif method_name in util.all_lists: methods.append((method_name, util.get_list(collections[c][m])))
elif method_name not in ["sync_mode", "schedule"]: logger.error("Collection Error: {} attribute not supported".format(method_name)) elif method_name not in ["sync_mode", "schedule", "tmdb_person"]: logger.error("Collection Error: {} attribute not supported".format(method_name))
else: else:
logger.error("Collection Error: {} attribute is blank".format(m)) logger.error("Collection Error: {} attribute is blank".format(m))
except Failed as e: except Failed as e:

@ -29,6 +29,7 @@ method_alias = {
"directors": "director", "directors": "director",
"genres": "genre", "genres": "genre",
"studios": "studio", "network": "studio", "networks": "studio", "studios": "studio", "network": "studio", "networks": "studio",
"producers": "producer",
"writers": "writer", "writers": "writer",
"years": "year" "years": "year"
} }
@ -122,6 +123,7 @@ pretty_names = {
"tmdb_movie_details": "TMDb Movie", "tmdb_movie_details": "TMDb Movie",
"tmdb_network": "TMDb Network", "tmdb_network": "TMDb Network",
"tmdb_now_playing": "TMDb Now Playing", "tmdb_now_playing": "TMDb Now Playing",
"tmdb_person": "TMDb Person",
"tmdb_popular": "TMDb Popular", "tmdb_popular": "TMDb Popular",
"tmdb_show": "TMDb Show", "tmdb_show": "TMDb Show",
"tmdb_show_details": "TMDb Show", "tmdb_show_details": "TMDb Show",
@ -259,13 +261,14 @@ dictionary_lists = [
"tmdb_discover" "tmdb_discover"
] ]
plex_searches = [ plex_searches = [
"actor", "actor_details_tmdb", #"actor.not", # Waiting on PlexAPI to fix issue "actor", #"actor.not", # Waiting on PlexAPI to fix issue
"country", #"country.not", "country", #"country.not",
"decade", #"decade.not", "decade", #"decade.not",
"director", "director_details_tmdb", #"director.not", "director", #"director.not",
"genre", #"genre.not", "genre", #"genre.not",
"producer", #"producer.not",
"studio", #"studio.not", "studio", #"studio.not",
"writer", "writer_details_tmdb", #"writer.not" "writer", #"writer.not"
"year" #"year.not", "year" #"year.not",
] ]
show_only_lists = [ show_only_lists = [
@ -275,17 +278,26 @@ show_only_lists = [
"tvdb_show" "tvdb_show"
] ]
movie_only_lists = [ movie_only_lists = [
"actor_details_tmdb", "tmdb_collection",
"director_details_tmdb", "tmdb_collection_details",
"tmdb_movie",
"tmdb_movie_details",
"tmdb_now_playing", "tmdb_now_playing",
"writer_details_tmdb" "tvdb_movie"
] ]
movie_only_searches = [ movie_only_searches = [
"actor", "actor_details_tmdb", #"actor.not", # Waiting on PlexAPI to fix issue "actor", "actor.not",
"country", #"country.not", "country", "country.not",
"decade", #"decade.not", "decade", "decade.not",
"director", "director_details_tmdb", #"director.not", "director", "director.not",
"writer", "writer_details_tmdb" #"writer.not" "producer", "producer.not",
"writer", "writer.not"
]
tmdb_searches = [
"actor", "actor.not",
"director", "director.not",
"producer", "producer.not",
"writer", "writer.not"
] ]
count_lists = [ count_lists = [
"anidb_popular", "anidb_popular",
@ -335,6 +347,7 @@ tmdb_type = {
"tmdb_movie": "Movie", "tmdb_movie": "Movie",
"tmdb_movie_details": "Movie", "tmdb_movie_details": "Movie",
"tmdb_network": "Network", "tmdb_network": "Network",
"tmdb_person": "Person",
"tmdb_show": "Show", "tmdb_show": "Show",
"tmdb_show_details": "Show" "tmdb_show_details": "Show"
} }

Loading…
Cancel
Save