diff --git a/tubearchivist/home/src/download/queue.py b/tubearchivist/home/src/download/queue.py index 3c733ca6..b0f12a91 100644 --- a/tubearchivist/home/src/download/queue.py +++ b/tubearchivist/home/src/download/queue.py @@ -245,6 +245,7 @@ class PendingList(PendingIndex): bulk_list = [] total = len(self.missing_videos) + videos_added = [] for idx, (youtube_id, vid_type) in enumerate(self.missing_videos): if self.task and self.task.is_stopped(): break @@ -268,6 +269,7 @@ class PendingList(PendingIndex): url = video_details["vid_thumb_url"] ThumbManager(youtube_id).download_video_thumb(url) + videos_added.append(youtube_id) if len(bulk_list) >= 20: self._ingest_bulk(bulk_list) @@ -275,6 +277,8 @@ class PendingList(PendingIndex): self._ingest_bulk(bulk_list) + return videos_added + def _ingest_bulk(self, bulk_list): """add items to queue in bulk""" if not bulk_list: diff --git a/tubearchivist/home/src/download/yt_dlp_handler.py b/tubearchivist/home/src/download/yt_dlp_handler.py index cb76ac34..91308003 100644 --- a/tubearchivist/home/src/download/yt_dlp_handler.py +++ b/tubearchivist/home/src/download/yt_dlp_handler.py @@ -90,7 +90,7 @@ class DownloadPostProcess: vids = [{"type": "video", "url": i["youtube_id"]} for i in to_delete] pending = PendingList(youtube_ids=vids) pending.parse_url_list() - pending.add_to_pending(status="ignore") + _ = pending.add_to_pending(status="ignore") def validate_playlists(self): """look for playlist needing to update""" diff --git a/tubearchivist/home/src/frontend/forms_schedule.py b/tubearchivist/home/src/frontend/forms_schedule.py index fc0e7eed..f4424fff 100644 --- a/tubearchivist/home/src/frontend/forms_schedule.py +++ b/tubearchivist/home/src/frontend/forms_schedule.py @@ -6,6 +6,7 @@ Functionality: from celery.schedules import crontab from django import forms +from home.src.ta.task_config import TASK_CONFIG class CrontabValidator: @@ -78,12 +79,17 @@ class SchedulerSettingsForm(forms.Form): class NotificationSettingsForm(forms.Form): """add notification URL""" - TASK_CHOICES = [ - ("", "-- select task --"), - ("update_subscribed", "Rescan your Subscriptions"), - ("download_pending", "Downloading"), - ("check_reindex", "Reindex Documents"), + SUPPORTED_TASKS = [ + "update_subscribed", + "extract_download", + "download_pending", + "check_reindex", ] + TASK_LIST = [(i, TASK_CONFIG[i]["title"]) for i in SUPPORTED_TASKS] + + TASK_CHOICES = [("", "-- select task --")] + TASK_CHOICES.extend(TASK_LIST) + PLACEHOLDER = "Apprise notification URL" task = forms.ChoiceField( diff --git a/tubearchivist/home/tasks.py b/tubearchivist/home/tasks.py index 858ef2d6..9aa5146a 100644 --- a/tubearchivist/home/tasks.py +++ b/tubearchivist/home/tasks.py @@ -144,11 +144,18 @@ def extrac_dl(self, youtube_ids, auto_start=False, status="pending"): pending_handler = PendingList(youtube_ids=to_add, task=self) pending_handler.parse_url_list() - pending_handler.add_to_pending(status=status, auto_start=auto_start) + videos_added = pending_handler.add_to_pending( + status=status, auto_start=auto_start + ) if auto_start: download_pending.delay(auto_only=True) + if videos_added: + return f"added {len(videos_added)} Videos to Queue" + + return None + @shared_task(bind=True, name="check_reindex", base=BaseTask) def check_reindex(self, data=False, extract_videos=False):