mirror of
https://github.com/wkulhanek/bonob.git
synced 2025-12-21 17:33:29 +01:00
30 lines
716 B
TypeScript
30 lines
716 B
TypeScript
import registrar from "./registrar";
|
|
import readConfig from "./config";
|
|
import { URLBuilder } from "./url_builder";
|
|
|
|
const params = process.argv.slice(2);
|
|
|
|
if (params.length != 1) {
|
|
console.error("Usage: register [URL to bonob]");
|
|
process.exit(1);
|
|
}
|
|
|
|
const bonobUrl = new URLBuilder(params[0]!);
|
|
|
|
const config = readConfig();
|
|
|
|
registrar(bonobUrl, config.sonos.discovery.seedHost)()
|
|
.then((success) => {
|
|
if (success) {
|
|
console.log(`Successfully registered bonob @ ${bonobUrl} with sonos`);
|
|
process.exit(0);
|
|
} else {
|
|
console.error(`Failed registering bonob @ ${bonobUrl} with sonos`);
|
|
process.exit(1);
|
|
}
|
|
})
|
|
.catch((e) => {
|
|
console.error(e);
|
|
process.exit(1);
|
|
});
|