update
This commit is contained in:
@@ -863,6 +863,36 @@ def plugin_inline_query_choices(
|
||||
return []
|
||||
|
||||
|
||||
def plugin_query_field_map(
|
||||
plugin_name: str,
|
||||
config: Optional[Dict[str, Any]] = None,
|
||||
) -> Dict[str, List[str]]:
|
||||
pname = str(plugin_name or "").strip().lower()
|
||||
if not pname:
|
||||
return {}
|
||||
try:
|
||||
info = REGISTRY.get(pname)
|
||||
if info is not None:
|
||||
mapping = collect_choice(info.plugin_class)
|
||||
else:
|
||||
plugin = get_plugin(pname, config)
|
||||
if plugin is None:
|
||||
return {}
|
||||
mapping = collect_choice(plugin)
|
||||
result: Dict[str, List[str]] = {}
|
||||
for field, choices in mapping.items():
|
||||
texts = []
|
||||
for c in choices:
|
||||
text = str(c.get("text") or c.get("value") or "")
|
||||
if text:
|
||||
texts.append(text)
|
||||
if texts:
|
||||
result[field] = texts
|
||||
return result
|
||||
except Exception:
|
||||
return {}
|
||||
|
||||
|
||||
def get_plugin_for_url(url: str,
|
||||
config: Optional[Dict[str, Any]] = None) -> Optional[Provider]:
|
||||
name = match_plugin_name_for_url(url)
|
||||
|
||||
Reference in New Issue
Block a user