Skip to content

Commit

Permalink
[16] fix flixpatrol bug
Browse files Browse the repository at this point in the history
  • Loading branch information
meisnate12 committed Oct 17, 2023
1 parent 73a0894 commit 99d98a7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.19.1-develop15
1.19.1-develop16
4 changes: 2 additions & 2 deletions modules/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -1449,11 +1449,11 @@ def _anilist(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"):
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"):
Expand Down
10 changes: 9 additions & 1 deletion modules/flixpatrol.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,21 @@ def locations(self):
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
Expand Down

0 comments on commit 99d98a7

Please sign in to comment.