From 2594e1dff9a6b710a29673717a726bca014a82d8 Mon Sep 17 00:00:00 2001 From: David Cooper Date: Wed, 30 Dec 2020 13:29:39 -0800 Subject: [PATCH] Prepare for new release with fixed volume args --- raspotify/DEBIAN/postinst | 9 +++++++++ raspotify/DEBIAN/preinst | 5 ----- raspotify/etc/default/raspotify | 12 ++++++------ raspotify/lib/systemd/system/raspotify.service | 4 ++-- 4 files changed, 17 insertions(+), 13 deletions(-) delete mode 100755 raspotify/DEBIAN/preinst diff --git a/raspotify/DEBIAN/postinst b/raspotify/DEBIAN/postinst index dad6c81..6a7ca10 100755 --- a/raspotify/DEBIAN/postinst +++ b/raspotify/DEBIAN/postinst @@ -16,6 +16,15 @@ mkdir -m 0755 -p /var/cache/raspotify chown raspotify:raspotify /var/cache/raspotify adduser raspotify audio +# Make sure `--linear-volume' is properly renamed +if [ -f /etc/default/raspotify ]; then + sed -i 's/--linear-volume/--volume-ctrl linear/' /etc/default/raspotify +fi + +if [ -f /etc/systemd/system/raspotify.service ]; then + sed -i 's/--linear-volume/--volume-ctrl linear/' /etc/systemd/system/raspotify.service +fi + # Based off what debhelper would have added # This will only remove masks created by d-s-h on package removal. diff --git a/raspotify/DEBIAN/preinst b/raspotify/DEBIAN/preinst deleted file mode 100755 index f8bb290..0000000 --- a/raspotify/DEBIAN/preinst +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -# Fix changes in command line arguments for librespot v0.1.3 - -test -e /etc/default/raspotify && sed -i 's/--linear-volume/--volume-ctrl=linear/' /etc/default/raspotify >/dev/null 2>&1 diff --git a/raspotify/etc/default/raspotify b/raspotify/etc/default/raspotify index 02b838b..2bed688 100644 --- a/raspotify/etc/default/raspotify +++ b/raspotify/etc/default/raspotify @@ -3,6 +3,11 @@ # Device name on Spotify Connect #DEVICE_NAME="raspotify" +# The displayed device type in Spotify clients. +# Can be "unknown", "computer", "tablet", "smartphone", "speaker", "tv", +# "avr" (Audio/Video Receiver), "stb" (Set-Top Box), and "audiodongle". +#DEVICE_TYPE="speaker" + # Bitrate, one of 96 (low quality), 160 (default quality), or 320 (high quality) #BITRATE="160" @@ -27,13 +32,8 @@ # By default, the volume normalization is enabled, add alternative volume # arguments here if you'd like, but these should be fine. -#VOLUME_ARGS="--enable-volume-normalisation --volume-ctrl=linear --initial-volume=100" +#VOLUME_ARGS="--enable-volume-normalisation --volume-ctrl linear --initial-volume=100" # Backend could be set to pipe here, but it's for very advanced use cases of # librespot, so you shouldn't need to change this under normal circumstances. #BACKEND_ARGS="--backend alsa" - -# The displayed device type in Spotify clients. -# Can be "unknown", "computer", "tablet", "smartphone", "speaker", "tv", -# "avr" (Audio/Video Receiver), "stb" (Set-Top Box), and "audiodongle". -#DEVICE_TYPE="speaker" \ No newline at end of file diff --git a/raspotify/lib/systemd/system/raspotify.service b/raspotify/lib/systemd/system/raspotify.service index 99f01a2..5247734 100644 --- a/raspotify/lib/systemd/system/raspotify.service +++ b/raspotify/lib/systemd/system/raspotify.service @@ -12,11 +12,11 @@ ExecStartPre=/bin/mkdir -m 0755 -p /var/cache/raspotify ; /bin/chown raspotify:r Environment="DEVICE_NAME=raspotify (%H)" Environment="BITRATE=160" Environment="CACHE_ARGS=--disable-audio-cache" -Environment="VOLUME_ARGS=--enable-volume-normalisation --volume-ctrl=linear --initial-volume=100" +Environment="VOLUME_ARGS=--enable-volume-normalisation --volume-ctrl linear --initial-volume 100" Environment="BACKEND_ARGS=--backend alsa" Environment="DEVICE_TYPE=speaker" EnvironmentFile=-/etc/default/raspotify -ExecStart=/usr/bin/librespot --name ${DEVICE_NAME} $BACKEND_ARGS --bitrate ${BITRATE} $CACHE_ARGS $VOLUME_ARGS $OPTIONS --device-type ${DEVICE_TYPE} +ExecStart=/usr/bin/librespot --name ${DEVICE_NAME} --device-type ${DEVICE_TYPE} $BACKEND_ARGS --bitrate ${BITRATE} $CACHE_ARGS $VOLUME_ARGS $OPTIONS [Install] WantedBy=multi-user.target