Skip to content

Commit

Permalink
removed calls to the urlInfo function
Browse files Browse the repository at this point in the history
  • Loading branch information
hoyois committed Sep 28, 2013
1 parent 71bbb19 commit 9dfa4f1
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 19 deletions.
2 changes: 1 addition & 1 deletion BBC.js
Expand Up @@ -62,4 +62,4 @@ addKiller("BBC", {
xhr.send(null);
}

});
});
2 changes: 1 addition & 1 deletion Blip.js
Expand Up @@ -31,7 +31,7 @@ addKiller("Blip", {

for(var i = 0; i < media.length; i++) {
url = media[i].getAttribute("url");
info = urlInfo(url);
info = extInfo(getExt(url));
if(!info) continue;
if(!info.isAudio) audioOnly = false;
height = media[i].getAttribute("height");
Expand Down
6 changes: 3 additions & 3 deletions Brightcove.js
Expand Up @@ -35,7 +35,7 @@ addKiller("Brightcove", {
if(source.videoCodec !== "H264" || !source.defaultURL) return;
var bitrate = Math.round(parseInt(source.encodingRate)/100000);
var format = bitrate === 0 ? source.frameHeight + "p " : bitrate + "00k ";
var ext = extractExt(source.defaultURL);
var ext = getExt(source.defaultURL);
format += ext ? ext.toUpperCase() : "MP4";
sources.unshift({"url": source.defaultURL, "format": format, "height": parseInt(source.frameHeight), "isAudio": source.audioOnly, "isNative": true});
};
Expand All @@ -44,7 +44,7 @@ addKiller("Brightcove", {
if(sources.length === 0) {
media.IOSRenditions.forEach(processRendition);
if(sources.length === 0) {
var source = urlInfo(media.FLVFullLengthURL);
var source = extInfo(getExt(media.FLVFullLengthURL));
if(source && !media.FLVFullLengthStreamed) {
source.url = media.FLVFullLengthURL;
sources.push(source);
Expand All @@ -61,4 +61,4 @@ addKiller("Brightcove", {
xhr.send(null);
}

});
});
6 changes: 3 additions & 3 deletions Flash.js
Expand Up @@ -82,7 +82,7 @@ addKiller("Flash", {
if(/^https?:\/\/www\.tvn24\.pl/.test(data.location)) sourceURL = sourceURL.replace(".flv", ".mp4");

if(!sourceURL) return;
var ext = extractExt(sourceURL);
var ext = getExt(sourceURL);
var isPlaylist = data.file === "playlistfile" || data.hash === "playlist_url" || ext === "xml" || ext === "xspf";

var baseURL = data.src; // used to resolve video URLs
Expand Down Expand Up @@ -111,7 +111,7 @@ addKiller("Flash", {

if(flashvars["hd.file"]) {
var hdURL = decodeURIComponent(flashvars["hd.file"]);
var info = urlInfo(hdURL);
var info = extInfo(getExt(hdURL));
if(info) {
info.url = makeAbsoluteURL(hdURL, baseURL);
info.format = "HD " + info.format;
Expand All @@ -125,7 +125,7 @@ addKiller("Flash", {
getMIMEType(sourceURL, function(type) {
call(typeInfo(type));
});
} else call(urlInfo(sourceURL));
} else call(extInfo(ext));
}

});
4 changes: 2 additions & 2 deletions Flowplayer.js
Expand Up @@ -36,7 +36,7 @@ addKiller("Flowplayer", {
if(clip.provider === "rtmp") return;

clip.url = decodeURIComponent(clip.url);
var source = urlInfo(clip.url);
var source = extInfo(getExt(clip.url));
if(source) {
var base = clip.baseUrl ? clip.baseUrl : baseURL;
if(base && !/^https?:/.test(clip.url)) {
Expand All @@ -60,7 +60,7 @@ addKiller("Flowplayer", {
});
if(!source.isAudio) audioOnly = false;
} else {
var ext = extractExt(clip.url);
var ext = getExt(clip.url);
if(ext === "jpg" || ext === "png") splash = clip.url;
else splash = undefined;
}
Expand Down
2 changes: 1 addition & 1 deletion Gametrailers.js
Expand Up @@ -26,7 +26,7 @@ addKiller("Gametrailers", {
return false;
}
var src = elements[0].textContent;
var info = urlInfo(src);
var info = extInfo(getExt(src));
if(!info) return;
info.url = src;
var rendition = xml.getElementsByTagName('rendition');
Expand Down
2 changes: 1 addition & 1 deletion Generic.js
Expand Up @@ -3,7 +3,7 @@ addKiller("Generic", {
"canKill": function(data) {
// Streaming is not supported
if(/^rts?p/.test(data.src) || data.params.href) return false;
return (data.info = typeInfo(data.type)) || (data.info = urlInfo(data.src));
return (data.info = typeInfo(data.type)) || (data.info = extInfo(getExt(data.src)));
},

"process": function(data, callback) {
Expand Down
6 changes: 3 additions & 3 deletions IGN.js
Expand Up @@ -24,7 +24,7 @@ addKiller("IGN", {
if(isEmbed) siteInfo = {"name": "IGN", "url": media.metadata.url.replace(/\\\//g, "/")};

var videoURL = media.url.replace(/\\\//g, "/");
var source = urlInfo(videoURL);
var source = extInfo(getExt(videoURL));
if(!source) return;
source.url = videoURL;
source.height = 720;
Expand All @@ -39,5 +39,5 @@ addKiller("IGN", {
}]
});
}
});

});
2 changes: 2 additions & 0 deletions MTVNetworks.js
Expand Up @@ -11,9 +11,11 @@ addKiller("MTVNetworks", {
"arc:episode:southparkstudios.com:": "3",
"cms:video:comedycentral.com:": "6", // no example found
"arc:playlist:comedycentral.com:": "3",
// "arc:episode:comedycentral.com:": "2", // works without context
// "arc:video:comedycentral.com:": "1", // works without context
// "cms:video:tosh.comedycentral.com:": "1", // has no working context
// "cms:promo:tosh.comedycentral.com:": "1", // works without context
// "arc:episode:tosh:comedycentral.com:": "1", // has no working context
"hcx:content:comedycentral.co.uk:": "3"//, // no example found
// "cms:video:jokes.com:": "1", // works without context
// "uma:video:mtv.com:": "1" // works without context
Expand Down
2 changes: 1 addition & 1 deletion Silverlight.js
Expand Up @@ -10,7 +10,7 @@ addKiller("Silverlight", {
"process": function(data, callback) {
var SLvars = parseSLVariables(data.params.initparams);
var mediaURL = decodeURIComponent(SLvars[data.file]);
var info = urlInfo(mediaURL);
var info = extInfo(getExt(mediaURL));

var audioOnly = false;
var sources = [];
Expand Down
2 changes: 1 addition & 1 deletion Vimeo.js
Expand Up @@ -67,4 +67,4 @@ addKiller("Vimeo", {
xhr.send(null);
}

});
});
2 changes: 1 addition & 1 deletion mediaTypes.js
Expand Up @@ -7,7 +7,7 @@ function typeInfo(type) {
}

function urlInfo(url) {
url = extractExt(url);
url = getExt(url);
if(url === "") return null;
for(var type in nativeMediaTypes) {
if(nativeMediaTypes[type].exts.indexOf(url) !== -1) return {"isNative": true, "isAudio": /^audio/.test(type), "format": nativeMediaTypes[type].format};
Expand Down
2 changes: 1 addition & 1 deletion support.js
Expand Up @@ -145,7 +145,7 @@ function extractDomain(url) {
return /\/\/([^\/]+)\//.exec(url)[1];
}

function extractExt(url) {
function getExt(url) {
var i = url.search(/[?#]/);
if(i === -1) i = undefined;
url = url.substring(url.lastIndexOf("/", i) + 1, i);
Expand Down

0 comments on commit 9dfa4f1

Please sign in to comment.