fix loading favorites
This commit is contained in:
parent
5fd2656dbd
commit
d17b7720ce
13
js/main.js
13
js/main.js
@ -232,6 +232,7 @@ $(function(){
|
|||||||
function action_load_favorites(){
|
function action_load_favorites(){
|
||||||
var stations = []
|
var stations = []
|
||||||
var baseUrl = OC.generateUrl('/apps/radio');
|
var baseUrl = OC.generateUrl('/apps/radio');
|
||||||
|
|
||||||
$.get(baseUrl + '/stations', function ( data ) {
|
$.get(baseUrl + '/stations', function ( data ) {
|
||||||
for (var station in data) {
|
for (var station in data) {
|
||||||
stations.push(data[station]["stationid"]);
|
stations.push(data[station]["stationid"]);
|
||||||
@ -248,18 +249,22 @@ $(function(){
|
|||||||
|
|
||||||
function query_stations(station_ids){
|
function query_stations(station_ids){
|
||||||
var station_array = [];
|
var station_array = [];
|
||||||
for (stationid in station_ids){
|
|
||||||
|
station_ids.forEach(function (station_id, idx) {
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
url: "https://www.radio-browser.info/webservice/json/stations/byid/"+station_ids[stationid],
|
url: "https://www.radio-browser.info/webservice/json/stations/byid/"+station_ids[idx],
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
}).success( function(data){
|
}).success( function(data){
|
||||||
station_array = station_array.concat(data);
|
station_array = station_array.concat(data);
|
||||||
if (station_array.length == station_ids.length){
|
if (station_ids.length == (idx+1)){
|
||||||
render_results(station_array);
|
render_results(station_array);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
};
|
|
||||||
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function radio_query(type, query){
|
function radio_query(type, query){
|
||||||
|
Loading…
Reference in New Issue
Block a user