From 34779702cb7778b20dcfd0a94c3dabe3ffea75de Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Wed, 24 Aug 2022 09:00:34 -0400 Subject: [PATCH] [6] cast limit to int --- VERSION | 2 +- modules/builder.py | 12 ++++++++---- modules/meta.py | 2 ++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/VERSION b/VERSION index f82713c2..d296255f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.17.3-develop5 +1.17.3-develop6 diff --git a/modules/builder.py b/modules/builder.py index 731bca7a..b9f88f7f 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -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: diff --git a/modules/meta.py b/modules/meta.py index 30e750b8..523f99c3 100644 --- a/modules/meta.py +++ b/modules/meta.py @@ -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