diff --git a/tubearchivist/api/views.py b/tubearchivist/api/views.py index 77c345ab..ee752135 100644 --- a/tubearchivist/api/views.py +++ b/tubearchivist/api/views.py @@ -592,7 +592,7 @@ class DownloadApiView(ApiBaseView): """ search_base = "ta_download/_doc/" - valid_status = ["pending", "ignore", "priority"] + valid_status = ["pending", "ignore", "ignore-force", "priority"] permission_classes = [AdminOnly] def get(self, request, video_id): @@ -609,6 +609,11 @@ class DownloadApiView(ApiBaseView): print(message) return Response({"message": message}, status=400) + if item_status == "ignore-force": + extrac_dl.delay(video_id, status="ignore") + message = f"{video_id}: set status to ignore" + return Response(request.data) + _, status_code = PendingInteract(video_id).get_item() if status_code == 404: message = f"{video_id}: item not found {status_code}" diff --git a/tubearchivist/home/tasks.py b/tubearchivist/home/tasks.py index e0ab8e7c..c1402a90 100644 --- a/tubearchivist/home/tasks.py +++ b/tubearchivist/home/tasks.py @@ -214,7 +214,7 @@ def download_pending(self, auto_only=False): @shared_task(name="extract_download", bind=True, base=BaseTask) -def extrac_dl(self, youtube_ids, auto_start=False): +def extrac_dl(self, youtube_ids, auto_start=False, status="pending"): """parse list passed and add to pending""" TaskManager().init(self) if isinstance(youtube_ids, str): @@ -224,7 +224,7 @@ def extrac_dl(self, youtube_ids, auto_start=False): pending_handler = PendingList(youtube_ids=to_add, task=self) pending_handler.parse_url_list() - pending_handler.add_to_pending(auto_start=auto_start) + pending_handler.add_to_pending(status=status, auto_start=auto_start) if auto_start: download_pending.delay(auto_only=True) diff --git a/tubearchivist/home/templates/home/video.html b/tubearchivist/home/templates/home/video.html index bb782679..45348e19 100644 --- a/tubearchivist/home/templates/home/video.html +++ b/tubearchivist/home/templates/home/video.html @@ -92,7 +92,10 @@ {% if request.user|has_group:"admin" or request.user.is_staff %}