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()
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):

View File

@ -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