From 7aa7859e7949b206ba33e574aa2a10c5029b9dec Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Fri, 11 Mar 2022 09:10:23 -0500 Subject: [PATCH] fixed origin_country filter --- VERSION | 2 +- modules/builder.py | 4 +++- modules/util.py | 13 ++++++++----- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/VERSION b/VERSION index adcc7657..41c11ffb 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.16.0-develop18 +1.16.1 diff --git a/modules/builder.py b/modules/builder.py index fb4b9d5e..50487fcf 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -1719,7 +1719,9 @@ class CollectionBuilder: return valid_regex elif attribute in plex.string_attributes + string_filters and modifier in ["", ".not", ".is", ".isnot", ".begins", ".ends"]: return smart_pair(util.get_list(data, split=False)) - elif attribute in ["original_language", "origin_country", "tmdb_keyword"]: + elif attribute == "origin_country": + return util.get_list(data, upper=True) + elif attribute in ["original_language", "tmdb_keyword"]: return util.get_list(data, lower=True) elif attribute in ["filepath", "tmdb_genre"]: return util.get_list(data) diff --git a/modules/util.py b/modules/util.py index 22782236..b612e0a7 100644 --- a/modules/util.py +++ b/modules/util.py @@ -99,16 +99,19 @@ def add_dict_list(keys, value, dict_map): else: dict_map[key] = [value] -def get_list(data, lower=False, split=True, int_list=False): +def get_list(data, lower=False, upper=False, split=True, int_list=False): if data is None: return None - elif isinstance(data, list): return data + elif isinstance(data, list): list_data = data elif isinstance(data, dict): return [data] elif split is False: return [str(data)] - elif lower is True: return [d.strip().lower() for d in str(data).split(",")] + else: list_data = str(data).split(",") + + if lower is True: return [d.strip().lower() for d in list_data] + elif upper is True: return [d.strip().upper() for d in list_data] elif int_list is True: - try: return [int(d.strip()) for d in str(data).split(",")] + try: return [int(d.strip()) for d in list_data] except ValueError: return [] - else: return [d.strip() for d in str(data).split(",")] + else: return [d.strip() for d in list_data] def get_int_list(data, id_type): int_values = []