disable notifiation on rescan, fix keyerror issue in missing_thumbs build

This commit is contained in:
simon 2021-10-15 13:16:35 +07:00
parent 45d8b7e218
commit 0c3c1b650a
2 changed files with 12 additions and 13 deletions

View File

@ -165,11 +165,8 @@ class Reindex:
vid_handler.upload_to_es() vid_handler.upload_to_es()
thumb_handler = ThumbManager() thumb_handler = ThumbManager()
thumb_handler.delete_vid_thumb(youtube_id) thumb_handler.delete_vid_thumb(youtube_id)
to_download = ( to_download = (youtube_id, vid_handler.vid_dict["vid_thumb_url"])
youtube_id, thumb_handler.download_vid([to_download], notify=False)
vid_handler.vid_dict["channel"]["vid_thumb_url"],
)
thumb_handler.download_vid([to_download])
@staticmethod @staticmethod
def reindex_single_channel(channel_id): def reindex_single_channel(channel_id):

View File

@ -134,7 +134,7 @@ class ThumbManager:
return img_raw return img_raw
def download_vid(self, missing_thumbs): def download_vid(self, missing_thumbs, notify=True):
"""download all missing thumbnails from list""" """download all missing thumbnails from list"""
total = len(missing_thumbs) total = len(missing_thumbs)
print(f"downloading {total} thumbnails") print(f"downloading {total} thumbnails")
@ -158,6 +158,7 @@ class ThumbManager:
img_raw.convert("RGB").save(thumb_path) img_raw.convert("RGB").save(thumb_path)
if notify:
mess_dict = { mess_dict = {
"status": "pending", "status": "pending",
"level": "info", "level": "info",
@ -165,6 +166,7 @@ class ThumbManager:
"message": "Downloading Thumbnails...", "message": "Downloading Thumbnails...",
} }
RedisArchivist().set_message("progress:download", mess_dict) RedisArchivist().set_message("progress:download", mess_dict)
if counter % 50 == 0 and counter != 0: if counter % 50 == 0 and counter != 0:
print(f"thumbnail progress: {counter}/{total}") print(f"thumbnail progress: {counter}/{total}")
counter = counter + 1 counter = counter + 1