f
This commit is contained in:
@@ -1278,7 +1278,7 @@ class HIFI(Provider):
|
||||
)
|
||||
return materialized
|
||||
|
||||
def handle_url(self, url: str, *, output_dir: Optional[Path] = None) -> Tuple[bool, Optional[Path]]:
|
||||
def handle_url(self, url: str, *, output_dir: Optional[Path] = None) -> Tuple[bool, Optional[Path | Dict[str, Any]]]:
|
||||
view, identifier = self._parse_tidal_url(url)
|
||||
if not view:
|
||||
return False, None
|
||||
|
||||
@@ -1265,7 +1265,7 @@ class Tidal(Provider):
|
||||
)
|
||||
return materialized
|
||||
|
||||
def handle_url(self, url: str, *, output_dir: Optional[Path] = None) -> Tuple[bool, Optional[Path]]:
|
||||
def handle_url(self, url: str, *, output_dir: Optional[Path] = None) -> Tuple[bool, Optional[Path | Dict[str, Any]]]:
|
||||
view, identifier = self._parse_tidal_url(url)
|
||||
if not view:
|
||||
return False, None
|
||||
|
||||
@@ -585,7 +585,7 @@ class AllDebrid(TableProviderMixin, Provider):
|
||||
URL_DOMAINS = ()
|
||||
|
||||
@classmethod
|
||||
def config(cls) -> List[Dict[str, Any]]:
|
||||
def config_schema(cls) -> List[Dict[str, Any]]:
|
||||
return [
|
||||
{
|
||||
"key": "api_key",
|
||||
@@ -646,7 +646,7 @@ class AllDebrid(TableProviderMixin, Provider):
|
||||
return spec
|
||||
return resolve_magnet_spec(str(target)) if isinstance(target, str) else None
|
||||
|
||||
def handle_url(self, url: str, *, output_dir: Optional[Path] = None) -> Tuple[bool, Optional[Path]]:
|
||||
def handle_url(self, url: str, *, output_dir: Optional[Path] = None) -> Tuple[bool, Optional[Path | Dict[str, Any]]]:
|
||||
magnet_id = _parse_alldebrid_magnet_id(url)
|
||||
if magnet_id is not None:
|
||||
return True, {
|
||||
|
||||
@@ -2,7 +2,7 @@ from __future__ import annotations
|
||||
|
||||
import os
|
||||
import sys
|
||||
from typing import Any, Dict, Optional
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
from ProviderCore.base import Provider
|
||||
from SYS.logger import log
|
||||
@@ -53,7 +53,7 @@ class FileIO(Provider):
|
||||
PROVIDER_NAME = "file.io"
|
||||
|
||||
@classmethod
|
||||
def config(cls) -> List[Dict[str, Any]]:
|
||||
def config_schema(cls) -> List[Dict[str, Any]]:
|
||||
return [
|
||||
{
|
||||
"key": "api_key",
|
||||
|
||||
@@ -468,7 +468,7 @@ class InternetArchive(Provider):
|
||||
URL = ("archive.org",)
|
||||
|
||||
@classmethod
|
||||
def config(cls) -> List[Dict[str, Any]]:
|
||||
def config_schema(cls) -> List[Dict[str, Any]]:
|
||||
return [
|
||||
{
|
||||
"key": "access_key",
|
||||
|
||||
@@ -235,7 +235,7 @@ class Matrix(TableProviderMixin, Provider):
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def config(cls) -> List[Dict[str, Any]]:
|
||||
def config_schema(cls) -> List[Dict[str, Any]]:
|
||||
return [
|
||||
{
|
||||
"key": "homeserver",
|
||||
|
||||
@@ -287,7 +287,7 @@ class OpenLibrary(Provider):
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def config(cls) -> List[Dict[str, Any]]:
|
||||
def config_schema(cls) -> List[Dict[str, Any]]:
|
||||
return [
|
||||
{
|
||||
"key": "email",
|
||||
|
||||
@@ -245,7 +245,7 @@ class Soulseek(Provider):
|
||||
return False
|
||||
|
||||
@classmethod
|
||||
def config(cls) -> List[Dict[str, Any]]:
|
||||
def config_schema(cls) -> List[Dict[str, Any]]:
|
||||
return [
|
||||
{
|
||||
"key": "username",
|
||||
@@ -325,6 +325,10 @@ class Soulseek(Provider):
|
||||
)
|
||||
return None
|
||||
|
||||
# Cast to str for Mypy
|
||||
username = str(username)
|
||||
filename = str(filename)
|
||||
|
||||
# Use tempfile directory as default if generic path elements were passed or None.
|
||||
if output_dir is None:
|
||||
import tempfile
|
||||
@@ -363,10 +367,13 @@ class Soulseek(Provider):
|
||||
target_dir = Path(tempfile.gettempdir()) / "Medios" / "Soulseek"
|
||||
|
||||
asyncio.set_event_loop(loop)
|
||||
# Cast to str for Mypy
|
||||
username_str = str(username)
|
||||
filename_str = str(filename)
|
||||
return loop.run_until_complete(
|
||||
download_soulseek_file(
|
||||
username=username,
|
||||
filename=filename,
|
||||
username=username_str,
|
||||
filename=filename_str,
|
||||
output_dir=target_dir,
|
||||
timeout=self.MAX_WAIT_TRANSFER,
|
||||
)
|
||||
|
||||
@@ -7,7 +7,7 @@ import sys
|
||||
import time
|
||||
import threading
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict, Optional, Sequence, Tuple
|
||||
from typing import Any, Dict, List, Optional, Sequence, Tuple
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from ProviderCore.base import Provider, SearchResult
|
||||
@@ -150,7 +150,7 @@ class Telegram(Provider):
|
||||
URL = ("t.me", "telegram.me")
|
||||
|
||||
@classmethod
|
||||
def config(cls) -> List[Dict[str, Any]]:
|
||||
def config_schema(cls) -> List[Dict[str, Any]]:
|
||||
return [
|
||||
{
|
||||
"key": "app_id",
|
||||
@@ -1175,7 +1175,7 @@ class Telegram(Provider):
|
||||
raise ValueError("Not a Telegram URL")
|
||||
return self._download_message_media_sync(url=url, output_dir=output_dir)
|
||||
|
||||
def handle_url(self, url: str, *, output_dir: Optional[Path] = None) -> Tuple[bool, Optional[Path]]:
|
||||
def handle_url(self, url: str, *, output_dir: Optional[Path] = None) -> Tuple[bool, Optional[Path | Dict[str, Any]]]:
|
||||
"""Optional provider override to parse and act on URLs."""
|
||||
if not _looks_like_telegram_message_url(url):
|
||||
return False, None
|
||||
|
||||
Reference in New Issue
Block a user