|
@ -115,8 +115,13 @@ IRC.prototype.start = function () { |
|
|
|
|
|
|
|
|
// log file creation
|
|
|
// log file creation
|
|
|
response.on('end', function () { |
|
|
response.on('end', function () { |
|
|
var json = JSON.parse(body); |
|
|
|
|
|
|
|
|
var json = null; |
|
|
|
|
|
try { |
|
|
|
|
|
json = JSON.parse(body); |
|
|
__self.streaming = json.stream !== null; |
|
|
__self.streaming = json.stream !== null; |
|
|
|
|
|
} catch (err) { |
|
|
|
|
|
__self.streaming = false; |
|
|
|
|
|
} |
|
|
if (__self.streaming && !__self.new_file) { |
|
|
if (__self.streaming && !__self.new_file) { |
|
|
// prevent another file from being created while streaming
|
|
|
// prevent another file from being created while streaming
|
|
|
__self.new_file = true; |
|
|
__self.new_file = true; |
|
@ -137,6 +142,7 @@ IRC.prototype.start = function () { |
|
|
file.open(__self.log, 'w'); |
|
|
file.open(__self.log, 'w'); |
|
|
} else if (!__self.streaming) { |
|
|
} else if (!__self.streaming) { |
|
|
__self.new_file = false; |
|
|
__self.new_file = false; |
|
|
|
|
|
__self.log = ''; |
|
|
} |
|
|
} |
|
|
setTimeout(stream_status, 1000); |
|
|
setTimeout(stream_status, 1000); |
|
|
}); |
|
|
}); |
|
|