This commit is contained in:
2026-02-11 18:16:07 -08:00
parent cc715e1fef
commit 1d0de1118b
27 changed files with 1167 additions and 1075 deletions

View File

@@ -141,6 +141,10 @@ class Provider(ABC):
# Used for dynamically generating config panels (e.g., missing credentials).
REQUIRED_CONFIG_KEYS: Sequence[str] = ()
# Some providers implement `upload()` but are not intended to be used as
# generic "file host" providers via `add-file -provider ...`.
EXPOSE_AS_FILE_PROVIDER: bool = True
def __init__(self, config: Optional[Dict[str, Any]] = None):
self.config = config or {}
# Prioritize explicit NAME property for the instance name
@@ -233,6 +237,35 @@ class Provider(ABC):
normalized = str(query or "").strip()
return normalized, {}
def postprocess_search_results(
self,
*,
query: str,
results: List[SearchResult],
filters: Optional[Dict[str, Any]] = None,
limit: int = 50,
table_type: str = "",
table_meta: Optional[Dict[str, Any]] = None,
) -> Tuple[List[SearchResult], Optional[str], Optional[Dict[str, Any]]]:
"""Optional hook for provider-specific result transforms.
Cmdlets should avoid hardcoding provider quirks. Providers can override
this to:
- expand/replace result sets (e.g., artist -> albums)
- override the table type
- override table metadata
Returns:
(results, table_type_override, table_meta_override)
"""
_ = query
_ = filters
_ = limit
_ = table_type
_ = table_meta
return results, None, None
# Standard lifecycle/auth hook.
def login(self, **_kwargs: Any) -> bool:
return True