initial commit

This commit is contained in:
ale 2020-03-19 15:14:26 +01:00
commit ab56bae8bf
4 changed files with 59 additions and 0 deletions

17
README.md Normal file
View File

@ -0,0 +1,17 @@
# mumble-record
## Mumble Record Bot in NodeJS
# Install
```
yarn or npm i
```
# Run
```
node record.js <server> <nick>
```
# Example
```
node record.js mastodon.madrid record
```
# License
MIT

15
package.json Normal file
View File

@ -0,0 +1,15 @@
{
"name": "record",
"version": "1.0.0",
"description": "",
"main": "record.js",
"scripts": {
"install": "openssl req -newkey rsa:2048 -nodes -keyout key.pem -x509 -days 365 -out cert.pem"
},
"dependencies": {
"lame": "*",
"mumble": "*"
},
"author": "ale",
"license": "MIT"
}

27
record.js Normal file
View File

@ -0,0 +1,27 @@
const mumble = require('mumble'),
fs = require('fs'),
lame = require('lame'),
options = {
key: fs.readFileSync(__dirname + '/key.pem'),
cert: fs.readFileSync(__dirname + '/cert.pem')
}
console.log('Connecting')
mumble.connect(process.argv[2] || 'mastodon.madrid', options, (error, connection) => {
if (error) { console.error(error) }
console.log('Connected')
connection.authenticate(process.argv[3] || 'record')
connection.on('initialized', () => {
chan = connection.channelByName('Root')
chan.join()
})
const encoder = new lame.Encoder({
channels: 1,
sampleRate: 48000,
bitDepth: 16,
bitRate: 128,
outSampleRate: 44100,
mode: lame.STEREO
})
connection.outputStream().pipe(encoder).pipe(fs.createWriteStream(__dirname + '/records/mumble-' + Date.now() + '.mp3'))
})

0
records/.gitignore vendored Normal file
View File