[61] add .rated

pull/949/head
meisnate12 2 years ago
parent 345d6c1f4a
commit fb03658c72

@ -1 +1 @@
1.17.0-develop60
1.17.0-develop61

@ -247,7 +247,7 @@ No date search can take multiple values.
## Number Searches
Number searches must use `.gt`, `.gte`, `.lt`, or `.lte` as a modifier.
Number searches must use `.gt`, `.gte`, `.lt`, or `.lte` as a modifier only the rating searches can use `.rated`.
No number search can take multiple values.
@ -259,6 +259,9 @@ No number search can take multiple values.
| `.gte` | Matches every item where the number attribute is greater than or equal to the given number<br>**Format:** number<br>**Example:** `30`, `1995`, or `7.5` | N/A |
| `.lt` | Matches every item where the number attribute is less than the given number<br>**Format:** number<br>**Example:** `30`, `1995`, or `7.5` | `is less than` |
| `.lte` | Matches every item where the number attribute is less than or equal to the given number<br>**Format:** number<br>**Example:** `30`, `1995`, or `7.5` | N/A |
| `.rated` | Matches every item either rated or not rated<br>**Format:** `true` or `false` | N/A |
* `.rated` only works for rating searches
### Number Attributes

@ -215,7 +215,7 @@ No date filter can take multiple values.
## Number Filters
Number filters must use `.gt`, `.gte`, `.lt`, or `.lte` as a modifier.
Number filters must use `.gt`, `.gte`, `.lt`, or `.lte` as a modifier only the rating filters can use `.rated`.
No number filter can take multiple values.
@ -227,6 +227,9 @@ No number filter can take multiple values.
| `.gte` | Matches every item where the number attribute is greater than or equal to the given number<br>**Format:** number<br>**Example:** `30`, `1995`, or `7.5` | N/A |
| `.lt` | Matches every item where the number attribute is less than the given number<br>**Format:** number<br>**Example:** `30`, `1995`, or `7.5` | `is less than` |
| `.lte` | Matches every item where the number attribute is less than or equal to the given number<br>**Format:** number<br>**Example:** `30`, `1995`, or `7.5` | N/A |
| `.rated` | Matches every item either rated or not rated<br>**Format:** `true` or `false` | N/A |
* `.rated` only works for rating filters
### Number Attributes

@ -1802,6 +1802,8 @@ class CollectionBuilder:
results, display_add = build_url_arg(f"-{validation}", mod=last_mod, arg_s=f"{validation} {plex.date_sub_mods[search_mod]}", mod_s=last_text)
elif attr == "duration" and modifier in [".gt", ".gte", ".lt", ".lte"]:
results, display_add = build_url_arg(validation * 60000)
elif modifier == ".rated":
results, display_add = build_url_arg(-1, mod="%3D" if validation else "!%3D", arg_s="Rated", mod_s="is" if validation else "is not")
elif attr in plex.boolean_attributes:
bool_mod = "" if validation else "!"
bool_arg = "true" if validation else "false"
@ -1962,7 +1964,7 @@ class CollectionBuilder:
return util.parse(self.Type, final, data, datatype="int", minimum=0)
elif attribute in float_attributes and modifier in ["", ".not", ".gt", ".gte", ".lt", ".lte"]:
return util.parse(self.Type, final, data, datatype="float", minimum=0, maximum=None if attribute == "duration" else 10)
elif attribute in boolean_attributes:
elif attribute in boolean_attributes or (attribute in float_attributes and modifier in [".rated"]):
return util.parse(self.Type, attribute, data, datatype="bool")
elif attribute in ["seasons", "episodes", "albums", "tracks"]:
if isinstance(data, dict) and data:

@ -73,9 +73,15 @@ class DataFile:
def get_file_name(self):
data = f"{util.github_base}{self.path}.yml" if self.type == "GIT" else self.path
if "/" in data:
if data.endswith(".yml"):
return data[data.rfind("/") + 1:-4]
else:
return data[data.rfind("/") + 1:]
elif "\\" in data:
if data.endswith(".yml"):
return data[data.rfind("\\") + 1:-4]
else:
return data[data.rfind("\\") + 1:]
else:
return data

