add task for queued downloads
This commit is contained in:
parent
1ec69b9c05
commit
4d9e8a788a
3 changed files with 5 additions and 1 deletions
|
@ -780,6 +780,8 @@ def addMediaUrl(request, data):
|
|||
response = json_response(status=403, text='permission denied')
|
||||
else:
|
||||
response = json_response()
|
||||
i = Item.objects.get(public_id=data['item'])
|
||||
Tasks.start(i, request.user)
|
||||
t = tasks.download_media.delay(data['item'], data['url'])
|
||||
response['data']['taskId'] = t.task_id
|
||||
add_changelog(request, data, data['item'])
|
||||
|
|
|
@ -91,6 +91,8 @@ class Task(models.Model):
|
|||
status = 'failed'
|
||||
elif self.item.rendered:
|
||||
status = 'finished'
|
||||
elif not self.item.files.count():
|
||||
status = 'queued'
|
||||
else:
|
||||
status = 'unknown'
|
||||
if status != self.status:
|
||||
|
|
|
@ -21,7 +21,7 @@ def getTasks(request, data):
|
|||
[{
|
||||
started: 0,
|
||||
finished: 0,
|
||||
status: 'queued|uploading|processing|finished|failed|cancelled',
|
||||
status: 'pending|uploading|queued|processing|finished|failed|cancelled',
|
||||
title: '',
|
||||
item: 'itemID',
|
||||
id: 'taskID'
|
||||
|
|
Loading…
Reference in a new issue