[16] fix flixpatrol bug

This commit is contained in:
meisnate12 2023-10-17 14:45:54 -04:00
parent 73a0894b09
commit 99d98a7b0a
3 changed files with 12 additions and 4 deletions

View file

@ -1 +1 @@
1.19.1-develop15 1.19.1-develop16

View file

@ -1449,11 +1449,11 @@ class CollectionBuilder:
def _flixpatrol(self, method_name, method_data): def _flixpatrol(self, method_name, method_data):
for dict_data in util.parse(self.Type, method_name, method_data, datatype="listdict"): for dict_data in util.parse(self.Type, method_name, method_data, datatype="listdict"):
dict_methods = {dm.lower(): dm for dm in dict_data} dict_methods = {dm.lower(): dm for dm in dict_data}
self.builders.append((method_name, { self.builders.append((method_name, self.config.FlixPatrol.validate_builder(method_name, {
"platform": util.parse(self.Type, "platform", dict_data, methods=dict_methods, parent=method_name, options=self.config.FlixPatrol.platforms), "platform": util.parse(self.Type, "platform", dict_data, methods=dict_methods, parent=method_name, options=self.config.FlixPatrol.platforms),
"location": util.parse(self.Type, "location", dict_data, methods=dict_methods, parent=method_name, default="world", options=self.config.FlixPatrol.locations), "location": util.parse(self.Type, "location", dict_data, methods=dict_methods, parent=method_name, default="world", options=self.config.FlixPatrol.locations),
"limit": util.parse(self.Type, "limit", dict_data, datatype="int", methods=dict_methods, parent=method_name, default=10, maximum=10) "limit": util.parse(self.Type, "limit", dict_data, datatype="int", methods=dict_methods, parent=method_name, default=10, maximum=10)
})) }, self.library.is_movie)))
def _icheckmovies(self, method_name, method_data): def _icheckmovies(self, method_name, method_data):
if method_name.startswith("icheckmovies_list"): if method_name.startswith("icheckmovies_list"):

View file

@ -37,13 +37,21 @@ class FlixPatrol:
self._locations = ["world"] + self._locations self._locations = ["world"] + self._locations
return self._locations return self._locations
def validate_builder(self, method, data, is_movie):
builder_type = "movies" if is_movie else "shows"
if method == "flixpatrol_top" and data["location"] in self.data[data["platform"]] and builder_type in self.data[data["platform"]][data["location"]]:
return data
raise Failed(f"FlixPatrol Error: No {builder_type[:-1].capitalize()} Data Found for {data['platform']} in {data['location']}")
def get_tmdb_ids(self, method, data, is_movie): def get_tmdb_ids(self, method, data, is_movie):
flix_items = []
if method == "flixpatrol_top": if method == "flixpatrol_top":
logger.info("Processing FlixPatrol Top:") logger.info("Processing FlixPatrol Top:")
logger.info(f"\tPlatform: {data['platform'].replace('_', ' ').title()}") logger.info(f"\tPlatform: {data['platform'].replace('_', ' ').title()}")
logger.info(f"\tLocation: {data['location'].replace('_', ' ').title()}") logger.info(f"\tLocation: {data['location'].replace('_', ' ').title()}")
logger.info(f"\tLimit: {data['limit']}") logger.info(f"\tLimit: {data['limit']}")
items = self.data[data["platform"]][data["location"]]["movies" if is_movie else "shows"][:data["limit"]] flix_items = self.data[data["platform"]][data["location"]]["movies" if is_movie else "shows"][:data["limit"]]
items = [(i, "tmdb" if is_movie else "tmdb_show") for i in flix_items]
if len(items) > 0: if len(items) > 0:
logger.info(f"Processed {len(items)} TMDb IDs") logger.info(f"Processed {len(items)} TMDb IDs")
return items return items