dont download same video/resolution again

This commit is contained in:
j 2015-03-21 12:59:21 +05:30
parent 71b77f6359
commit 3229c732d4

View file

@ -30,6 +30,10 @@ pandora.fs = (function() {
} }
that.cacheVideo = function(id, callback) { that.cacheVideo = function(id, callback) {
if (that.getVideoURL(id, pandora.user.ui.videoResolution, 1) || that.downloads[id]) {
callback({progress: 1});
return;
} else {
that.downloads = that.downloads || {}; that.downloads = that.downloads || {};
that.downloads[id] = { that.downloads[id] = {
added: new Date(), added: new Date(),
@ -45,6 +49,7 @@ pandora.fs = (function() {
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) {