make update_external async
This commit is contained in:
parent
93c6d8495b
commit
4d9761a32c
2 changed files with 15 additions and 10 deletions
|
@ -693,7 +693,9 @@ def updateExternalData(request, data):
|
|||
takes {
|
||||
id: string // item id
|
||||
}
|
||||
returns {}
|
||||
returns {
|
||||
taskId: string, // taskId
|
||||
}
|
||||
notes: This can be used to populate metadata from a remote source, like
|
||||
IMDb.
|
||||
see: getIds, getMetadata
|
||||
|
@ -701,7 +703,8 @@ def updateExternalData(request, data):
|
|||
item = get_object_or_404_json(models.Item, public_id=data['id'])
|
||||
response = json_response()
|
||||
if item.editable(request.user):
|
||||
item.update_external()
|
||||
t = tasks.update_external.delay(item.public_id)
|
||||
response['taskId'] = t.task_id
|
||||
else:
|
||||
response = json_response(status=403, text='permission denied')
|
||||
return render_to_json_response(response)
|
||||
|
|
|
@ -1123,6 +1123,7 @@ pandora.ui.infoView = function(data) {
|
|||
pandora.api.updateExternalData({
|
||||
id: ui.item
|
||||
}, function(result) {
|
||||
(result.data.taskId ? pandora.wait : Ox.noop)(result.data.taskId, function(result) {
|
||||
pandora.updateItemContext();
|
||||
Ox.Request.clearCache();
|
||||
if (ui.item == item && ui.itemView == 'info') {
|
||||
|
@ -1132,6 +1133,7 @@ pandora.ui.infoView = function(data) {
|
|||
}
|
||||
$options.enableItem('update');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
that.reload = function() {
|
||||
|
|
Loading…
Reference in a new issue