mirror of
https://github.com/wkulhanek/bonob.git
synced 2025-12-21 17:33:29 +01:00
Ability to disable album art for playlists (#159)
This commit is contained in:
@@ -3,6 +3,7 @@ FROM node:16-bullseye
|
|||||||
LABEL maintainer=simojenki
|
LABEL maintainer=simojenki
|
||||||
|
|
||||||
ENV JEST_TIMEOUT=60000
|
ENV JEST_TIMEOUT=60000
|
||||||
|
EXPOSE 4534
|
||||||
|
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get -y upgrade && \
|
apt-get -y upgrade && \
|
||||||
|
|||||||
@@ -3,6 +3,12 @@
|
|||||||
"build": {
|
"build": {
|
||||||
"dockerfile": "Dockerfile"
|
"dockerfile": "Dockerfile"
|
||||||
},
|
},
|
||||||
|
"containerEnv": {
|
||||||
|
// these env vars need to be configured appropriately for your local dev env
|
||||||
|
"BNB_DEV_SONOS_DEVICE_IP": "${localEnv:BNB_DEV_SONOS_DEVICE_IP}",
|
||||||
|
"BNB_DEV_HOST_IP": "${localEnv:BNB_DEV_HOST_IP}",
|
||||||
|
"BNB_DEV_SUBSONIC_URL": "${localEnv:BNB_DEV_SUBSONIC_URL}"
|
||||||
|
},
|
||||||
"remoteUser": "node",
|
"remoteUser": "node",
|
||||||
"features": {
|
"features": {
|
||||||
"ghcr.io/devcontainers/features/docker-in-docker:1": {
|
"ghcr.io/devcontainers/features/docker-in-docker:1": {
|
||||||
|
|||||||
@@ -163,6 +163,7 @@ BNB_URL | http://$(hostname):4534 | URL (including path) for bonob so that sonos
|
|||||||
BNB_SECRET | bonob | secret used for encrypting credentials
|
BNB_SECRET | bonob | secret used for encrypting credentials
|
||||||
BNB_AUTH_TIMEOUT | 1h | Timeout for the sonos auth token, described in the format [ms](https://github.com/vercel/ms), ie. '5s' == 5 seconds, '11h' == 11 hours. In the case of using Navidrome this should be less than the value for ND_SESSIONTIMEOUT
|
BNB_AUTH_TIMEOUT | 1h | Timeout for the sonos auth token, described in the format [ms](https://github.com/vercel/ms), ie. '5s' == 5 seconds, '11h' == 11 hours. In the case of using Navidrome this should be less than the value for ND_SESSIONTIMEOUT
|
||||||
BNB_LOG_LEVEL | info | Log level. One of ['debug', 'info', 'warn', 'error']
|
BNB_LOG_LEVEL | info | Log level. One of ['debug', 'info', 'warn', 'error']
|
||||||
|
BNB_DISABLE_PLAYLIST_ART | undefined | Disables playlist art generation, ie. when there are many playlists and art generation takes too long
|
||||||
BNB_SERVER_LOG_REQUESTS | false | Whether or not to log http requests
|
BNB_SERVER_LOG_REQUESTS | false | Whether or not to log http requests
|
||||||
BNB_SONOS_AUTO_REGISTER | false | Whether or not to try and auto-register on startup
|
BNB_SONOS_AUTO_REGISTER | false | Whether or not to try and auto-register on startup
|
||||||
BNB_SONOS_DEVICE_DISCOVERY | true | Enable/Disable sonos device discovery entirely. Setting this to 'false' will disable sonos device search, regardless of whether a seed host is specified.
|
BNB_SONOS_DEVICE_DISCOVERY | true | Enable/Disable sonos device discovery entirely. Setting this to 'false' will disable sonos device search, regardless of whether a seed host is specified.
|
||||||
|
|||||||
@@ -62,9 +62,9 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"clean": "rm -Rf build node_modules",
|
"clean": "rm -Rf build node_modules",
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"dev": "BNB_LOG_LEVEL=debug BNB_DEBUG=true BNB_SCROBBLE_TRACKS=false BNB_REPORT_NOW_PLAYING=false BNB_ICON_FOREGROUND_COLOR=white BNB_ICON_BACKGROUND_COLOR=darkgrey BNB_SONOS_SERVICE_NAME=bonobDev BNB_SONOS_DEVICE_DISCOVERY=true nodemon -V ./src/app.ts",
|
"dev": "BNB_LOG_LEVEL=debug BNB_DEBUG=true BNB_SCROBBLE_TRACKS=false BNB_REPORT_NOW_PLAYING=false BNB_ICON_FOREGROUND_COLOR=white BNB_ICON_BACKGROUND_COLOR=darkgrey BNB_SONOS_SEED_HOST=$BNB_DEV_SONOS_DEVICE_IP BNB_SONOS_SERVICE_NAME=z_bonobDev BNB_SONOS_DEVICE_DISCOVERY=true BNB_URL=\"http://${BNB_DEV_HOST_IP}:4534\" BNB_SUBSONIC_URL=\"${BNB_DEV_SUBSONIC_URL}\" nodemon -V ./src/app.ts",
|
||||||
"devr": "BNB_LOG_LEVEL=debug BNB_DEBUG=true BNB_SCROBBLE_TRACKS=false BNB_REPORT_NOW_PLAYING=false BNB_ICON_FOREGROUND_COLOR=white BNB_ICON_BACKGROUND_COLOR=darkgrey BNB_SONOS_SERVICE_NAME=bonobDev BNB_SONOS_DEVICE_DISCOVERY=true BNB_SONOS_AUTO_REGISTER=true nodemon -V ./src/app.ts",
|
"devr": "BNB_DISABLE_PLAYLIST_ART=true BNB_LOG_LEVEL=debug BNB_DEBUG=true BNB_SCROBBLE_TRACKS=false BNB_REPORT_NOW_PLAYING=false BNB_ICON_FOREGROUND_COLOR=white BNB_ICON_BACKGROUND_COLOR=darkgrey BNB_SONOS_SEED_HOST=$BNB_DEV_SONOS_DEVICE_IP BNB_SONOS_SERVICE_NAME=z_bonobDev BNB_SONOS_DEVICE_DISCOVERY=true BNB_SONOS_AUTO_REGISTER=true BNB_URL=\"http://${BNB_DEV_HOST_IP}:4534\" BNB_SUBSONIC_URL=\"${BNB_DEV_SUBSONIC_URL}\" nodemon -V ./src/app.ts",
|
||||||
"register-dev": "ts-node ./src/register.ts http://$(hostname):4534",
|
"register-dev": "ts-node ./src/register.ts http://${BNB_DEV_HOST_IP}:4534",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"gitinfo": "git describe --tags > .gitinfo"
|
"gitinfo": "git describe --tags > .gitinfo"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -266,6 +266,9 @@ export const playlistAlbumArtURL = (
|
|||||||
bonobUrl: URLBuilder,
|
bonobUrl: URLBuilder,
|
||||||
playlist: Playlist
|
playlist: Playlist
|
||||||
) => {
|
) => {
|
||||||
|
// todo: this should be put into config, or even just removed for the ND music source
|
||||||
|
if(process.env["BNB_DISABLE_PLAYLIST_ART"]) return iconArtURI(bonobUrl, "music");
|
||||||
|
|
||||||
const burns: BUrn[] = uniq(
|
const burns: BUrn[] = uniq(
|
||||||
playlist.entries.filter((it) => it.coverArt != undefined),
|
playlist.entries.filter((it) => it.coverArt != undefined),
|
||||||
(it) => it.album.id
|
(it) => it.album.id
|
||||||
|
|||||||
@@ -519,7 +519,6 @@ describe("playlistAlbumArtURL", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("when the playlist has external ids", () => {
|
describe("when the playlist has external ids", () => {
|
||||||
it("should format the url with encrypted urn", () => {
|
|
||||||
const bonobUrl = url("http://localhost:1234/context-path?search=yes");
|
const bonobUrl = url("http://localhost:1234/context-path?search=yes");
|
||||||
const externalArt1 = {
|
const externalArt1 = {
|
||||||
system: "external",
|
system: "external",
|
||||||
@@ -543,6 +542,7 @@ describe("playlistAlbumArtURL", () => {
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should format the url with encrypted urn", () => {
|
||||||
expect(playlistAlbumArtURL(bonobUrl, playlist).href()).toEqual(
|
expect(playlistAlbumArtURL(bonobUrl, playlist).href()).toEqual(
|
||||||
`http://localhost:1234/context-path/art/${encodeURIComponent(
|
`http://localhost:1234/context-path/art/${encodeURIComponent(
|
||||||
formatForURL(externalArt1)
|
formatForURL(externalArt1)
|
||||||
@@ -551,6 +551,26 @@ describe("playlistAlbumArtURL", () => {
|
|||||||
)}/size/180?search=yes`
|
)}/size/180?search=yes`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("when BNB_NO_PLAYLIST_ART is set", () => {
|
||||||
|
const OLD_ENV = process.env;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
process.env = { ...OLD_ENV };
|
||||||
|
|
||||||
|
process.env["BNB_DISABLE_PLAYLIST_ART"] = "true";
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
process.env = OLD_ENV;
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should return an icon", () => {
|
||||||
|
expect(playlistAlbumArtURL(bonobUrl, playlist).href()).toEqual(
|
||||||
|
`http://localhost:1234/context-path/icon/music/size/legacy?search=yes`
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("when the playlist has 4 tracks from 2 different albums, including some tracks that are missing coverArt urns", () => {
|
describe("when the playlist has 4 tracks from 2 different albums, including some tracks that are missing coverArt urns", () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user