Skip to content

Commit

Permalink
validate that the initial-volume value is within the valid range (0-1…
Browse files Browse the repository at this point in the history
…00) before passing it to librespot.
  • Loading branch information
spoetnik committed Dec 6, 2024
1 parent ba0acdf commit 2c668a8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion spotify/rootfs/etc/services.d/spotifyd/run
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ bashio::log.info 'Starting the Spotify daemon...'
options+=(--bitrate $(bashio::config 'bitrate'))

# Initial Volume
options+=(--initial-volume $(bashio::config 'initial-volume'))
initial_volume=$(bashio::config 'initial-volume')
if ! [[ "$initial_volume" =~ ^[0-9]+$ ]] || [ "$initial_volume" -lt 0 ] || [ "$initial_volume" -gt 100 ]; then
bashio::log.warning "Invalid initial-volume value: $initial_volume. Using default."
initial_volume=50
fi
options+=(--initial-volume "$initial_volume")


# Device name
name=$(bashio::config 'name')
Expand Down

0 comments on commit 2c668a8

Please sign in to comment.