[6] cast limit to int

pull/1018/head
meisnate12 2 years ago
parent 334e4d8fd2
commit 34779702cb

@ -1 +1 @@
1.17.3-develop5 1.17.3-develop6

@ -1762,11 +1762,15 @@ class CollectionBuilder:
raise Failed(f"{self.Type} Error: limit attribute is blank") raise Failed(f"{self.Type} Error: limit attribute is blank")
elif str(plex_filter[filter_alias["limit"]]).lower() == "all": elif str(plex_filter[filter_alias["limit"]]).lower() == "all":
filter_details += "Limit: all\n" filter_details += "Limit: all\n"
elif not isinstance(plex_filter[filter_alias["limit"]], int) or plex_filter[filter_alias["limit"]] < 1:
raise Failed(f"{self.Type} Error: limit attribute must be an integer greater than 0")
else: else:
limit = plex_filter[filter_alias["limit"]] try:
if int(plex_filter[filter_alias["limit"]]) < 1:
raise ValueError
else:
limit = int(plex_filter[filter_alias["limit"]])
filter_details += f"Limit: {limit}\n" filter_details += f"Limit: {limit}\n"
except ValueError:
raise Failed(f"{self.Type} Error: limit attribute must be an integer greater than 0")
validate = True validate = True
if "validate" in filter_alias: if "validate" in filter_alias:

@ -168,6 +168,8 @@ class DataFile:
def replace_var(input_item, search_dict): def replace_var(input_item, search_dict):
return_item = str(input_item) return_item = str(input_item)
for rk, rv in search_dict.items(): for rk, rv in search_dict.items():
if f"<<{rk}>>" == return_item:
return_item = rv
if f"<<{rk}>>" in return_item: if f"<<{rk}>>" in return_item:
return_item = return_item.replace(f"<<{rk}>>", str(rv)) return_item = return_item.replace(f"<<{rk}>>", str(rv))
return return_item return return_item

Loading…
Cancel
Save