mirror of
https://git.vectorsigma.ru/public/tubearchivist.git
synced 2026-08-05 01:19:29 +00:00
refac pending list, implement flat add
This commit is contained in:
@@ -147,7 +147,9 @@ 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, status="pending"):
|
||||
def extrac_dl(
|
||||
self, youtube_ids, auto_start=False, flat=False, status="pending"
|
||||
):
|
||||
"""parse list passed and add to pending"""
|
||||
TaskManager().init(self)
|
||||
if isinstance(youtube_ids, str):
|
||||
@@ -155,17 +157,17 @@ def extrac_dl(self, youtube_ids, auto_start=False, status="pending"):
|
||||
else:
|
||||
to_add = youtube_ids
|
||||
|
||||
pending_handler = PendingList(youtube_ids=to_add, task=self)
|
||||
pending_handler.parse_url_list(auto_start=auto_start)
|
||||
videos_added = pending_handler.add_to_pending(
|
||||
status=status, auto_start=auto_start
|
||||
pending_handler = PendingList(
|
||||
youtube_ids=to_add, task=self, auto_start=auto_start, flat=flat
|
||||
)
|
||||
pending_handler.parse_url_list()
|
||||
videos_added = pending_handler.add_to_pending(status=status)
|
||||
|
||||
if auto_start:
|
||||
download_pending.delay(auto_only=True)
|
||||
|
||||
if videos_added:
|
||||
return f"added {len(videos_added)} Videos to Queue"
|
||||
return f"added {videos_added} Videos to Queue"
|
||||
|
||||
return None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user