[37] fix imdb_keyword filter

pull/1294/head
meisnate12 2 years ago
parent 68b41f3d1e
commit 995ee10022

@ -1 +1 @@
1.18.3-develop36
1.18.3-develop37

@ -2126,12 +2126,12 @@ class CollectionBuilder:
raise Failed(f"{self.Type} Error: imdb_keyword requires the keyword attribute")
elif isinstance(data, dict):
dict_methods = {dm.lower(): dm for dm in data}
new_dictionary["keywords"] = util.parse(self.Type, "keyword", data, methods=dict_methods, parent=attribute, datatype="commalist")
new_dictionary["keywords"] = util.parse(self.Type, "keyword", data, methods=dict_methods, parent=attribute, datatype="lowerlist")
new_dictionary["minimum_votes"] = util.parse(self.Type, "minimum_votes", data, methods=dict_methods, parent=attribute, datatype="int", minimum=0)
new_dictionary["minimum_relevant"] = util.parse(self.Type, "minimum_relevant", data, methods=dict_methods, parent=attribute, datatype="int", minimum=0)
new_dictionary["minimum_percentage"] = util.parse(self.Type, "minimum_percentage", data, methods=dict_methods, parent=attribute, datatype="int", minimum=0, maximum=100)
else:
new_dictionary["keywords"] = util.parse(self.Type, final, data, datatype="commalist")
new_dictionary["keywords"] = util.parse(self.Type, final, data, datatype="lowerlist")
return new_dictionary
elif attribute in tag_attributes and modifier in ["", ".not"]:
if attribute in plex.tmdb_attributes:

@ -315,9 +315,9 @@ class IMDb:
def item_filter(self, imdb_info, filter_attr, modifier, filter_final, filter_data):
if filter_attr == "imdb_keyword":
mr = imdb_info["minimum_relevant"]
mv = imdb_info["minimum_votes"]
mp = imdb_info["minimum_percentage"]
mr = filter_data["minimum_relevant"]
mv = filter_data["minimum_votes"]
mp = filter_data["minimum_percentage"]
attrs = [k for k, (r, v) in imdb_info.items() if r >= mr and v >= mv and (v == 0 or r / v >= mp)]
if modifier == ".regex":
has_match = False
@ -332,7 +332,7 @@ class IMDb:
modifier = f".{modifier[7:]}"
if test_number is None or util.is_number_filter(test_number, modifier, filter_data):
return False
elif (not list(set(filter_data) & set(attrs)) and modifier == "") \
or (list(set(filter_data) & set(attrs)) and modifier == ".not"):
elif (not list(set(filter_data["keywords"]) & set(attrs)) and modifier == "") \
or (list(set(filter_data["keywords"]) & set(attrs)) and modifier == ".not"):
return False
return True

@ -733,13 +733,15 @@ def parse(error, attribute, data, datatype=None, methods=None, parent=None, defa
options = [o for o in translation]
value = data[methods[attribute]] if methods and attribute in methods else data
if datatype in ["list", "commalist", "strlist"]:
if datatype in ["list", "commalist", "strlist", "lowerlist"]:
final_list = []
if value:
if datatype in ["commalist", "strlist"] and isinstance(value, dict):
raise Failed(f"{error} Error: {display} {value} must be a list or string")
if datatype == "commalist":
value = get_list(value)
if datatype == "lowerlist":
value = get_list(value, lower=True)
if not isinstance(value, list):
value = [value]
for v in value:

Loading…
Cancel
Save