trigger transfer progress -1 if download is canceled
This commit is contained in:
parent
c6c032d3d9
commit
1266fb9133
2 changed files with 12 additions and 4 deletions
|
@ -325,6 +325,9 @@ def cancelDownloads(data):
|
|||
for l in item.lists.filter_by(user_id=settings.USER_ID):
|
||||
l.items.remove(item)
|
||||
item.update()
|
||||
trigger_event('transfer', {
|
||||
'id': item.id, 'progress': -1
|
||||
})
|
||||
response = {'cancelled': ids}
|
||||
return response
|
||||
actions.register(cancelDownloads, cache=False)
|
||||
|
|
|
@ -55,13 +55,18 @@ oml.ui.appPanel = function() {
|
|||
|
||||
oml.bindEvent({
|
||||
transfer: Ox.throttle(function(data) {
|
||||
var mediastate = data.progress < -1
|
||||
? 'unavailable'
|
||||
: data.progress < 1
|
||||
? 'transferring'
|
||||
: 'available';
|
||||
oml.$ui.list.value(data.id, {
|
||||
mediastate: data.progress < 1 ? 'transferring' : 'available'
|
||||
mediastate: mediastate
|
||||
});
|
||||
oml.$ui.browser.value(data.id, {
|
||||
mediastate: data.progress < 1 ? 'transferring' : 'available'
|
||||
mediastate: mediastate
|
||||
});
|
||||
if (data.progress == 1 && data.id == ui.item) {
|
||||
if ((data.progress == 1 || data.progress == -1) && data.id == ui.item) {
|
||||
Ox.Request.clearCache();
|
||||
oml.$ui.infoView.updateElement(ui.item);
|
||||
}
|
||||
|
@ -79,4 +84,4 @@ oml.ui.appPanel = function() {
|
|||
|
||||
return that;
|
||||
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue