Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
refactor: remove dead apprise code
NTFSvolume1c6102f8df74
diff --git a/cyberdrop_dl/cli/main.py b/cyberdrop_dl/cli/main.pyindex eda3e3be3..56b015705 100644--- a/cyberdrop_dl/cli/main.py+++ b/cyberdrop_dl/cli/main.py@@ -17,6 +17,7 @@ from cyberdrop_dl.exceptions import CDLConfigRuntimeErrorsGroupfrom cyberdrop_dl.logs import log_spacer, set_console_level, setup_file_loggingfrom cyberdrop_dl.models import merge_modelsfrom cyberdrop_dl.models.types import HttpURL # noqa: TC001+from cyberdrop_dl.utils import cleanup_INTERACTIVE: ContextVar[bool] = ContextVar("_INTERACTIVE", default=False)logger = logging.getLogger(__name__)@@ -25,7 +26,6 @@ if TYPE_CHECKING:from cyclopts.argument import ArgumentCollectionfrom cyberdrop_dl.manager import Manager- from cyberdrop_dl.utils import cleanup # noqa: TC004async def _scrape(manager: Manager) -> None:@@ -217,7 +217,6 @@ def _check_ffmpeg(config: Config) -> None:def _perform_cleanup(config: Config) -> None:- from cyberdrop_dl.utils import cleanuplogger.info("Checking for partial downloads...")if cleanup.has_partial_files(config.download_folder):diff --git a/cyberdrop_dl/utils/apprise.py b/cyberdrop_dl/utils/apprise.pyindex 291eaf6a2..a061baa1f 100644--- a/cyberdrop_dl/utils/apprise.py+++ b/cyberdrop_dl/utils/apprise.py@@ -30,17 +30,6 @@ class _AppriseMessage:attachment: str | None = None-def read_apprise_urls(file: Path) -> tuple[str, ...]:- try:- with file.open(encoding="utf8") as fp:- return tuple(url for line in fp if (url := line.strip()) and not url.startswith("#"))- except FileNotFoundError:- return ()- except OSError:- logger.exception(f"Unable to read apprise URL from '{file}'. Ignoring")- return ()--async def notify(urls: Sequence[AppriseURL], body: str) -> None:if not urls:returndiff --git a/tests/test_apprise.py b/tests/test_apprise.pydeleted file mode 100644index fbde301fc..000000000--- a/tests/test_apprise.py+++ /dev/null@@ -1,57 +0,0 @@-import logging-import os-from pathlib import Path--import pytest--from cyberdrop_dl.utils.apprise import read_apprise_urls---class TestReadAppriseUrls:- def test_valid_file(self, tmp_path: Path) -> None:- apprise_file = tmp_path / "urls.txt"- _ = apprise_file.write_text(- "\n".join(- (- "mailto://user:[email protected]",- " ",- "# comment",- "tgram://bottoken/chatid\n",- )- )- )- assert read_apprise_urls(apprise_file) == (- "mailto://user:[email protected]",- "tgram://bottoken/chatid",- )-- def test_empty_file(self, tmp_path: Path) -> None:- apprise_file = tmp_path / "empty.txt"- apprise_file.touch()- assert read_apprise_urls(apprise_file) == ()-- def test_only_comments_and_whitespace(self, tmp_path: Path) -> None:- apprise_file = tmp_path / "comments.txt"- _ = apprise_file.write_text("\n".join(("# line1\n", " # line2\n\t\n")))- assert read_apprise_urls(apprise_file) == ()-- def test_missing_file_does_not_raise_error(self, tmp_path: Path, caplog: pytest.LogCaptureFixture) -> None:- apprise_file = tmp_path / "gone.txt"- with caplog.at_level(logging.ERROR):- assert read_apprise_urls(apprise_file) == ()-- assert "Unable to read apprise URL" not in caplog.text-- @pytest.mark.skipif(os.name == "nt", reason="chmod not on Windows")- def test_permission_error(self, tmp_path: Path, caplog: pytest.LogCaptureFixture) -> None:- apprise_file = tmp_path / "no_access.txt"- _ = apprise_file.write_text("mailto://[email protected]")-- _ = apprise_file.chmod(0o000)- try:- with caplog.at_level(logging.ERROR):- assert read_apprise_urls(apprise_file) == ()-- assert "Unable to read apprise URL" in caplog.text- finally:- _ = apprise_file.chmod(0o644) # restore for cleanup