@ -70,7 +70,7 @@ class Overlays:
logger.info("")
if not self.library.remove_overlays:
logger.info("")
logger.separator(f"Applying Overlays for the {self.library.name} Library")
logger.separator(f"{'Re-' if self.library.reapply_overlays else ''}Applying Overlays for the {self.library.name} Library")
logger.info("")
for i, (over_key, (item, over_names)) in enumerate(sorted(key_to_overlays.items(), key=lambda io: self.library.get_item_sort_title(io[1][0])), 1):
try:

@ -117,7 +117,7 @@ show_translation = {
}
modifier_translation = {
"": "", ".not": "!", ".is": "%3D", ".isnot": "!%3D", ".gt": "%3E%3E", ".gte": "%3E", ".lt": "%3C%3C", ".lte": "%3C",
".before": "%3C%3C", ".after": "%3E%3E", ".begins": "%3C", ".ends": "%3E", ".regex": ""
".before": "%3C%3C", ".after": "%3E%3E", ".begins": "%3C", ".ends": "%3E", ".regex": "", ".rated": ""
}
attribute_translation = {
"aspect": "aspectRatio",
@ -248,9 +248,9 @@ show_only_searches = [
"episode_air_date.before", "episode_air_date.after",
"episode_last_played", "episode_last_played.not", "episode_last_played.before", "episode_last_played.after",
"episode_plays.gt", "episode_plays.gte", "episode_plays.lt", "episode_plays.lte",
"episode_user_rating.gt", "episode_user_rating.gte", "episode_user_rating.lt", "episode_user_rating.lte",
"episode_critic_rating.gt", "episode_critic_rating.gte", "episode_critic_rating.lt", "episode_critic_rating.lte",
"episode_audience_rating.gt", "episode_audience_rating.gte", "episode_audience_rating.lt", "episode_audience_rating.lte",
"episode_user_rating.gt", "episode_user_rating.gte", "episode_user_rating.lt", "episode_user_rating.lte", "episode_user_rating.rated",
"episode_critic_rating.gt", "episode_critic_rating.gte", "episode_critic_rating.lt", "episode_critic_rating.lte", "episode_critic_rating.rated",
"episode_audience_rating.gt", "episode_audience_rating.gte", "episode_audience_rating.lt", "episode_audience_rating.lte", "episode_audience_rating.rated",
"episode_year", "episode_year.not", "episode_year.gt", "episode_year.gte", "episode_year.lt", "episode_year.lte",
"unplayed_episodes", "episode_unplayed", "episode_duplicate", "episode_progress", "episode_unmatched", "show_unmatched",
]
@ -269,11 +269,12 @@ date_attributes = [
date_modifiers = ["", ".not", ".before", ".after"]
year_attributes = ["decade", "year", "episode_year", "album_year", "album_decade"]
number_attributes = ["plays", "episode_plays", "album_plays", "track_plays", "track_skips"] + year_attributes
number_modifiers = [".gt", ".gte", ".lt", ".lte"]
float_attributes = [
"user_rating", "episode_user_rating", "critic_rating", "episode_critic_rating", "audience_rating", "episode_audience_rating",
"duration", "artist_user_rating", "album_user_rating", "album_critic_rating", "track_user_rating"
]
number_modifiers = [".gt", ".gte", ".lt", ".lte"]
float_modifiers = number_modifiers + [".rated"]
search_display = {"added": "Date Added", "release": "Release Date", "hdr": "HDR", "progress": "In Progress", "episode_progress": "Episode In Progress"}
tag_attributes = [
"actor", "audio_language", "collection", "content_rating", "country", "director", "genre", "label", "network",
@ -287,7 +288,8 @@ searches = boolean_attributes + \
[f"{f}{m}" for f in string_attributes for m in string_modifiers] + \
[f"{f}{m}" for f in tag_attributes + year_attributes for m in tag_modifiers if f not in no_not_mods or m != ".not"] + \
[f"{f}{m}" for f in date_attributes for m in date_modifiers] + \
[f"{f}{m}" for f in number_attributes + float_attributes for m in number_modifiers if f not in no_not_mods]
[f"{f}{m}" for f in number_attributes for m in number_modifiers if f not in no_not_mods] + \
[f"{f}{m}" for f in float_attributes for m in float_modifiers if f != "duration" and m != ".rated"]
music_searches = [a for a in searches if a.startswith(("artist", "album", "track"))]
movie_sorts = {
"title.asc": "titleSort", "title.desc": "titleSort%3Adesc",

Loading…
Cancel
Save