|
|
@ -16,6 +16,7 @@ method_alias = {
|
|
|
|
"directors": "director",
|
|
|
|
"directors": "director",
|
|
|
|
"genres": "genre",
|
|
|
|
"genres": "genre",
|
|
|
|
"labels": "label",
|
|
|
|
"labels": "label",
|
|
|
|
|
|
|
|
"rating": "critic_rating",
|
|
|
|
"studios": "studio",
|
|
|
|
"studios": "studio",
|
|
|
|
"networks": "network",
|
|
|
|
"networks": "network",
|
|
|
|
"producers": "producer",
|
|
|
|
"producers": "producer",
|
|
|
@ -124,7 +125,8 @@ all_filters = [
|
|
|
|
"tmdb_vote_count.gte", "tmdb_vote_count.lte",
|
|
|
|
"tmdb_vote_count.gte", "tmdb_vote_count.lte",
|
|
|
|
"duration.gte", "duration.lte",
|
|
|
|
"duration.gte", "duration.lte",
|
|
|
|
"original_language", "original_language.not",
|
|
|
|
"original_language", "original_language.not",
|
|
|
|
"rating.gte", "rating.lte",
|
|
|
|
"audience_rating.gte", "audience_rating.lte",
|
|
|
|
|
|
|
|
"critic_rating.gte", "critic_rating.lte",
|
|
|
|
"studio", "studio.not",
|
|
|
|
"studio", "studio.not",
|
|
|
|
"subtitle_language", "subtitle_language.not",
|
|
|
|
"subtitle_language", "subtitle_language.not",
|
|
|
|
"video_resolution", "video_resolution.not",
|
|
|
|
"video_resolution", "video_resolution.not",
|
|
|
@ -542,11 +544,13 @@ class CollectionBuilder:
|
|
|
|
return default_in
|
|
|
|
return default_in
|
|
|
|
if method_name == "filters":
|
|
|
|
if method_name == "filters":
|
|
|
|
for filter_name, filter_data in method_data.items():
|
|
|
|
for filter_name, filter_data in method_data.items():
|
|
|
|
if filter_name.lower() in method_alias or (filter_name.lower().endswith(".not") and filter_name.lower()[:-4] in method_alias):
|
|
|
|
modifier = filter_name[-4:].lower()
|
|
|
|
filter_method = (method_alias[filter_name.lower()[:-4]] + filter_name.lower()[-4:]) if filter_name.lower().endswith(".not") else method_alias[filter_name.lower()]
|
|
|
|
method = filter_name[:-4].lower() if modifier in [".not", ".lte", ".gte"] else filter_name.lower()
|
|
|
|
|
|
|
|
if method in method_alias:
|
|
|
|
|
|
|
|
filter_method = f"{method_alias[method]}{modifier}"
|
|
|
|
logger.warning(f"Collection Warning: {filter_name} filter will run as {filter_method}")
|
|
|
|
logger.warning(f"Collection Warning: {filter_name} filter will run as {filter_method}")
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
filter_method = filter_name.lower()
|
|
|
|
filter_method = f"{method}{modifier}"
|
|
|
|
if filter_method in movie_only_filters and self.library.is_show:
|
|
|
|
if filter_method in movie_only_filters and self.library.is_show:
|
|
|
|
raise Failed(f"Collection Error: {filter_method} filter only works for movie libraries")
|
|
|
|
raise Failed(f"Collection Error: {filter_method} filter only works for movie libraries")
|
|
|
|
elif filter_data is None:
|
|
|
|
elif filter_data is None:
|
|
|
@ -557,7 +561,7 @@ class CollectionBuilder:
|
|
|
|
valid_data = util.check_number(filter_data, f"{filter_method} filter", minimum=1)
|
|
|
|
valid_data = util.check_number(filter_data, f"{filter_method} filter", minimum=1)
|
|
|
|
elif filter_method in ["year.gte", "year.lte"]:
|
|
|
|
elif filter_method in ["year.gte", "year.lte"]:
|
|
|
|
valid_data = util.check_year(filter_data, current_year, f"{filter_method} filter")
|
|
|
|
valid_data = util.check_year(filter_data, current_year, f"{filter_method} filter")
|
|
|
|
elif filter_method in ["rating.gte", "rating.lte"]:
|
|
|
|
elif filter_method in ["audience_rating.gte", "audience_rating.lte", "critic_rating.gte", "critic_rating.lte"]:
|
|
|
|
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")
|
|
|
@ -639,7 +643,7 @@ class CollectionBuilder:
|
|
|
|
elif (search == "decade" and modifier in [""]) \
|
|
|
|
elif (search == "decade" and modifier in [""]) \
|
|
|
|
or (search == "year" and modifier in [".greater", ".less"]):
|
|
|
|
or (search == "year" and modifier in [".greater", ".less"]):
|
|
|
|
searches[search_final] = [util.check_year(search_data, current_year, search_final)]
|
|
|
|
searches[search_final] = [util.check_year(search_data, current_year, search_final)]
|
|
|
|
elif search in ["added", "originally_available"] and modifier in [".before", ".after"]:
|
|
|
|
elif search in ["added", "originally_available"] and modifier in ["", ".not", ".before", ".after"]:
|
|
|
|
searches[search_final] = [util.check_date(search_data, search_final, return_string=True, plex_date=True)]
|
|
|
|
searches[search_final] = [util.check_date(search_data, search_final, return_string=True, plex_date=True)]
|
|
|
|
elif search in ["duration", "rating"] and modifier in [".greater", ".less"]:
|
|
|
|
elif search in ["duration", "rating"] and modifier in [".greater", ".less"]:
|
|
|
|
searches[search_final] = [util.check_number(search_data, search_final, minimum=0)]
|
|
|
|
searches[search_final] = [util.check_number(search_data, search_final, minimum=0)]
|
|
|
@ -648,7 +652,7 @@ class CollectionBuilder:
|
|
|
|
elif (search in ["title", "studio"] and modifier not in ["", ".and", ".not", ".begins", ".ends"]) \
|
|
|
|
elif (search in ["title", "studio"] and modifier not in ["", ".and", ".not", ".begins", ".ends"]) \
|
|
|
|
or (search in ["actor", "audio_language", "collection", "content_rating", "country", "director", "genre", "label", "network", "producer", "subtitle_language", "writer"] and modifier not in ["", ".and", ".not"]) \
|
|
|
|
or (search in ["actor", "audio_language", "collection", "content_rating", "country", "director", "genre", "label", "network", "producer", "subtitle_language", "writer"] and modifier not in ["", ".and", ".not"]) \
|
|
|
|
or (search in ["resolution", "decade"] and modifier not in [""]) \
|
|
|
|
or (search in ["resolution", "decade"] and modifier not in [""]) \
|
|
|
|
or (search in ["added", "originally_available"] and modifier not in [".before", ".after"]) \
|
|
|
|
or (search in ["added", "originally_available"] and modifier not in ["", ".not", ".before", ".after"]) \
|
|
|
|
or (search in ["duration", "rating"] and modifier not in [".greater", ".less"]) \
|
|
|
|
or (search in ["duration", "rating"] and modifier not in [".greater", ".less"]) \
|
|
|
|
or (search in ["year"] and modifier not in ["", ".not", ".greater", ".less"]):
|
|
|
|
or (search in ["year"] and modifier not in ["", ".not", ".greater", ".less"]):
|
|
|
|
raise Failed(f"Collection Error: modifier: {modifier} not supported with the {search} plex search attribute")
|
|
|
|
raise Failed(f"Collection Error: modifier: {modifier} not supported with the {search} plex search attribute")
|
|
|
|