diff --git a/static/js/cacheDialog.js b/static/js/cacheDialog.js index 1b7b770c9..60ab3d06c 100644 --- a/static/js/cacheDialog.js +++ b/static/js/cacheDialog.js @@ -13,6 +13,7 @@ pandora.ui.cacheDialog = function() { }, { id: 'item', + operator: '+', title: Ox._('Item'), visible: true, width: 48 diff --git a/static/js/fs.js b/static/js/fs.js index 2a0a85bf2..8f3990103 100644 --- a/static/js/fs.js +++ b/static/js/fs.js @@ -33,34 +33,41 @@ pandora.fs = (function() { downloadPart(0); function downloadPart(part) { - that.downloadVideoURL(id, pandora.user.ui.videoResolution, part + 1, false, function(result) { - result.progress = 1/parts * (part + result.progress); - that.downloads[id].progress = result.progress; - if (result.cancel) { - that.downloads[id].cancel = result.cancel; - } - if (result.total) { - sizes[part] = result.total; - that.downloads[id].size = Ox.sum(sizes); - } - if (result.url) { - if (part + 1 == parts) { - delete that.downloads[id]; - active = false; - if (queue.length) { - var next = queue.shift(); - setTimeout(function() { - cacheVideo(next[0], next[1]); - }); - } - } else { + if (that.getVideoURL(id, pandora.user.ui.videoResolution, part + 1)) { + done(); + else { + that.downloadVideoURL(id, pandora.user.ui.videoResolution, part + 1, false, function(result) { + result.progress = 1/parts * (part + result.progress); + that.downloads[id].progress = result.progress; + if (result.cancel) { + that.downloads[id].cancel = result.cancel; + } + if (result.total) { + sizes[part] = result.total; + that.downloads[id].size = Ox.sum(sizes); + } + if (result.url) { + done(); + } + callback && callback(result); + }); + } + function done() { + if (part + 1 == parts) { + delete that.downloads[id]; + active = false; + if (queue.length) { + var next = queue.shift(); setTimeout(function() { - downloadPart(part + 1); + cacheVideo(next[0], next[1]); }); } + } else { + setTimeout(function() { + downloadPart(part + 1); + }); } - callback && callback(result); - }); + } } }); }