ensure 100 download progress is sent

This commit is contained in:
Simon 2024-04-03 16:31:36 +02:00
parent a72be27982
commit 8bf7f71351
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
1 changed files with 5 additions and 3 deletions

View File

@ -177,7 +177,7 @@ class VideoDownloader:
if not success:
continue
self._notify(video_data, "Add video metadata to index")
self._notify(video_data, "Add video metadata to index", progress=1)
vid_dict = index_new_video(
youtube_id,
@ -197,14 +197,16 @@ class VideoDownloader:
return self.videos
def _notify(self, video_data, message):
def _notify(self, video_data, message, progress=False):
"""send progress notification to task"""
if not self.task:
return
typ = VideoTypeEnum(video_data["vid_type"]).value.rstrip("s").title()
title = video_data.get("title")
self.task.send_progress([f"Processing {typ}: {title}", message])
self.task.send_progress(
[f"Processing {typ}: {title}", message], progress=progress
)
def _get_next(self, auto_only):
"""get next item in queue"""