forked from 0x2620/pandora
dont download same video/resolution again
This commit is contained in:
parent
71b77f6359
commit
3229c732d4
1 changed files with 19 additions and 14 deletions
|
@ -30,21 +30,26 @@ pandora.fs = (function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
that.cacheVideo = function(id, callback) {
|
that.cacheVideo = function(id, callback) {
|
||||||
that.downloads = that.downloads || {};
|
if (that.getVideoURL(id, pandora.user.ui.videoResolution, 1) || that.downloads[id]) {
|
||||||
that.downloads[id] = {
|
callback({progress: 1});
|
||||||
added: new Date(),
|
return;
|
||||||
cancel: function() {
|
} else {
|
||||||
},
|
that.downloads = that.downloads || {};
|
||||||
id: id + '::' + pandora.user.ui.videoResolution,
|
that.downloads[id] = {
|
||||||
item: id,
|
added: new Date(),
|
||||||
progress: 0,
|
cancel: function() {
|
||||||
resolution: pandora.user.ui.videoResolution,
|
},
|
||||||
size: 0
|
id: id + '::' + pandora.user.ui.videoResolution,
|
||||||
};
|
item: id,
|
||||||
|
progress: 0,
|
||||||
|
resolution: pandora.user.ui.videoResolution,
|
||||||
|
size: 0
|
||||||
|
};
|
||||||
|
|
||||||
queue.length
|
queue.length
|
||||||
? queue.push([id, callback])
|
? queue.push([id, callback])
|
||||||
: startDownload(id, callback);
|
: startDownload(id, callback);
|
||||||
|
}
|
||||||
|
|
||||||
function startDownload(id, callback) {
|
function startDownload(id, callback) {
|
||||||
pandora.api.get({id: id, keys: ['parts']}, function(result) {
|
pandora.api.get({id: id, keys: ['parts']}, function(result) {
|
||||||
|
|
Loading…
Reference in a new issue