d
This commit is contained in:
@@ -639,6 +639,42 @@ class AllDebrid(TableProviderMixin, Provider):
|
||||
URL = ("magnet:", "alldebrid:magnet:", "alldebrid:", "alldebrid🧲")
|
||||
URL_DOMAINS = ()
|
||||
|
||||
def extract_query_arguments(self, query: str) -> Tuple[str, Dict[str, Any]]:
|
||||
normalized = str(query or "").strip()
|
||||
filters: Dict[str, Any] = {}
|
||||
|
||||
# Pull out id=123 or id:123
|
||||
match = re.search(r"\bid\s*[=:]\s*(\d+)", normalized, flags=re.IGNORECASE)
|
||||
if match:
|
||||
filters["magnet_id"] = int(match.group(1))
|
||||
normalized = re.sub(
|
||||
r"\bid\s*[=:]\s*\d+", "", normalized, flags=re.IGNORECASE
|
||||
).strip()
|
||||
|
||||
if not normalized:
|
||||
normalized = "*"
|
||||
|
||||
return normalized, filters
|
||||
|
||||
def get_table_title(self, query: str, filters: Optional[Dict[str, Any]] = None) -> str:
|
||||
f = filters or {}
|
||||
magnet_id = f.get("magnet_id")
|
||||
if magnet_id is not None:
|
||||
return f"{self.label} Files: {magnet_id}"
|
||||
q = str(query or "").strip() or "*"
|
||||
return f"{self.label}: {q}"
|
||||
|
||||
def get_table_metadata(
|
||||
self, query: str, filters: Optional[Dict[str, Any]] = None
|
||||
) -> Dict[str, Any]:
|
||||
meta = super().get_table_metadata(query, filters)
|
||||
f = filters or {}
|
||||
magnet_id = f.get("magnet_id")
|
||||
meta["view"] = "files" if magnet_id is not None else "folders"
|
||||
if magnet_id is not None:
|
||||
meta["magnet_id"] = magnet_id
|
||||
return meta
|
||||
|
||||
@classmethod
|
||||
def config_schema(cls) -> List[Dict[str, Any]]:
|
||||
return [
|
||||
|
||||
Reference in New Issue
Block a user