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;
|
var v = response.data;
|
||||||
that.video.title = v.title;
|
that.video.title = v.title;
|
||||||
that.video.duration = v.duration;
|
that.video.duration = v.duration;
|
||||||
|
that.infoUrl = padmaConfig.data_url + that.id + "/info";
|
||||||
that.layers = flattenLayers(v.layers);
|
that.layers = flattenLayers(v.layers);
|
||||||
that.hasAllData = true;
|
that.hasAllData = true;
|
||||||
that.hasLayersData = true;
|
that.hasLayersData = true;
|
||||||
|
@ -82,7 +83,9 @@ padmaVideo.prototype.getVideo = function(tc, size) {
|
||||||
|
|
||||||
|
|
||||||
padmaVideo.prototype.getDownloadLink = function(tcIn, tcOut) {
|
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";
|
// 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) {
|
function parsePadmaUrl(link, padma_url) {
|
||||||
|
var regex = padmaConfig.data_url;
|
||||||
var regex = new RegExp("http://.*" + padma_url);
|
// var regex = new RegExp("http://.*" + padma_url);
|
||||||
var linkStr = link.replace(regex, "");
|
var linkStr = link.replace(regex, "");
|
||||||
// alert(linkStr);
|
// alert(linkStr);
|
||||||
// console.log("linkStr", linkStr);
|
// console.log("linkStr", linkStr);
|
||||||
var r = { };
|
var r = { };
|
||||||
r.url = link;
|
r.url = link;
|
||||||
// console.log(link);
|
// console.log(link);
|
||||||
var idRegex = /([A-Z]*?)\//;
|
var idRegex = /([A-Z]+)/;
|
||||||
if (linkStr.match(idRegex)) { // FIXME
|
if (linkStr.match(idRegex)) { // FIXME
|
||||||
var idMatch = linkStr.match(idRegex);
|
var idMatch = linkStr.match(idRegex);
|
||||||
// console.log("match", idMatch);
|
// console.log("match", idMatch);
|
||||||
r.videoId = idMatch[1]
|
r.videoId = idMatch[1]
|
||||||
// console.log(r.videoId);
|
// console.log(r.videoId);
|
||||||
var postIdStr = linkStr.replace(r.videoId + "/", '');
|
var postIdStr = linkStr.replace(r.videoId, '');
|
||||||
|
postIdStr = postIdStr.replace("/", ""); //FIXME
|
||||||
// console.log("postId", postIdStr);
|
// console.log("postId", postIdStr);
|
||||||
if (postIdStr == 'info' || postIdStr == '') {
|
if (postIdStr == 'info' || postIdStr == '') {
|
||||||
r.type = 'info';
|
r.type = 'info';
|
||||||
|
@ -124,6 +125,12 @@ Gives a bunch of data parsed from a pad.ma url
|
||||||
r.tcIn = tcs[0];
|
r.tcIn = tcs[0];
|
||||||
r.tcOut = tcs[1].replace("/", "");
|
r.tcOut = tcs[1].replace("/", "");
|
||||||
return r;
|
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 {
|
} else {
|
||||||
r.type = 'tc';
|
r.type = 'tc';
|
||||||
r.tc = postIdStr;
|
r.tc = postIdStr;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user