Update Streamer class

This commit is contained in:
Christer Warén 2021-09-11 23:03:20 +03:00
parent 824d4042c1
commit 49475212a7

View File

@ -14,12 +14,19 @@ module.exports = class {
if(!client.stations) return;
client.stations.forEach(station => {
const audioPlayer = createAudioPlayer();
let audioPlayer = this.map.get(station.name);
if(!audioPlayer) {
audioPlayer = createAudioPlayer();
this.map.set(station.name, audioPlayer);
}
this.play(station);
});
}
refresh(client){
this.init(client);
}
play(station) {
const audioPlayer = this.map.get(station.name);
const url = station.stream[station.stream.default];