32 lines
606 B
JavaScript
Executable file
32 lines
606 B
JavaScript
Executable file
import minimist from 'minimist'
|
|
import { run } from './server.mjs'
|
|
import createDebug from 'debug'
|
|
|
|
const debug = createDebug('streamer')
|
|
|
|
main().catch(onerror)
|
|
|
|
async function main () {
|
|
const args = minimist(process.argv.slice(2), {
|
|
default: {
|
|
port: 3030,
|
|
host: '0.0.0.0',
|
|
input: 'alsa:default',
|
|
output: 'alsa:default'
|
|
},
|
|
alias: {
|
|
p: 'port',
|
|
h: 'host',
|
|
i: 'input',
|
|
o: 'output'
|
|
}
|
|
})
|
|
|
|
await run(args)
|
|
}
|
|
|
|
function onerror (err) {
|
|
if (err) console.error(err instanceof Error ? err.message : String(err))
|
|
debug(err)
|
|
process.exit(1)
|
|
}
|