support caching local files, lookup by oshash
This commit is contained in:
parent
81ade83945
commit
b121b58a86
4 changed files with 65 additions and 18 deletions
|
|
@ -170,6 +170,20 @@ pandora.fs = (function() {
|
|||
|
||||
};
|
||||
|
||||
that.cacheBlob = function(blob, id, resolution, index, callback) {
|
||||
var key = id[0] + '/' + id + '::' + resolution,
|
||||
name = that.getVideoName(id, resolution, index);
|
||||
createTree(key, function(folder) {
|
||||
that.storeBlob(blob, name[0] + '/' + name, function(response) {
|
||||
if (response.progress == -1) {
|
||||
callback(response);
|
||||
} else {
|
||||
that.storeBlob(new Blob(['ok']), key + '/done', callback);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
that.getVideoName = function(id, resolution, part, track) {
|
||||
return pandora.getVideoURLName(id, resolution, part, track).replace(id + '\/', id + '::' + resolution + '/');
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue