mirror of
https://github.com/reality/dbot.git
synced 2024-12-27 05:02:36 +01:00
fuck timers
This commit is contained in:
parent
0913f382d7
commit
e4997cd915
@ -9,9 +9,11 @@ var _ = require('underscore')._,
|
|||||||
var radio = function(dbot) {
|
var radio = function(dbot) {
|
||||||
this.listening = false;
|
this.listening = false;
|
||||||
this.data = false;
|
this.data = false;
|
||||||
|
this.stream = false;
|
||||||
this.internalAPI = {
|
this.internalAPI = {
|
||||||
'startRadio': function() {
|
'startRadio': function() {
|
||||||
var stream = icecast.createReadStream(this.config.stream);
|
var stream = icecast.createReadStream(this.config.stream);
|
||||||
|
this.stream = stream;
|
||||||
|
|
||||||
stream.on('connect', function() {
|
stream.on('connect', function() {
|
||||||
this.listening = true;
|
this.listening = true;
|
||||||
@ -40,6 +42,7 @@ var radio = function(dbot) {
|
|||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
stream.on('end', function() {
|
stream.on('end', function() {
|
||||||
|
this.stream.close();
|
||||||
this.listening = false;
|
this.listening = false;
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}.bind(this),
|
}.bind(this),
|
||||||
@ -55,6 +58,9 @@ var radio = function(dbot) {
|
|||||||
this.onLoad = function() {
|
this.onLoad = function() {
|
||||||
this.internalAPI.getRadio();
|
this.internalAPI.getRadio();
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
|
this.onDestroy = function() {
|
||||||
|
this.stream.close();
|
||||||
|
}.bind(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.fetch = function(dbot) {
|
exports.fetch = function(dbot) {
|
||||||
|
Loading…
Reference in New Issue
Block a user