Fix typo & memory leak in Streamer class

This commit is contained in:
Christer Warén 2021-09-18 15:02:13 +03:00
parent 51a038096a
commit 12db2c5fcc

View File

@ -40,7 +40,7 @@ module.exports = class {
let streamers = this.map.keys(); let streamers = this.map.keys();
streamers.forEach(streamer => { streamers.forEach(streamer => {
if(client.stations.findIndex(station => station.name == streamer)) return; if(client.stations.findIndex(station => station.name == streamer) == -1) return;
this.stop(streamer); this.stop(streamer);
}); });
} }
@ -73,15 +73,12 @@ module.exports = class {
this.play(station); this.play(station);
}); });
audioPlayer audioPlayer
.on('playing', () => { .on('playing', () => {
this.logger('Streamer', station.name + " / " + "Playing"); this.logger('Streamer', station.name + " / " + "Playing");
}) })
.on('idle', () => { .on('idle', () => {
this.logger('Streamer', station.name + " / " + "Idle"); this.logger('Streamer', station.name + " / " + "Idle");
this.play(station);
}) })
.on('paused', () => { .on('paused', () => {
this.logger('Streamer', station.name + " / " + "Paused"); this.logger('Streamer', station.name + " / " + "Paused");