From 0c3c1b650a397d2b9b1ddc305772cd55a85b3675 Mon Sep 17 00:00:00 2001 From: simon Date: Fri, 15 Oct 2021 13:16:35 +0700 Subject: [PATCH] disable notifiation on rescan, fix keyerror issue in missing_thumbs build --- tubearchivist/home/src/reindex.py | 7 ++----- tubearchivist/home/src/thumbnails.py | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/tubearchivist/home/src/reindex.py b/tubearchivist/home/src/reindex.py index 7557e86..faea9d3 100644 --- a/tubearchivist/home/src/reindex.py +++ b/tubearchivist/home/src/reindex.py @@ -165,11 +165,8 @@ class Reindex: vid_handler.upload_to_es() thumb_handler = ThumbManager() thumb_handler.delete_vid_thumb(youtube_id) - to_download = ( - youtube_id, - vid_handler.vid_dict["channel"]["vid_thumb_url"], - ) - thumb_handler.download_vid([to_download]) + to_download = (youtube_id, vid_handler.vid_dict["vid_thumb_url"]) + thumb_handler.download_vid([to_download], notify=False) @staticmethod def reindex_single_channel(channel_id): diff --git a/tubearchivist/home/src/thumbnails.py b/tubearchivist/home/src/thumbnails.py index 9897276..5c9e307 100644 --- a/tubearchivist/home/src/thumbnails.py +++ b/tubearchivist/home/src/thumbnails.py @@ -134,7 +134,7 @@ class ThumbManager: return img_raw - def download_vid(self, missing_thumbs): + def download_vid(self, missing_thumbs, notify=True): """download all missing thumbnails from list""" total = len(missing_thumbs) print(f"downloading {total} thumbnails") @@ -158,13 +158,15 @@ class ThumbManager: img_raw.convert("RGB").save(thumb_path) - mess_dict = { - "status": "pending", - "level": "info", - "title": "Adding to download queue.", - "message": "Downloading Thumbnails...", - } - RedisArchivist().set_message("progress:download", mess_dict) + if notify: + mess_dict = { + "status": "pending", + "level": "info", + "title": "Adding to download queue.", + "message": "Downloading Thumbnails...", + } + RedisArchivist().set_message("progress:download", mess_dict) + if counter % 50 == 0 and counter != 0: print(f"thumbnail progress: {counter}/{total}") counter = counter + 1