Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
fix: only install pywin32 on cpython (#1207)
NTFSvolumece4378cfcf53
diff --git a/cyberdrop_dl/downloader/downloader.py b/cyberdrop_dl/downloader/downloader.pyindex 80c288c49..b58bac455 100644--- a/cyberdrop_dl/downloader/downloader.py+++ b/cyberdrop_dl/downloader/downloader.py@@ -31,10 +31,17 @@ from cyberdrop_dl.utils.utilities import error_handling_wrapper, get_size_or_nonWIN_EPOCH_OFFSET = 116444736e9MAC_OS_SET_FILE = None++class Win32Con:+ FILE_WRITE_ATTRIBUTES = 256+ OPEN_EXISTING = 3+ FILE_ATTRIBUTE_NORMAL = 128+ FILE_FLAG_BACKUP_SEMANTICS = 33554432++if sys.platform == "win32":from ctypes import byref, windll, wintypes- import win32conelif sys.platform == "darwin":# SetFile is non standard in macOS. Only users that have xcode installed will have SetFile@@ -280,13 +287,13 @@ class Downloader:# Windows dates are 64bits, split into 2 32bits unsigned ints (dwHighDateTime , dwLowDateTime)# XOR to get the date as bytes, then shift to get the first 32 bits (dwHighDateTime)ctime = wintypes.FILETIME(timestamp & 0xFFFFFFFF, timestamp >> 32)- access_mode = 256 # FILE_WRITE_ATTRIBUTES+ access_mode = Win32Con.FILE_WRITE_ATTRIBUTESsharing_mode = 0 # Exclusive accesssecurity_mode = None # Use default security attributes- creation_disposition = win32con.OPEN_EXISTING+ creation_disposition = Win32Con.OPEN_EXISTING# FILE_FLAG_BACKUP_SEMANTICS allows access to directories- flags = win32con.FILE_ATTRIBUTE_NORMAL | win32con.FILE_FLAG_BACKUP_SEMANTICS+ flags = Win32Con.FILE_ATTRIBUTE_NORMAL | Win32Con.FILE_FLAG_BACKUP_SEMANTICStemplate_file = Noneparams = (diff --git a/cyberdrop_dl/managers/config_manager.py b/cyberdrop_dl/managers/config_manager.pyindex 1750f0dc1..15dc04783 100644--- a/cyberdrop_dl/managers/config_manager.py+++ b/cyberdrop_dl/managers/config_manager.py@@ -197,8 +197,13 @@ class ConfigManager:if apprise_fixed:returnif os.name == "nt":- with self.apprise_file.open("a", encoding="utf8") as f:- f.write("windows://\n")+ try:+ import win32con # noqa: F401+ except ImportError:+ pass+ else:+ with self.apprise_file.open("a", encoding="utf8") as f:+ f.write("windows://\n")self.manager.cache_manager.save("apprise_fixed", True)def _set_pydantic_config(self):diff --git a/cyberdrop_dl/utils/apprise.py b/cyberdrop_dl/utils/apprise.pyindex 4e2c86f49..a5ce534d4 100644--- a/cyberdrop_dl/utils/apprise.py+++ b/cyberdrop_dl/utils/apprise.py@@ -20,7 +20,7 @@ from cyberdrop_dl.models import AppriseURLModelfrom cyberdrop_dl.utils.logger import log, log_debug, log_spacerfrom cyberdrop_dl.utils.yaml import handle_validation_error-if TYPE_CHECKING: # pragma: no cover+if TYPE_CHECKING:from cyberdrop_dl.managers.manager import ManagerDEFAULT_APPRISE_MESSAGE = {diff --git a/poetry.lock b/poetry.lockindex 7ba23e381..ddeb33470 100644--- a/poetry.lock+++ b/poetry.lock@@ -2345,7 +2345,7 @@ description = "Python for Window Extensions"optional = falsepython-versions = "*"groups = ["main"]-markers = "platform_system == \"Windows\" or sys_platform == \"win32\""+markers = "platform_system == \"Windows\" or sys_platform == \"win32\" and implementation_name == \"cpython\""files = [{file = "pywin32-311-cp310-cp310-win32.whl", hash = "sha256:d03ff496d2a0cd4a5893504789d4a15399133fe82517455e78bad62efbb7f0a3"},{file = "pywin32-311-cp310-cp310-win_amd64.whl", hash = "sha256:797c2772017851984b97180b0bebe4b620bb86328e8a884bb626156295a63b3b"},@@ -3168,4 +3168,4 @@ propcache = ">=0.2.1"[metadata]lock-version = "2.1"python-versions = ">=3.11,<4"-content-hash = "a795c8c0c6edc5415d29fabfd7e6395f337d1998b38aad317f15b5a8b75cebe7"+content-hash = "7ee552af72ff26d81356851b635b0a3fe59130a275f8100f5637ac41202dc90e"diff --git a/pyproject.toml b/pyproject.tomlindex 343bb6f50..2f8ff0d39 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -25,7 +25,7 @@ dependencies = ["platformdirs >=4.3.6","psutil >=7.0.0","pydantic >=2.11.7",- "pywin32>=308 ; sys_platform == 'win32'",+ "pywin32>=308 ; sys_platform == 'win32' and implementation_name=='cpython'","pyyaml >=6.0.2","rich >=14.0.0","send2trash >=1.8.3",