Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
add more information about what is being hashed to progres
datawhores04dafca44976
diff --git a/cyberdrop_dl/clients/hash_client.py b/cyberdrop_dl/clients/hash_client.pyindex 0ea19579d..0c83f3ff2 100644--- a/cyberdrop_dl/clients/hash_client.py+++ b/cyberdrop_dl/clients/hash_client.py@@ -33,6 +33,7 @@ class HashClient:async def hash_item(self,file):if not file.is_file():return+ await self.manager.progress_manager.hash_progress.update_currently_hashing(file)hash=await self.manager.db_manager.hash_table.get_file_hash_exists(file)if not hash:hash = await self.manager.hash_manager.hash_file(file)diff --git a/cyberdrop_dl/ui/progress/hash_progress.py b/cyberdrop_dl/ui/progress/hash_progress.pyindex dea5e0c5e..a23e79ee0 100644--- a/cyberdrop_dl/ui/progress/hash_progress.py+++ b/cyberdrop_dl/ui/progress/hash_progress.py@@ -1,8 +1,9 @@-from typing import Tuple, TYPE_CHECKING+from typing import TYPE_CHECKINGfrom rich.console import Groupfrom rich.panel import Panelfrom rich.progress import Progress, BarColumn+from humanfriendly import format_sizeif TYPE_CHECKING:from cyberdrop_dl.managers.manager import Manager@@ -21,15 +22,26 @@ class HashProgress:self.match_progress=Progress("[progress.description]{task.description}",BarColumn(bar_width=None),"{task.completed} of {task.total} Files")++ self.current_hashing_text=Progress("{task.description}")-self.hashed_files = 0self.prev_hash_files = 0- self.hash_progress_group = Group(self.hash_progress)++ self.hash_progress_group = Group(self.current_hashing_text,self.hash_progress)+self.hashed_files_task_id = self.hash_progress.add_task("[green]Hashed", total=None)self.prev_hashed_files_task_id = self.hash_progress.add_task("[green]Previously Hashed", total=None)+ self.currently_hashing_task_id = self.current_hashing_text.add_task("")++ self.currently_hashing_size_task_id = self.current_hashing_text.add_task("")+++++self.removed_files=0self.removed_progress_group = Group(self.match_progress,self.remove_progress)@@ -45,11 +57,10 @@ class HashProgress:async def get_removed_progress(self) -> Panel:"""Returns the progress bar"""return Panel(self.removed_progress_group, border_style="green", padding=(1, 1))+ async def update_currently_hashing(self,file):+ self.current_hashing_text.update(self.currently_hashing_task_id ,description=f"[blue]{file}")- # async def update_hash(self) -> None:- # """Updates the total number of files to be downloaded"""- # self.hashed_file_total = self.hashed_file_total + 1- # self.progress.update(self.completed_files_task_id, total=self.hashed_file_total)+ self.current_hashing_text.update(self.currently_hashing_size_task_id ,description=f"[blue]{format_size(file.stat().st_size)}")async def add_completed_hash(self) -> None:diff --git a/poetry.lock b/poetry.lockindex 20b47d629..2394e746b 100644--- a/poetry.lock+++ b/poetry.lock@@ -1,9 +1,10 @@-# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand.+# This file is automatically @generated by Poetry 1.4.1 and should not be changed by hand.[[package]]name = "aiofiles"version = "0.8.0"description = "File support for asyncio."+category = "main"optional = falsepython-versions = ">=3.6,<4.0"files = [@@ -15,6 +16,7 @@ files = [name = "aiohttp"version = "3.9.5"description = "Async http client/server framework (asyncio)"+category = "main"optional = falsepython-versions = ">=3.8"files = [@@ -110,6 +112,7 @@ speedups = ["Brotli", "aiodns", "brotlicffi"]name = "aiolimiter"version = "1.1.0"description = "asyncio rate limiter, a leaky bucket implementation"+category = "main"optional = falsepython-versions = ">=3.7,<4.0"files = [@@ -121,6 +124,7 @@ files = [name = "aiosignal"version = "1.3.1"description = "aiosignal: a list of registered asynchronous callbacks"+category = "main"optional = falsepython-versions = ">=3.7"files = [@@ -135,6 +139,7 @@ frozenlist = ">=1.1.0"name = "aiosqlite"version = "0.17.0"description = "asyncio bridge to the standard sqlite3 module"+category = "main"optional = falsepython-versions = ">=3.6"files = [@@ -149,6 +154,7 @@ typing_extensions = ">=3.7.2"name = "asyncpraw"version = "7.7.1"description = "Async PRAW, an abbreviation for \"Asynchronous Python Reddit API Wrapper\", is a python package that allows for simple access to Reddit's API."+category = "main"optional = falsepython-versions = ">=3.7"files = [@@ -165,15 +171,16 @@ update-checker = ">=0.18"[package.extras]ci = ["coveralls"]-dev = ["asynctest (==0.13.*)", "mock (==4.*)", "packaging", "pre-commit", "pytest (==7.*)", "pytest-asyncio (==0.18.*)", "pytest-vcr (==1.*)", "sphinx", "sphinx-rtd-dark-mode", "sphinx-rtd-theme", "sphinxcontrib-trio", "testfixtures (==6.*)", "urllib3 (==1.*)", "vcrpy (==4.2.1)"]+dev = ["asynctest (>=0.13.0,<0.14.0)", "mock (>=4.0.0,<5.0.0)", "packaging", "pre-commit", "pytest (>=7.0.0,<8.0.0)", "pytest-asyncio (>=0.18.0,<0.19.0)", "pytest-vcr (>=1.0.0,<2.0.0)", "sphinx", "sphinx-rtd-dark-mode", "sphinx-rtd-theme", "sphinxcontrib-trio", "testfixtures (>=6.0.0,<7.0.0)", "urllib3 (>=1.0.0,<2.0.0)", "vcrpy (==4.2.1)"]lint = ["pre-commit", "sphinx", "sphinx-rtd-dark-mode", "sphinx-rtd-theme", "sphinxcontrib-trio"]readthedocs = ["sphinx", "sphinx-rtd-dark-mode", "sphinx-rtd-theme", "sphinxcontrib-trio"]-test = ["asynctest (==0.13.*)", "mock (==4.*)", "pytest (==7.*)", "pytest-asyncio (==0.18.*)", "pytest-vcr (==1.*)", "testfixtures (==6.*)", "urllib3 (==1.*)", "vcrpy (==4.2.1)"]+test = ["asynctest (>=0.13.0,<0.14.0)", "mock (>=4.0.0,<5.0.0)", "pytest (>=7.0.0,<8.0.0)", "pytest-asyncio (>=0.18.0,<0.19.0)", "pytest-vcr (>=1.0.0,<2.0.0)", "testfixtures (>=6.0.0,<7.0.0)", "urllib3 (>=1.0.0,<2.0.0)", "vcrpy (==4.2.1)"][[package]]name = "asyncprawcore"version = "2.4.0"description = "Low-level asynchronous communication layer for Async PRAW 7+."+category = "main"optional = falsepython-versions = "~=3.8"files = [@@ -188,13 +195,14 @@ yarl = "*"[package.extras]ci = ["coveralls"]dev = ["asyncprawcore[lint]", "asyncprawcore[test]", "packaging"]-lint = ["pre-commit", "ruff (==0.1.*)"]-test = ["mock (==4.*)", "pytest (==7.*)", "pytest-asyncio (==0.18.*)", "pytest-vcr (==1.*)", "urllib3 (==1.*)", "vcrpy (==4.2.1)"]+lint = ["pre-commit", "ruff (>=0.1.0,<0.2.0)"]+test = ["mock (>=4.0.0,<5.0.0)", "pytest (>=7.0.0,<8.0.0)", "pytest-asyncio (>=0.18.0,<0.19.0)", "pytest-vcr (>=1.0.0,<2.0.0)", "urllib3 (>=1.0.0,<2.0.0)", "vcrpy (==4.2.1)"][[package]]name = "attrs"version = "23.2.0"description = "Classes Without Boilerplate"+category = "main"optional = falsepython-versions = ">=3.7"files = [@@ -214,6 +222,7 @@ tests-no-zope = ["attrs[tests-mypy]", "cloudpickle", "hypothesis", "pympler", "pname = "beautifulsoup4"version = "4.12.3"description = "Screen-scraping library"+category = "main"optional = falsepython-versions = ">=3.6.0"files = [@@ -235,6 +244,7 @@ lxml = ["lxml"]name = "browser-cookie3"version = "0.19.1"description = "Loads cookies from your browser into a cookiejar object so can download with urllib and other libraries the same content you see in the web browser."+category = "main"optional = falsepython-versions = "*"files = [@@ -243,7 +253,7 @@ files = [][package.dependencies]-jeepney = {version = "*", markers = "python_version >= \"3.7\" and (sys_platform == \"bsd\" or sys_platform == \"linux\")"}+jeepney = {version = "*", markers = "python_version >= \"3.7\" and sys_platform in \"bsd\" or python_version >= \"3.7\" and sys_platform == \"linux\""}lz4 = "*"pycryptodomex = "*"@@ -251,6 +261,7 @@ pycryptodomex = "*"name = "certifi"version = "2024.7.4"description = "Python package for providing Mozilla's CA Bundle."+category = "main"optional = falsepython-versions = ">=3.6"files = [@@ -262,6 +273,7 @@ files = [name = "charset-normalizer"version = "3.3.2"description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet."+category = "main"optional = falsepython-versions = ">=3.7.0"files = [@@ -361,6 +373,7 @@ files = [name = "filedate"version = "3.0"description = ""+category = "main"optional = falsepython-versions = ">=3.4"files = [@@ -374,6 +387,7 @@ python-dateutil = "*"name = "frozenlist"version = "1.4.1"description = "A list-like structure which implements collections.abc.MutableSequence"+category = "main"optional = falsepython-versions = ">=3.8"files = [@@ -460,16 +474,33 @@ files = [name = "get-video-properties"version = "0.1.1"description = "Get video properties"+category = "main"optional = falsepython-versions = "*"files = [{file = "get_video_properties-0.1.1-py3-none-any.whl", hash = "sha256:04d4f478a5211917e2a7e87ddfcb1c17734cddf8374494c3993bf825b7ad4192"},]+[[package]]+name = "humanfriendly"+version = "10.0"+description = "Human friendly output for text interfaces using Python"+category = "main"+optional = false+python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"+files = [+ {file = "humanfriendly-10.0-py2.py3-none-any.whl", hash = "sha256:1697e1a8a8f550fd43c2865cd84542fc175a61dcb779b6fee18cf6b6ccba1477"},+ {file = "humanfriendly-10.0.tar.gz", hash = "sha256:6b0b831ce8f15f7300721aa49829fc4e83921a9a301cc7f606be6686a2288ddc"},+]++[package.dependencies]+pyreadline3 = {version = "*", markers = "sys_platform == \"win32\" and python_version >= \"3.8\""}+[[package]]name = "idna"version = "3.7"description = "Internationalized Domain Names in Applications (IDNA)"+category = "main"optional = falsepython-versions = ">=3.5"files = [@@ -481,6 +512,7 @@ files = [name = "inquirerpy"version = "0.3.4"description = "Python port of Inquirer.js (A collection of common interactive command-line user interfaces)"+category = "main"optional = falsepython-versions = ">=3.7,<4.0"files = [@@ -499,6 +531,7 @@ docs = ["Sphinx (>=4.1.2,<5.0.0)", "furo (>=2021.8.17-beta.43,<2022.0.0)", "mystname = "jeepney"version = "0.8.0"description = "Low-level, pure Python DBus protocol wrapper."+category = "main"optional = falsepython-versions = ">=3.7"files = [@@ -514,6 +547,7 @@ trio = ["async_generator", "trio"]name = "lz4"version = "4.3.3"description = "LZ4 Bindings for Python"+category = "main"optional = falsepython-versions = ">=3.8"files = [@@ -564,6 +598,7 @@ tests = ["psutil", "pytest (!=3.3.0)", "pytest-cov"]name = "markdown-it-py"version = "3.0.0"description = "Python port of markdown-it. Markdown parsing, done right!"+category = "main"optional = falsepython-versions = ">=3.8"files = [@@ -588,6 +623,7 @@ testing = ["coverage", "pytest", "pytest-cov", "pytest-regressions"]name = "mdurl"version = "0.1.2"description = "Markdown URL utilities"+category = "main"optional = falsepython-versions = ">=3.7"files = [@@ -599,6 +635,7 @@ files = [name = "mediafire"version = "0.6.1"description = "Python MediaFire client library"+category = "main"optional = falsepython-versions = "*"files = [@@ -615,6 +652,7 @@ six = "*"name = "multidict"version = "6.0.5"description = "multidict implementation"+category = "main"optional = falsepython-versions = ">=3.7"files = [@@ -714,6 +752,7 @@ files = [name = "mutagen"version = "1.47.0"description = "read and write audio tags for many formats"+category = "main"optional = falsepython-versions = ">=3.7"files = [@@ -725,6 +764,7 @@ files = [name = "myjdapi"version = "1.1.7"description = "Library to use My.Jdownloader API in an easy way."+category = "main"optional = falsepython-versions = "*"files = [@@ -740,6 +780,7 @@ requests = "*"name = "pfzy"version = "0.3.4"description = "Python port of the fzy fuzzy string matching algorithm"+category = "main"optional = falsepython-versions = ">=3.7,<4.0"files = [@@ -754,6 +795,7 @@ docs = ["Sphinx (>=4.1.2,<5.0.0)", "furo (>=2021.8.17-beta.43,<2022.0.0)", "mystname = "pillow"version = "10.4.0"description = "Python Imaging Library (Fork)"+category = "main"optional = falsepython-versions = ">=3.8"files = [@@ -851,6 +893,7 @@ xmp = ["defusedxml"]name = "platformdirs"version = "4.2.2"description = "A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`."+category = "main"optional = falsepython-versions = ">=3.8"files = [@@ -867,6 +910,7 @@ type = ["mypy (>=1.8)"]name = "prompt-toolkit"version = "3.0.47"description = "Library for building powerful interactive command lines in Python"+category = "main"optional = falsepython-versions = ">=3.7.0"files = [@@ -881,6 +925,7 @@ wcwidth = "*"name = "pycryptodome"version = "3.20.0"description = "Cryptographic library for Python"+category = "main"optional = falsepython-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"files = [@@ -922,6 +967,7 @@ files = [name = "pycryptodomex"version = "3.20.0"description = "Cryptographic library for Python"+category = "main"optional = falsepython-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"files = [@@ -963,6 +1009,7 @@ files = [name = "pygments"version = "2.18.0"description = "Pygments is a syntax highlighting package written in Python."+category = "main"optional = falsepython-versions = ">=3.8"files = [@@ -973,10 +1020,23 @@ files = [[package.extras]windows-terminal = ["colorama (>=0.4.6)"]+[[package]]+name = "pyreadline3"+version = "3.4.1"+description = "A python implementation of GNU readline."+category = "main"+optional = false+python-versions = "*"+files = [+ {file = "pyreadline3-3.4.1-py3-none-any.whl", hash = "sha256:b0efb6516fd4fb07b45949053826a62fa4cb353db5be2bbb4a7aa1fdd1e345fb"},+ {file = "pyreadline3-3.4.1.tar.gz", hash = "sha256:6f3d1f7b8a31ba32b73917cefc1f28cc660562f39aea8646d30bd6eff21f7bae"},+]+[[package]]name = "python-dateutil"version = "2.9.0.post0"description = "Extensions to the standard Python datetime module"+category = "main"optional = falsepython-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7"files = [@@ -991,6 +1051,7 @@ six = ">=1.5"name = "pyyaml"version = "6.0.1"description = "YAML parser and emitter for Python"+category = "main"optional = falsepython-versions = ">=3.6"files = [@@ -1051,6 +1112,7 @@ files = [name = "requests"version = "2.32.3"description = "Python HTTP for Humans."+category = "main"optional = falsepython-versions = ">=3.8"files = [@@ -1072,6 +1134,7 @@ use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"]name = "requests-toolbelt"version = "1.0.0"description = "A utility belt for advanced users of python-requests"+category = "main"optional = falsepython-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"files = [@@ -1086,6 +1149,7 @@ requests = ">=2.0.1,<3.0.0"name = "rich"version = "13.7.1"description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal"+category = "main"optional = falsepython-versions = ">=3.7.0"files = [@@ -1104,6 +1168,7 @@ jupyter = ["ipywidgets (>=7.5.1,<9)"]name = "six"version = "1.16.0"description = "Python 2 and 3 compatibility utilities"+category = "main"optional = falsepython-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*"files = [@@ -1115,6 +1180,7 @@ files = [name = "soupsieve"version = "2.5"description = "A modern CSS selector implementation for Beautiful Soup."+category = "main"optional = falsepython-versions = ">=3.8"files = [@@ -1126,6 +1192,7 @@ files = [name = "typing-extensions"version = "4.12.2"description = "Backported and Experimental Type Hints for Python 3.8+"+category = "main"optional = falsepython-versions = ">=3.8"files = [@@ -1137,6 +1204,7 @@ files = [name = "update-checker"version = "0.18.0"description = "A python module that will check for package updates."+category = "main"optional = falsepython-versions = "*"files = [@@ -1156,6 +1224,7 @@ test = ["pytest (>=2.7.3)"]name = "urllib3"version = "2.2.2"description = "HTTP library with thread-safe connection pooling, file post, and more."+category = "main"optional = falsepython-versions = ">=3.8"files = [@@ -1173,6 +1242,7 @@ zstd = ["zstandard (>=0.18.0)"]name = "wcwidth"version = "0.2.13"description = "Measures the displayed width of unicode strings in a terminal"+category = "main"optional = falsepython-versions = "*"files = [@@ -1184,6 +1254,7 @@ files = [name = "yarl"version = "1.9.4"description = "Yet another URL library"+category = "main"optional = falsepython-versions = ">=3.7"files = [@@ -1286,4 +1357,4 @@ multidict = ">=4.0"[metadata]lock-version = "2.0"python-versions = "^3.11"-content-hash = "60099cbc59be6b282cd53e906dc3f233a3719ce33a68fa485e6a549b56879694"+content-hash = "41c0686275eb89caa4b0feda7533518d4c3713f18b0398b20f2e884b4f08ec6d"diff --git a/pyproject.toml b/pyproject.tomlindex 567802122..2468c142a 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -28,6 +28,7 @@ mediafire = "^0.6.1"mutagen = "^1.47.0"pillow = "^10.2.0"get-video-properties = "^0.1.1"+humanfriendly = "^10.0"[tool.poetry.scripts]cyberdrop-dl = "cyberdrop_dl.main:main"