added filepath filter #217

pull/240/head
meisnate12 4 years ago
parent 3c8d2bd2c2
commit 31b306905e

@ -119,6 +119,7 @@ all_filters = [
"content_rating", "content_rating.not", "content_rating", "content_rating.not",
"country", "country.not", "country", "country.not",
"director", "director.not", "director", "director.not",
"filepath", "filepath.not",
"genre", "genre.not", "genre", "genre.not",
"max_age", "max_age",
"originally_available.gte", "originally_available.lte", "originally_available.gte", "originally_available.lte",
@ -634,9 +635,9 @@ class CollectionBuilder:
valid_data = util.check_number(filter_data, f"{filter_method} filter", number_type="float", minimum=0.1, maximum=10) valid_data = util.check_number(filter_data, f"{filter_method} filter", number_type="float", minimum=0.1, maximum=10)
elif filter_method in ["originally_available.gte", "originally_available.lte"]: elif filter_method in ["originally_available.gte", "originally_available.lte"]:
valid_data = util.check_date(filter_data, f"{filter_method} filter") valid_data = util.check_date(filter_data, f"{filter_method} filter")
elif filter_method == "original_language": elif filter_method in ["original_language", "original_language.not"]:
valid_data = util.get_list(filter_data, lower=True) valid_data = util.get_list(filter_data, lower=True)
elif filter_method == "collection": elif filter_method in ["collection", "collection.not"]:
valid_data = filter_data if isinstance(filter_data, list) else [filter_data] valid_data = filter_data if isinstance(filter_data, list) else [filter_data]
elif filter_method in all_filters: elif filter_method in all_filters:
valid_data = util.get_list(filter_data) valid_data = util.get_list(filter_data)

@ -441,6 +441,17 @@ class PlexAPI:
if (jailbreak and modifier == ".not") or (not jailbreak and modifier != ".not"): if (jailbreak and modifier == ".not") or (not jailbreak and modifier != ".not"):
match = False match = False
break break
elif method_name == "filepath":
jailbreak = False
for location in current.locations:
for location_prefix in filter_data:
if location.startswith(location_prefix):
jailbreak = True
break
if jailbreak: break
if (jailbreak and modifier == ".not") or (not jailbreak and modifier != ".not"):
match = False
break
elif modifier in [".gte", ".lte"]: elif modifier in [".gte", ".lte"]:
if method_name == "vote_count": if method_name == "vote_count":
tmdb_item = None tmdb_item = None

Loading…
Cancel
Save