fixed actor search

This commit is contained in:
meisnate12 2021-01-26 01:25:20 -05:00
parent 9d5079db4a
commit e17ba7945c
2 changed files with 3 additions and 22 deletions

View file

@ -558,12 +558,13 @@ class Config:
for tmdb_id in util.get_int_list(collections[c][m], "TMDb Person ID"): for tmdb_id in util.get_int_list(collections[c][m], "TMDb Person ID"):
try: try:
person = self.TMDb.get_person(tmdb_id) person = self.TMDb.get_person(tmdb_id)
valid_ids.append(library.get_actor_rating_key(person.name) if method_name == "actor_details_tmdb" else person.name) valid_ids.append(person.name)
if "summary" not in details and hasattr(person, "biography") and person.biography: if "summary" not in details and hasattr(person, "biography") and person.biography:
details["summary"] = person.biography details["summary"] = person.biography
if "poster" not in details and hasattr(person, "profile_path") and person.profile_path: 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), method_name) details["poster"] = ("url", "{}{}".format(self.TMDb.image_url, person.profile_path), method_name)
except Failed as e: except Failed as e:
util.print_stacktrace()
logger.error(e) logger.error(e)
if len(valid_ids) == 0: if len(valid_ids) == 0:
raise Failed("Collection Error: No valid TMDb Person IDs in {}".format(collections[c][m])) raise Failed("Collection Error: No valid TMDb Person IDs in {}".format(collections[c][m]))
@ -862,12 +863,7 @@ class Config:
search_terms = {} search_terms = {}
output = "" output = ""
for i, attr_pair in enumerate(value): for i, attr_pair in enumerate(value):
if attr_pair[0] == "actor": search_list = attr_pair[1]
search_list = []
for actor in attr_pair[1]:
search_list.append(library.get_actor_rating_key(actor))
else:
search_list = attr_pair[1]
final_method = attr_pair[0][:-4] + "!" if attr_pair[0][-4:] == ".not" else attr_pair[0] final_method = attr_pair[0][:-4] + "!" if attr_pair[0][-4:] == ".not" else attr_pair[0]
if library.is_show: if library.is_show:
final_method = "show." + final_method final_method = "show." + final_method

View file

@ -121,21 +121,6 @@ class PlexAPI:
raise Failed("Collection Error: No valid Plex Collections in {}".format(collections[c][m])) raise Failed("Collection Error: No valid Plex Collections in {}".format(collections[c][m]))
return valid_collections return valid_collections
def get_actor_rating_key(self, data):
movie_rating_key = None
for result in self.server_search(data):
entry = str(result).split(":")
entry[0] = entry[0][1:]
if entry[0] == "Movie":
movie_rating_key = int(entry[1])
break
if movie_rating_key:
for role in self.fetchItem(movie_rating_key).roles:
role = str(role).split(":")
if data.upper().replace(" ", "-") == role[2][:-1].upper():
return int(role[1])
raise Failed("Plex Error: Actor: {} not found".format(data))
def del_collection_if_empty(self, collection): def del_collection_if_empty(self, collection):
missing_data = {} missing_data = {}
if not os.path.exists(self.missing_path): if not os.path.exists(self.missing_path):