This commit is contained in:
2026-01-31 23:41:47 -08:00
parent 753cdfb196
commit 95748698fa
15 changed files with 218 additions and 128 deletions

View File

@@ -89,11 +89,34 @@ class Tidal(Provider):
https://tidal-api.binimum.org.
"""
_stringify = staticmethod(stringify)
def _stringify = staticmethod(stringify)
_extract_artists = staticmethod(extract_artists)
_build_track_tags = staticmethod(build_track_tags)
_coerce_duration_seconds = staticmethod(coerce_duration_seconds)
@property
def prefers_transfer_progress(self) -> bool:
return True
def _get_view(self, query: str) -> str:
text = str(query or "").strip()
if not text:
return "track"
if re.search(r"\balbum\s*:", text, flags=re.IGNORECASE):
return "album"
if re.search(r"\bartist\s*:", text, flags=re.IGNORECASE):
return "artist"
return "track"
def get_table_type(self, query: str, filters: Optional[Dict[str, Any]] = None) -> str:
view = self._get_view(query)
return f"tidal.{view}"
def get_table_metadata(self, query: str, filters: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
meta = super().get_table_metadata(query, filters)
meta["view"] = self._get_view(query)
return meta
def __init__(self, config: Optional[Dict[str, Any]] = None) -> None:
super().__init__(config)
self.api_urls = self._resolve_api_urls()

View File

@@ -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 [

View File

@@ -467,6 +467,9 @@ class InternetArchive(Provider):
"""
URL = ("archive.org",)
def get_table_type(self, query: str, filters: Optional[Dict[str, Any]] = None) -> str:
return "internetarchive.folder"
@classmethod
def config_schema(cls) -> List[Dict[str, Any]]:
return [

View File

@@ -14,6 +14,10 @@ class LOC(Provider):
Currently implements Chronicling America collection search via the LoC JSON API.
"""
@property
def preserve_order(self) -> bool:
return True
URL_DOMAINS = ["www.loc.gov"]
URL = URL_DOMAINS

View File

@@ -834,6 +834,10 @@ class OpenLibrary(Provider):
except Exception:
return False, ""
@property
def preserve_order(self) -> bool:
return True
def search(
self,
query: str,

View File

@@ -360,6 +360,10 @@ class ApiBayScraper(Scraper):
class Torrent(Provider):
TABLE_AUTO_STAGES = {"torrent": ["download-file"]}
@property
def preserve_order(self) -> bool:
return True
def __init__(self, config: Optional[Dict[str, Any]] = None) -> None:
super().__init__(config)
self.scrapers: List[Scraper] = []

View File

@@ -55,6 +55,9 @@ class Vimm(TableProviderMixin, Provider):
URL = ("https://vimm.net/vault/",)
URL_DOMAINS = ("vimm.net",)
def get_source_command(self, args_list: List[str]) -> Tuple[str, List[str]]:
return "search-file", ["-provider", self.name]
REGION_CHOICES = [
{"value": "1", "text": "Argentina"},
{"value": "2", "text": "Asia"},

View File

@@ -34,6 +34,10 @@ class YouTube(TableProviderMixin, Provider):
# If the user provides extra args on the selection stage, forward them to download-file.
AUTO_STAGE_USE_SELECTION_ARGS = True
@property
def preserve_order(self) -> bool:
return True
def search(
self,
query: str,