From a01766c60bda9e1554cc024b191dae0dcb3dbe19 Mon Sep 17 00:00:00 2001 From: rlaphoenix Date: Wed, 31 May 2023 23:04:48 +0100 Subject: [PATCH] Remove the saldl downloader --- devine/core/downloaders/__init__.py | 6 ++-- devine/core/downloaders/saldl.py | 51 ----------------------------- 2 files changed, 2 insertions(+), 55 deletions(-) delete mode 100644 devine/core/downloaders/saldl.py diff --git a/devine/core/downloaders/__init__.py b/devine/core/downloaders/__init__.py index 8e20291..5c0434e 100644 --- a/devine/core/downloaders/__init__.py +++ b/devine/core/downloaders/__init__.py @@ -2,14 +2,12 @@ import asyncio from .aria2c import aria2c from .requests import requests -from .saldl import saldl from ..config import config downloader = { "aria2c": lambda *args, **kwargs: asyncio.run(aria2c(*args, **kwargs)), - "requests": requests, - "saldl": lambda *args, **kwargs: asyncio.run(saldl(*args, **kwargs)) + "requests": requests }[config.downloader] -__ALL__ = (downloader, aria2c, requests, saldl) +__ALL__ = (downloader, aria2c, requests) diff --git a/devine/core/downloaders/saldl.py b/devine/core/downloaders/saldl.py deleted file mode 100644 index 34166d1..0000000 --- a/devine/core/downloaders/saldl.py +++ /dev/null @@ -1,51 +0,0 @@ -import subprocess -from pathlib import Path -from typing import Optional, Union - -from devine.core.utilities import get_binary_path - - -async def saldl( - uri: Union[str, list[str]], - out: Union[Path, str], - headers: Optional[dict] = None, - proxy: Optional[str] = None -) -> int: - out = Path(out) - - if headers: - headers.update({k: v for k, v in headers.items() if k.lower() != "accept-encoding"}) - - executable = get_binary_path("saldl", "saldl-win64", "saldl-win32") - if not executable: - raise EnvironmentError("Saldl executable not found...") - - arguments = [ - executable, - # "--no-status", - "--skip-TLS-verification", - "--resume", - "--merge-in-order", - "-c8", - "--auto-size", "1", - "-D", str(out.parent), - "-o", out.name - ] - - if headers: - arguments.extend([ - "--custom-headers", - "\r\n".join([f"{k}: {v}" for k, v in headers.items()]) - ]) - - if proxy: - arguments.extend(["--proxy", proxy]) - - if isinstance(uri, list): - raise ValueError("Saldl code does not yet support multiple uri (e.g. segmented) downloads.") - arguments.append(uri) - - return subprocess.check_call(arguments) - - -__ALL__ = (saldl,)