fixed origin_country filter

This commit is contained in:
meisnate12 2022-03-11 09:10:23 -05:00
parent 709d95e286
commit 7aa7859e79
3 changed files with 12 additions and 7 deletions

View file

@ -1 +1 @@
1.16.0-develop18
1.16.1

View file

@ -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)

View file

@ -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 = []