d
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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 [
|
||||
|
||||
@@ -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 [
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -834,6 +834,10 @@ class OpenLibrary(Provider):
|
||||
except Exception:
|
||||
return False, ""
|
||||
|
||||
@property
|
||||
def preserve_order(self) -> bool:
|
||||
return True
|
||||
|
||||
def search(
|
||||
self,
|
||||
query: str,
|
||||
|
||||
@@ -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] = []
|
||||
|
||||
@@ -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"},
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user