[16] fix flixpatrol bug

pull/1667/head
meisnate12 1 year ago
parent 73a0894b09
commit 99d98a7b0a

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

@ -1449,11 +1449,11 @@ class CollectionBuilder:
def _flixpatrol(self, method_name, method_data):
for dict_data in util.parse(self.Type, method_name, method_data, datatype="listdict"):
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),
"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)
}))
}, self.library.is_movie)))
def _icheckmovies(self, method_name, method_data):
if method_name.startswith("icheckmovies_list"):

@ -37,13 +37,21 @@ class FlixPatrol:
self._locations = ["world"] + 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):
flix_items = []
if method == "flixpatrol_top":
logger.info("Processing FlixPatrol Top:")
logger.info(f"\tPlatform: {data['platform'].replace('_', ' ').title()}")
logger.info(f"\tLocation: {data['location'].replace('_', ' ').title()}")
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:
logger.info(f"Processed {len(items)} TMDb IDs")
return items

Loading…
Cancel
Save