[6] cast limit to int

This commit is contained in:
meisnate12 2022-08-24 09:00:34 -04:00
parent 334e4d8fd2
commit 34779702cb
3 changed files with 11 additions and 5 deletions

View file

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

View file

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

View file

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