Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
fix partial downloads restarting
Browse files Browse the repository at this point in the history
  • Loading branch information
Jules-WinnfieldX committed May 12, 2024
1 parent 82563fa commit 9e66675
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cyberdrop_dl/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "5.3.7"
__version__ = "5.3.8"
8 changes: 6 additions & 2 deletions cyberdrop_dl/clients/download_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ async def _download(self, domain: str, manager: Manager, media_item: MediaItem,
if domain == "pixeldrain":
if self.manager.config_manager.authentication_data['PixelDrain']['pixeldrain_api_key']:
headers["Authorization"] = await self.manager.download_manager.basic_auth("Cyberdrop-DL", self.manager.config_manager.authentication_data['PixelDrain']['pixeldrain_api_key'])
if isinstance(media_item.partial_file, Path):

downloaded_filename = await self.manager.db_manager.history_table.get_downloaded_filename(domain, media_item)
download_dir = await self.get_download_dir(media_item)
media_item.partial_file = download_dir / f"{downloaded_filename}.part"
if isinstance(media_item.partial_file, Path) and media_item.partial_file.exists():
resume_point = media_item.partial_file.stat().st_size if media_item.partial_file.exists() else 0
headers['Range'] = f'bytes={resume_point}-'

Expand All @@ -101,7 +105,7 @@ async def _download(self, domain: str, manager: Manager, media_item: MediaItem,

if not isinstance(media_item.filesize, int):
media_item.filesize = int(resp.headers.get('Content-Length', '0'))
if not isinstance(media_item.partial_file, Path):
if not isinstance(media_item.complete_file, Path):
proceed, skip = await self.get_final_file_info(media_item, domain)
await self.mark_incomplete(media_item, domain)
if skip:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "cyberdrop-dl"
version = "5.3.7"
version = "5.3.8"
description = "Bulk downloader for multiple file hosts"
authors = ["Jules Winnfield <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit 9e66675

Please sign in to comment.