mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2024-11-10 05:00:18 +00:00
Update fetch function in Stations class
This commit is contained in:
parent
e229b91812
commit
7f791e0075
@ -17,7 +17,11 @@ module.exports = class Stations extends Array {
|
|||||||
if(list){
|
if(list){
|
||||||
this.length = 0;
|
this.length = 0;
|
||||||
list.forEach(station => {
|
list.forEach(station => {
|
||||||
|
try {
|
||||||
this.push(station);
|
this.push(station);
|
||||||
|
} catch (error) {
|
||||||
|
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if(options.show){
|
if(options.show){
|
||||||
@ -27,6 +31,16 @@ module.exports = class Stations extends Array {
|
|||||||
});
|
});
|
||||||
console.log("\n");
|
console.log("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
list.forEach(async station => {
|
||||||
|
try {
|
||||||
|
let stationTest = await fetch(station.stream[station.stream.default]);
|
||||||
|
if(stationTest.ok === true) return;
|
||||||
|
this.splice(this.indexOf(station),1);
|
||||||
|
} catch (error) {
|
||||||
|
this.splice(this.indexOf(station),1);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.logger('Stations', 'Successfully fetched list');
|
this.logger('Stations', 'Successfully fetched list');
|
||||||
@ -48,8 +62,9 @@ module.exports = class Stations extends Array {
|
|||||||
|
|
||||||
search(key) {
|
search(key) {
|
||||||
if (this === null) return false;
|
if (this === null) return false;
|
||||||
let foundStations = [];
|
|
||||||
if (!key) return false;
|
if (!key) return false;
|
||||||
|
|
||||||
|
let foundStations = [];
|
||||||
if (key == "radio") return false;
|
if (key == "radio") return false;
|
||||||
|
|
||||||
this
|
this
|
||||||
|
Loading…
Reference in New Issue
Block a user