Skip to content

Bulk asynchronous downloader for multiple file hosts

refactor: show notifications results on console

NTFSvolume96953a3469b7
diff --git a/cyberdrop_dl/scraper/crawlers/chevereto_crawler.py b/cyberdrop_dl/scraper/crawlers/chevereto_crawler.py
index 96a5d393e..9981bd3a4 100644
--- a/cyberdrop_dl/scraper/crawlers/chevereto_crawler.py
+++ b/cyberdrop_dl/scraper/crawlers/chevereto_crawler.py
@@ -20,7 +20,7 @@ if TYPE_CHECKING:
CDN_PATTERNS = {
'jpg.church': r"^(?:(jpg.church\/images\/...)|(simp..jpg.church)|(jpg.fish\/images\/...)|(simp..jpg.fish)|(jpg.fishing\/images\/...)|(simp..jpg.fishing)|(simp..host.church)|(simp..jpg..su))",
'imagepond.net': r"(media.imagepond.net)",
- 'img.kiwi': r'^(?:(img.kiwi\/images\/)'
+ 'img.kiwi': r'^(?:(img.kiwi\/images\/...))'
}
CDN_POSSIBILITIES = re.compile("|".join(CDN_PATTERNS.values()))
diff --git a/cyberdrop_dl/utils/utilities.py b/cyberdrop_dl/utils/utilities.py
index af1399f80..cd5c01c84 100644
--- a/cyberdrop_dl/utils/utilities.py
+++ b/cyberdrop_dl/utils/utilities.py
@@ -365,6 +365,7 @@ async def sent_appraise_notifications(manager: Manager) -> None:
if not lines:
return
+ rich.print ('\nSending notifications.. ')
apprise_obj = apprise.Apprise()
for line in lines:
parts = line.split("://",1)[0].split('=', 1)
@@ -375,20 +376,40 @@ async def sent_appraise_notifications(manager: Manager) -> None:
tags = tags.split(',')
apprise_obj.add(url, tag = tags)
-
- apprise_obj.notify(
+ results = []
+
+ result = apprise_obj.notify(
body = text.plain,
title = 'Cyberdrop-DL',
+ body_format=apprise.NotifyFormat.TEXT,
tag = 'no_logs'
)
- apprise_obj.notify(
+ if result is not None:
+ results += [result]
+
+ result = apprise_obj.notify(
body = text.plain,
title = 'Cyberdrop-DL',
+ body_format=apprise.NotifyFormat.TEXT,
attach = str(manager.path_manager.main_log.resolve()),
tag = 'attach_logs'
)
+ if result is not None:
+ results += [result]
+
+ if not results:
+ result = Text('No notifications sent', 'yellow')
+ if all (results):
+ result = Text('Success', 'green')
+ elif any (results):
+ result = Text('Partial Success', 'yellow')
+ else:
+ result= Text('Failed','bold red')
+
+ rich.print('Apprise notifications results:', result)
+
def parse_bytes(size: int) -> Tuple[int, str]:
for unit in ["B", "KB", "MB", "GB", "TB", "PB", "EB"]:
if size < 1024: