fixed dynamic people

pull/682/head
meisnate12 3 years ago
parent b9ea5bc8f6
commit 3d53500e0a

@ -1 +1 @@
1.15.1-develop33 1.15.1-develop34

@ -284,8 +284,9 @@ class MetadataFile(DataFile):
actor_data = util.parse("Config", "data", dynamic, parent=map_name, methods=methods, datatype="dict") actor_data = util.parse("Config", "data", dynamic, parent=map_name, methods=methods, datatype="dict")
else: else:
raise Failed(f"Config Error: {map_name} data attribute not found") raise Failed(f"Config Error: {map_name} data attribute not found")
actor_depth = util.parse("Config", "actor_depth", actor_data, parent=f"{map_name} data", datatype="int", default=3, minimum=1) actor_methods = {am.lower(): am for am in actor_data}
actor_minimum = util.parse("Config", "actor_minimum", actor_data, parent=f"{map_name} data", datatype="int", default=3, minimum=1) actor_depth = util.parse("Config", "actor_depth", actor_data, parent=f"{map_name} data", methods=actor_methods, datatype="int", default=3, minimum=1)
actor_minimum = util.parse("Config", "actor_minimum", actor_data, parent=f"{map_name} data", methods=actor_methods, datatype="int", default=3, minimum=1)
if not all_items: if not all_items:
all_items = library.get_all() all_items = library.get_all()
for i, item in enumerate(all_items, 1): for i, item in enumerate(all_items, 1):
@ -302,7 +303,7 @@ class MetadataFile(DataFile):
for role in roles: for role in roles:
if role["count"] >= actor_minimum: if role["count"] >= actor_minimum:
try: try:
results = self.config.TMDb.people_search(role["name"]) results = self.config.TMDb.search_people(role["name"])
auto_list[results[0].id] = results[0].name auto_list[results[0].id] = results[0].name
except NotFound: except NotFound:
logger.error(f"TMDb Error: Actor {role['name']} Not Found") logger.error(f"TMDb Error: Actor {role['name']} Not Found")
@ -377,7 +378,7 @@ class MetadataFile(DataFile):
continue continue
if not self.metadata and not self.collections: if not self.metadata and not self.collections:
raise Failed("YAML Error: metadata or collections attribute is required") raise Failed("YAML Error: metadata, collections, or dynamic_collections attribute is required")
logger.info(f"Metadata File Loaded Successfully") logger.info(f"Metadata File Loaded Successfully")
def get_collections(self, requested_collections): def get_collections(self, requested_collections):

@ -141,6 +141,9 @@ class TMDb:
def get_popular_people(self, limit): def get_popular_people(self, limit):
return {p.id: p.name for p in self.TMDb.popular_people().get_results(limit)} return {p.id: p.name for p in self.TMDb.popular_people().get_results(limit)}
def search_people(self, name):
return self.TMDb.people_search(name)
def validate_tmdb_ids(self, tmdb_ids, tmdb_method): def validate_tmdb_ids(self, tmdb_ids, tmdb_method):
tmdb_list = util.get_int_list(tmdb_ids, f"TMDb {type_map[tmdb_method]} ID") tmdb_list = util.get_int_list(tmdb_ids, f"TMDb {type_map[tmdb_method]} ID")
tmdb_values = [] tmdb_values = []

Loading…
Cancel
Save