[21] mal_search fix

pull/1288/head
meisnate12 2 years ago
parent facfcba066
commit 0026e284b6

@ -1 +1 @@
1.18.3-develop20
1.18.3-develop21

@ -543,7 +543,10 @@ html_theme_options = {
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]
html_css_files = ["custom.css"]
html_css_files = [
"custom.css",
"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css"
]
def setup(app):
app.add_css_file("custom.css")

@ -1,5 +1,24 @@
# Frequently Asked Questions & Knowledgebase
## {}
{fas}`spinner;sd-text-primary`
- An icon {fas}`spinner;sd-text-primary`, some more text.
- An icon {fab}`github`, some more text.
- An icon {fab}`gitkraken;sd-text-success fa-xl`, some more text.
- An icon {fas}`skull;sd-text-danger`, some more text.
## ::
:fas:`spinner;sd-text-primary`
- An icon :fas:`spinner;sd-text-primary`, some more text.
- An icon :fab:`github`, some more text.
- An icon :fab:`gitkraken;sd-text-success fa-xl`, some more text.
- An icon :fas:`skull;sd-text-danger`, some more text.
This page aims to provide knowledge based on combined user experience, and to answer the frequent questions that we are asked in our [Discord Server](https://discord.gg/NfH6mGFuAB).
## Frequently Asked Questions

@ -1319,16 +1319,19 @@ class CollectionBuilder:
final_text += f"\nStatus: {final_attributes['status']}"
if "genre" in dict_methods:
genre_str = str(util.parse(self.Type, "genre", dict_data, methods=dict_methods, parent=method_name))
final_text += f"\nGenre: {util.parse_and_or(self.Type, 'Genre', genre_str, test_list=self.config.MyAnimeList.genres)}"
final_attributes["genres"] = genre_str
out_text, out_ints = util.parse_and_or(self.Type, 'Genre', genre_str, self.config.MyAnimeList.genres)
final_text += f"\nGenre: {out_text}"
final_attributes["genres"] = out_ints
if "genre.not" in dict_methods:
genre_str = str(util.parse(self.Type, "genre.not", dict_data, methods=dict_methods, parent=method_name))
final_text += f"\nNot Genre: {util.parse_and_or(self.Type, 'Genre', genre_str, test_list=self.config.MyAnimeList.genres)}"
final_attributes["genres_exclude"] = genre_str
out_text, out_ints = util.parse_and_or(self.Type, 'Genre', genre_str, self.config.MyAnimeList.genres)
final_text += f"\nNot Genre: {out_text}"
final_attributes["genres_exclude"] = out_ints
if "studio" in dict_methods:
studio_str = str(util.parse(self.Type, "studio", dict_data, methods=dict_methods, parent=method_name))
final_text += f"\nStudio: {util.parse_and_or(self.Type, 'Studio', studio_str, test_list=self.config.MyAnimeList.studios)}"
final_attributes["producers"] = studio_str
out_text, out_ints = util.parse_and_or(self.Type, 'Studio', studio_str, self.config.MyAnimeList.studios)
final_text += f"\nStudio: {out_text}"
final_attributes["producers"] = out_ints
if "content_rating" in dict_methods:
final_attributes["rating"] = util.parse(self.Type, "content_rating", dict_data, methods=dict_methods, parent=method_name, options=mal.search_ratings)
final_text += f"\nContent Rating: {final_attributes['rating']}"

@ -209,7 +209,7 @@ class DataFile:
remove_variables = []
optional = []
for tm in original_variables:
for tm in original_variables.copy():
if original_variables[tm] is None:
remove_variables.append(tm)
original_variables.pop(tm)
@ -385,12 +385,12 @@ class DataFile:
logger.trace(f"Condition {i} Failed: {var_key}: {'true does not exist' if var_value else 'false exists'}")
condition_passed = False
elif var_key.endswith(".not"):
if (isinstance(var_value, list) and variables[var_key] in var_value) or \
(not isinstance(var_value, list) and str(variables[var_key]) == str(var_value)):
if (isinstance(var_value, list) and variables[var_key[:-4]] in var_value) or \
(not isinstance(var_value, list) and str(variables[var_key[:-4]]) == str(var_value)):
if isinstance(var_value, list):
logger.trace(f'Condition {i} Failed: {var_key} "{variables[var_key]}" in {var_value}')
logger.trace(f'Condition {i} Failed: {var_key[:-4]} "{variables[var_key[:-4]]}" in {var_value}')
else:
logger.trace(f'Condition {i} Failed: {var_key} "{variables[var_key]}" is "{var_value}"')
logger.trace(f'Condition {i} Failed: {var_key[:-4]} "{variables[var_key[:-4]]}" is "{var_value}"')
condition_passed = False
elif var_key in variables:
if (isinstance(var_value, list) and variables[var_key] not in var_value) or \

@ -699,16 +699,22 @@ def check_int(value, datatype="int", minimum=1, maximum=None):
except ValueError:
pass
def parse_and_or(error, attribute, data, test_list=None):
def parse_and_or(error, attribute, data, test_list):
out = ""
final = ""
ands = [d.strip() for d in data.split(",")]
for an in ands:
ors = [a.strip() for a in an.split("|")]
or_num = []
for item in ors:
if not item:
raise Failed(f"{error} Error: Cannot have a blank {attribute}")
if test_list and str(item) not in test_list:
if str(item) not in test_list:
raise Failed(f"{error} Error: {attribute} {item} is invalid")
or_num.append(test_list[str(item)])
if final:
final += ","
final += "|".join(or_num)
if out:
out += f" and "
if len(ands) > 1 and len(ors) > 1:
@ -719,7 +725,7 @@ def parse_and_or(error, attribute, data, test_list=None):
out += test_list[test_list[str(ors[0])]] if test_list else ors[0]
if len(ands) > 1 and len(ors) > 1:
out += ")"
return out
return out, final
def parse(error, attribute, data, datatype=None, methods=None, parent=None, default=None, options=None, translation=None, minimum=1, maximum=None, regex=None, range_split=None):
display = f"{parent + ' ' if parent else ''}{attribute} attribute"

Loading…
Cancel
Save