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

Commit

Permalink
Add check for if sort dir is in download dir.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jules-WinnfieldX committed Dec 15, 2023
1 parent facbe7f commit 02786c2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 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.0.104"
__version__ = "5.0.105"
2 changes: 1 addition & 1 deletion cyberdrop_dl/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def main():
with contextlib.suppress(RuntimeError, asyncio.CancelledError):
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
asyncio.run(director(manager))
aiorun.run(director(manager), stop_on_unhandled_errors=True, loop=loop)
sys.exit(0)


Expand Down
11 changes: 11 additions & 0 deletions cyberdrop_dl/utils/sorting.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,20 @@ async def move_cd(self, file: Path, dest: Path) -> None:
break
file.rename(dest)

async def check_dir_parents(self) -> bool:
"""Checks if the sort dir is in the download dir"""
if self.download_dir in self.sorted_downloads.parents:
await log_with_color("Sort Directory cannot be in the Download Directory", "red")
return True
return False

async def sort(self) -> None:
"""Sorts the files in the download directory into their respective folders"""
await log_with_color("\nSorting Downloads: Please Wait", "cyan")

if await self.check_dir_parents():
return

for folder in self.download_dir.iterdir():
if not folder.is_dir():
continue
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.0.104"
version = "5.0.105"
description = "Bulk downloader for multiple file hosts"
authors = ["Jules Winnfield <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit 02786c2

Please sign in to comment.