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')
|
response = json_response(status=403, text='permission denied')
|
||||||
else:
|
else:
|
||||||
response = json_response()
|
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'])
|
t = tasks.download_media.delay(data['item'], data['url'])
|
||||||
response['data']['taskId'] = t.task_id
|
response['data']['taskId'] = t.task_id
|
||||||
add_changelog(request, data, data['item'])
|
add_changelog(request, data, data['item'])
|
||||||
|
|
|
@ -91,6 +91,8 @@ class Task(models.Model):
|
||||||
status = 'failed'
|
status = 'failed'
|
||||||
elif self.item.rendered:
|
elif self.item.rendered:
|
||||||
status = 'finished'
|
status = 'finished'
|
||||||
|
elif not self.item.files.count():
|
||||||
|
status = 'queued'
|
||||||
else:
|
else:
|
||||||
status = 'unknown'
|
status = 'unknown'
|
||||||
if status != self.status:
|
if status != self.status:
|
||||||
|
|
|
@ -21,7 +21,7 @@ def getTasks(request, data):
|
||||||
[{
|
[{
|
||||||
started: 0,
|
started: 0,
|
||||||
finished: 0,
|
finished: 0,
|
||||||
status: 'queued|uploading|processing|finished|failed|cancelled',
|
status: 'pending|uploading|queued|processing|finished|failed|cancelled',
|
||||||
title: '',
|
title: '',
|
||||||
item: 'itemID',
|
item: 'itemID',
|
||||||
id: 'taskID'
|
id: 'taskID'
|
||||||
|
|
Loading…
Reference in a new issue