From 4270cb877688ed6f24454acbafff211948c9d759 Mon Sep 17 00:00:00 2001 From: Matt Moran Date: Sat, 6 Apr 2024 19:36:06 +1100 Subject: [PATCH] Add `librespot_options` option --- spotify/DOCS.md | 6 ++++++ spotify/config.yaml | 1 + spotify/rootfs/etc/services.d/spotifyd/run | 9 ++++++++- spotify/translations/en.yaml | 5 +++++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/spotify/DOCS.md b/spotify/DOCS.md index a363e63..a43a92b 100644 --- a/spotify/DOCS.md +++ b/spotify/DOCS.md @@ -37,6 +37,7 @@ name: HomeAssistant bitrate: 320 username: frenck@example.com password: MySpotifyPassword +librespot_options: --volume-ctrl fixed --normalisation-pregain -9 ``` **Note**: _This is just an example, don't copy and paste it! Create your own!_ @@ -88,6 +89,10 @@ to disallow guests on your network to use the add-on. The password you use to login to your Spotify Premium account. +### Option: `librespot_options` + +Additional options for librespot. For more info see the [librespot documentation][librespot-options]. + ## Known issues and limitations - This add-on requires a Spotify Premium account. @@ -159,6 +164,7 @@ SOFTWARE. [forum]: https://community.home-assistant.io/t/home-assistant-community-add-on-spotify-connect/61210?u=frenck [frenck]: https://github.com/frenck [issue]: https://github.com/hassio-addons/addon-spotify-connect/issues +[librespot-options]: https://github.com/librespot-org/librespot/wiki/Options [reddit]: https://reddit.com/r/homeassistant [releases]: https://github.com/hassio-addons/addon-spotify-connect/releases [semver]: http://semver.org/spec/v2.0.0.htm diff --git a/spotify/config.yaml b/spotify/config.yaml index d0a4528..7160fc4 100644 --- a/spotify/config.yaml +++ b/spotify/config.yaml @@ -21,3 +21,4 @@ schema: bitrate: list(96|160|320) username: str? password: password? + librespot_options: str? diff --git a/spotify/rootfs/etc/services.d/spotifyd/run b/spotify/rootfs/etc/services.d/spotifyd/run index e77f9a4..9c8034e 100755 --- a/spotify/rootfs/etc/services.d/spotifyd/run +++ b/spotify/rootfs/etc/services.d/spotifyd/run @@ -8,6 +8,7 @@ declare bitrate declare name declare password declare username +declare librespot_options bashio::log.info 'Starting the Spotify daemon...' @@ -37,5 +38,11 @@ if bashio::debug; then options+=(--verbose) fi +# Additional command line options +librespot_options='' +if bashio::config.has_value 'librespot_options'; then + librespot_options="$(bashio::config 'librespot_options')" +fi + # Run librespot -exec librespot "${options[@]}" +exec librespot "${options[@]}" $librespot_options diff --git a/spotify/translations/en.yaml b/spotify/translations/en.yaml index 94e5b72..bdc6d23 100644 --- a/spotify/translations/en.yaml +++ b/spotify/translations/en.yaml @@ -23,3 +23,8 @@ configuration: name: Spotify password description: >- The password to log into your Spotify Premium account with. + librespot_options: + name: Librespot options + description: >- + Additional options for librespot. For available options see: + https://github.com/librespot-org/librespot/wiki/Options.