diff --git a/oml/item/api.py b/oml/item/api.py index da4507c..0da8a2b 100644 --- a/oml/item/api.py +++ b/oml/item/api.py @@ -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) diff --git a/static/js/appPanel.js b/static/js/appPanel.js index 2569900..2742708 100644 --- a/static/js/appPanel.js +++ b/static/js/appPanel.js @@ -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; -}; \ No newline at end of file +};