1
0
Fork 0
mirror of https://github.com/LaQuay/TDTChannels.git synced 2025-05-24 15:07:37 +02:00

Audio with PLS player

This commit is contained in:
Marc 2018-12-26 11:19:14 +01:00
parent 6fb7e7bc78
commit 90024b3e20
2 changed files with 75 additions and 4 deletions
script/public

View file

@ -1,3 +1,26 @@
function getURLsFromPLS(sUrl, fn_callback) {
var from = "http://provisioning.streamtheworld.com/pls/CADENADIAL.pls";
$.get(from, function(data) {
$response = data.split("\n");
$urls=[];
$.each($response, function( index, value ) {
$line_separated_value = value.split("=");
if ($line_separated_value.length > 1 && $line_separated_value[1].indexOf("http") != -1) {
$urls.push($line_separated_value[1]);
}
});
fn_callback($urls)
//$.each($urls, function( index, value ) {
// if (checkIfWebsiteWorks(value)) {
// fn_callback(value);
// break;
// }
//});
});
};
function getResolution(from, fn_callback) {
$.get(from, function(data) {
$response = data.split("\n");
@ -29,4 +52,12 @@ function getUrlParameter(sParam) {
return sParameterName[1] === undefined ? true : sParameterName[1];
}
}
};
};
// Check an URL is valid or broken
// TODO: For streams if it works it keeps loading infinite time
function checkIfWebsiteWorks(sUrl){
$.get(sUrl, function(data, status){
alert("Data: " + data + "\nStatus: " + status);
});
}