silly fix for - in urls;
This commit is contained in:
parent
d94b749eac
commit
7a7c9875fc
|
@ -37,6 +37,7 @@ padmaVideo.prototype.getAllData = function(callback, data) {
|
|||
var v = response.data;
|
||||
that.video.title = v.title;
|
||||
that.video.duration = v.duration;
|
||||
that.infoUrl = padmaConfig.data_url + that.id + "/info";
|
||||
that.layers = flattenLayers(v.layers);
|
||||
that.hasAllData = true;
|
||||
that.hasLayersData = true;
|
||||
|
@ -82,7 +83,9 @@ padmaVideo.prototype.getVideo = function(tc, size) {
|
|||
|
||||
|
||||
padmaVideo.prototype.getDownloadLink = function(tcIn, tcOut) {
|
||||
return this.getVideo(0, "480");
|
||||
var inSeconds = npt2ms(tcIn) / 1000;
|
||||
var outSeconds = npt2ms(tcOut) / 1000;
|
||||
return this.getVideo(0, "480") + "?t=" + inSeconds + "," + outSeconds;
|
||||
// return BASE_URL + this.id + "/download/" + tcIn + "-" + tcOut + ".ogv";
|
||||
}
|
||||
|
||||
|
|
15
utils.js
15
utils.js
|
@ -92,21 +92,22 @@ Gives a bunch of data parsed from a pad.ma url
|
|||
*/
|
||||
|
||||
function parsePadmaUrl(link, padma_url) {
|
||||
|
||||
var regex = new RegExp("http://.*" + padma_url);
|
||||
var regex = padmaConfig.data_url;
|
||||
// var regex = new RegExp("http://.*" + padma_url);
|
||||
var linkStr = link.replace(regex, "");
|
||||
// alert(linkStr);
|
||||
// console.log("linkStr", linkStr);
|
||||
var r = { };
|
||||
r.url = link;
|
||||
// console.log(link);
|
||||
var idRegex = /([A-Z]*?)\//;
|
||||
var idRegex = /([A-Z]+)/;
|
||||
if (linkStr.match(idRegex)) { // FIXME
|
||||
var idMatch = linkStr.match(idRegex);
|
||||
// console.log("match", idMatch);
|
||||
r.videoId = idMatch[1]
|
||||
// console.log(r.videoId);
|
||||
var postIdStr = linkStr.replace(r.videoId + "/", '');
|
||||
var postIdStr = linkStr.replace(r.videoId, '');
|
||||
postIdStr = postIdStr.replace("/", ""); //FIXME
|
||||
// console.log("postId", postIdStr);
|
||||
if (postIdStr == 'info' || postIdStr == '') {
|
||||
r.type = 'info';
|
||||
|
@ -124,6 +125,12 @@ Gives a bunch of data parsed from a pad.ma url
|
|||
r.tcIn = tcs[0];
|
||||
r.tcOut = tcs[1].replace("/", "");
|
||||
return r;
|
||||
} else if (postIdStr.indexOf("-") != -1) {
|
||||
var tcs = postIdStr.split("-");
|
||||
r.type = 'tcRange';
|
||||
r.tcIn = tcs[0];
|
||||
r.tcOut = tcs[1].replace("/", "");
|
||||
return r;
|
||||
} else {
|
||||
r.type = 'tc';
|
||||
r.tc = postIdStr;
|
||||
|
|
Loading…
Reference in New Issue
Block a user