mirror of
https://github.com/tubearchivist/tubearchivist.git
synced 2024-12-23 10:20:13 +00:00
[API] add dl autostart query param
This commit is contained in:
parent
9b3d1fa1fd
commit
8f3b832069
@ -483,6 +483,7 @@ class DownloadApiListView(ApiBaseView):
|
|||||||
def post(request):
|
def post(request):
|
||||||
"""add list of videos to download queue"""
|
"""add list of videos to download queue"""
|
||||||
data = request.data
|
data = request.data
|
||||||
|
auto_start = bool(request.GET.get("autostart"))
|
||||||
try:
|
try:
|
||||||
to_add = data["data"]
|
to_add = data["data"]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
@ -499,7 +500,7 @@ class DownloadApiListView(ApiBaseView):
|
|||||||
print(message)
|
print(message)
|
||||||
return Response({"message": message}, status=400)
|
return Response({"message": message}, status=400)
|
||||||
|
|
||||||
extrac_dl.delay(youtube_ids)
|
extrac_dl.delay(youtube_ids, auto_start=auto_start)
|
||||||
|
|
||||||
return Response(data)
|
return Response(data)
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ def download_pending(self, auto_only=False):
|
|||||||
return
|
return
|
||||||
|
|
||||||
manager.init(self)
|
manager.init(self)
|
||||||
VideoDownloader(task=self).run_queue(auto_only)
|
VideoDownloader(task=self).run_queue(auto_only=auto_only)
|
||||||
|
|
||||||
|
|
||||||
@shared_task(name="extract_download", bind=True, base=BaseTask)
|
@shared_task(name="extract_download", bind=True, base=BaseTask)
|
||||||
@ -206,6 +206,9 @@ def extrac_dl(self, youtube_ids, auto_start=False):
|
|||||||
pending_handler.parse_url_list()
|
pending_handler.parse_url_list()
|
||||||
pending_handler.add_to_pending(auto_start=auto_start)
|
pending_handler.add_to_pending(auto_start=auto_start)
|
||||||
|
|
||||||
|
if auto_start:
|
||||||
|
download_pending.delay(auto_only=True)
|
||||||
|
|
||||||
|
|
||||||
@shared_task(bind=True, name="check_reindex", base=BaseTask)
|
@shared_task(bind=True, name="check_reindex", base=BaseTask)
|
||||||
def check_reindex(self, data=False, extract_videos=False):
|
def check_reindex(self, data=False, extract_videos=False):
|
||||||
|
Loading…
Reference in New Issue
Block a user