dont re-download cached parts for multipart items

This commit is contained in:
j 2015-04-11 12:13:41 +02:00
parent c743ad7a71
commit a8a4191f1a
2 changed files with 32 additions and 24 deletions

View file

@ -13,6 +13,7 @@ pandora.ui.cacheDialog = function() {
}, },
{ {
id: 'item', id: 'item',
operator: '+',
title: Ox._('Item'), title: Ox._('Item'),
visible: true, visible: true,
width: 48 width: 48

View file

@ -33,6 +33,9 @@ pandora.fs = (function() {
downloadPart(0); downloadPart(0);
function downloadPart(part) { function downloadPart(part) {
if (that.getVideoURL(id, pandora.user.ui.videoResolution, part + 1)) {
done();
else {
that.downloadVideoURL(id, pandora.user.ui.videoResolution, part + 1, false, function(result) { that.downloadVideoURL(id, pandora.user.ui.videoResolution, part + 1, false, function(result) {
result.progress = 1/parts * (part + result.progress); result.progress = 1/parts * (part + result.progress);
that.downloads[id].progress = result.progress; that.downloads[id].progress = result.progress;
@ -44,6 +47,12 @@ pandora.fs = (function() {
that.downloads[id].size = Ox.sum(sizes); that.downloads[id].size = Ox.sum(sizes);
} }
if (result.url) { if (result.url) {
done();
}
callback && callback(result);
});
}
function done() {
if (part + 1 == parts) { if (part + 1 == parts) {
delete that.downloads[id]; delete that.downloads[id];
active = false; active = false;
@ -59,8 +68,6 @@ pandora.fs = (function() {
}); });
} }
} }
callback && callback(result);
});
} }
}); });
} }