mirror of
https://github.com/tubearchivist/tubearchivist.git
synced 2024-12-23 02:10:14 +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):
|
||||
"""add list of videos to download queue"""
|
||||
data = request.data
|
||||
auto_start = bool(request.GET.get("autostart"))
|
||||
try:
|
||||
to_add = data["data"]
|
||||
except KeyError:
|
||||
@ -499,7 +500,7 @@ class DownloadApiListView(ApiBaseView):
|
||||
print(message)
|
||||
return Response({"message": message}, status=400)
|
||||
|
||||
extrac_dl.delay(youtube_ids)
|
||||
extrac_dl.delay(youtube_ids, auto_start=auto_start)
|
||||
|
||||
return Response(data)
|
||||
|
||||
|
@ -190,7 +190,7 @@ def download_pending(self, auto_only=False):
|
||||
return
|
||||
|
||||
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)
|
||||
@ -206,6 +206,9 @@ def extrac_dl(self, youtube_ids, auto_start=False):
|
||||
pending_handler.parse_url_list()
|
||||
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)
|
||||
def check_reindex(self, data=False, extract_videos=False):
|
||||
|
Loading…
Reference in New Issue
Block a user