download now task handling
This commit is contained in:
parent
8f3b832069
commit
efca460e9d
|
@ -15,7 +15,13 @@ from home.src.ta.config import AppConfig
|
||||||
from home.src.ta.ta_redis import RedisArchivist
|
from home.src.ta.ta_redis import RedisArchivist
|
||||||
from home.src.ta.task_manager import TaskCommand, TaskManager
|
from home.src.ta.task_manager import TaskCommand, TaskManager
|
||||||
from home.src.ta.urlparser import Parser
|
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 (
|
from rest_framework.authentication import (
|
||||||
SessionAuthentication,
|
SessionAuthentication,
|
||||||
TokenAuthentication,
|
TokenAuthentication,
|
||||||
|
@ -431,6 +437,8 @@ class DownloadApiView(ApiBaseView):
|
||||||
|
|
||||||
print(f"{video_id}: change status to {item_status}")
|
print(f"{video_id}: change status to {item_status}")
|
||||||
PendingInteract(video_id, item_status).update_status()
|
PendingInteract(video_id, item_status).update_status()
|
||||||
|
if item_status == "priority":
|
||||||
|
download_pending.delay(auto_only=True)
|
||||||
|
|
||||||
return Response(request.data)
|
return Response(request.data)
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,7 @@ class PendingInteract:
|
||||||
else:
|
else:
|
||||||
data = {"doc": {"status": self.status}}
|
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)
|
_, _ = ElasticWrap(path).post(data=data)
|
||||||
|
|
||||||
def get_item(self):
|
def get_item(self):
|
||||||
|
|
Loading…
Reference in New Issue