mirror of
https://github.com/wkulhanek/bonob.git
synced 2025-12-21 17:33:29 +01:00
Ability for Navidrome to have custom client app per mime type, so can have custom transcoders per audio file type. Change stream to stream rather than buffer response in byte array
This commit is contained in:
21
src/app.ts
21
src/app.ts
@@ -1,7 +1,7 @@
|
||||
import sonos, { bonobService } from "./sonos";
|
||||
import server from "./server";
|
||||
import logger from "./logger";
|
||||
import { Navidrome } from "./navidrome";
|
||||
import { DEFAULT, Navidrome, appendMimeTypeToClientFor } from "./navidrome";
|
||||
import encryption from "./encryption";
|
||||
import { InMemoryAccessTokens, sha256 } from "./access_tokens";
|
||||
import { InMemoryLinkCodes } from "./link_codes";
|
||||
@@ -23,21 +23,28 @@ const bonob = bonobService(
|
||||
const secret = process.env["BONOB_SECRET"] || "bonob";
|
||||
|
||||
const sonosSystem = sonos(SONOS_DEVICE_DISCOVERY, SONOS_SEED_HOST);
|
||||
if(process.env["BONOB_SONOS_AUTO_REGISTER"] == "true") {
|
||||
sonosSystem.register(bonob).then(success => {
|
||||
if(success) {
|
||||
logger.info(`Successfully registered ${bonob.name}(SID:${bonob.sid}) with sonos`)
|
||||
if (process.env["BONOB_SONOS_AUTO_REGISTER"] == "true") {
|
||||
sonosSystem.register(bonob).then((success) => {
|
||||
if (success) {
|
||||
logger.info(
|
||||
`Successfully registered ${bonob.name}(SID:${bonob.sid}) with sonos`
|
||||
);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
const customClientsFor = process.env["BONOB_STREAM_CUSTOM_CLIENTS"] || "none";
|
||||
const streamUserAgent =
|
||||
customClientsFor == "none" ? DEFAULT : appendMimeTypeToClientFor(customClientsFor.split(","));
|
||||
|
||||
const app = server(
|
||||
sonosSystem,
|
||||
bonob,
|
||||
WEB_ADDRESS,
|
||||
new Navidrome(
|
||||
process.env["BONOB_NAVIDROME_URL"] || "http://localhost:4533",
|
||||
encryption(secret)
|
||||
encryption(secret),
|
||||
streamUserAgent
|
||||
),
|
||||
new InMemoryLinkCodes(),
|
||||
new InMemoryAccessTokens(sha256(secret))
|
||||
|
||||
Reference in New Issue
Block a user