diff --git a/tubearchivist/api/views.py b/tubearchivist/api/views.py index 5b2bf7f..15fde1d 100644 --- a/tubearchivist/api/views.py +++ b/tubearchivist/api/views.py @@ -15,7 +15,13 @@ from home.src.ta.config import AppConfig from home.src.ta.ta_redis import RedisArchivist from home.src.ta.task_manager import TaskCommand, TaskManager from home.src.ta.urlparser import Parser -from home.tasks import BaseTask, check_reindex, extrac_dl, subscribe_to +from home.tasks import ( + BaseTask, + check_reindex, + download_pending, + extrac_dl, + subscribe_to, +) from rest_framework.authentication import ( SessionAuthentication, TokenAuthentication, @@ -431,6 +437,8 @@ class DownloadApiView(ApiBaseView): print(f"{video_id}: change status to {item_status}") PendingInteract(video_id, item_status).update_status() + if item_status == "priority": + download_pending.delay(auto_only=True) return Response(request.data) diff --git a/tubearchivist/home/src/download/queue.py b/tubearchivist/home/src/download/queue.py index b276f21..1ff7917 100644 --- a/tubearchivist/home/src/download/queue.py +++ b/tubearchivist/home/src/download/queue.py @@ -118,7 +118,7 @@ class PendingInteract: else: data = {"doc": {"status": self.status}} - path = f"ta_download/_update/{self.youtube_id}" + path = f"ta_download/_update/{self.youtube_id}/?refresh=true" _, _ = ElasticWrap(path).post(data=data) def get_item(self):