Skip to content

Commit

Permalink
Raspotify .service upgrade fix (#7)
Browse files Browse the repository at this point in the history
* Fix broken raspotify pipe/fifo logic, after raspotify got updated

* remove leftover commented code
  • Loading branch information
jgabriel98 authored Nov 30, 2021
1 parent f575096 commit 647ab6e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 27 deletions.
2 changes: 1 addition & 1 deletion etc/shairport-sync.conf
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ pa =
pipe =
{
// name = "/path/to/pipe"; // there is no default pipe name for the output
name = "/tmp/snapfifo_shairport";
name = "/run/snapserver/snapfifo_shairport";
};

// These are no configuration file parameters for the "stdout" audio back end. No interpolation is done.
Expand Down
6 changes: 3 additions & 3 deletions etc/snapserver.conf
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,11 @@ bind_to_address = ::
# tcp server: tcp://<listen IP, e.g. 127.0.0.1>:<port>?name=<name>[&mode=server]
# tcp client: tcp://<server IP, e.g. 127.0.0.1>:<port>?name=<name>&mode=client
# spotify pipe stream
source = pipe:///tmp/snapfifo_raspotify?name=Spotify&codec=null&sampleformat=44100:16:2
source = pipe:///run/snapserver/snapfifo_raspotify?name=Spotify&codec=null&sampleformat=44100:16:2
# airplay pipe stream
source = pipe:///tmp/snapfifo_shairport?name=Airplay&codec=null&sampleformat=44100:16:2
source = pipe:///run/snapserver/snapfifo_shairport?name=Airplay&codec=null&sampleformat=44100:16:2
# bluetooth pipe stream
source = pipe:///tmp/snapfifo_bluetooth?name=Bluetooth&codec=null&sampleformat=44100:16:2
source = pipe:///run/snapserver/snapfifo_bluetooth?name=Bluetooth&codec=null&sampleformat=44100:16:2
# client bluetooth tcp stream
source = tcp://0.0.0.0:4953?name=ClientBluetooth&mode=server&codec=null&sampleformat=44100:16:2
# global music stream
Expand Down
30 changes: 11 additions & 19 deletions serverInstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ done

# raspotify setup
if $INSTALL_RASPOTIFY; then
OPTIONS_VALUE="--device /tmp/snapfifo_raspotify"
OPTIONS_VALUE="--device /run/snapserver/snapfifo_raspotify"
BACKEND_ARGS_VALUE="--backend pipe"

RASPOTIFY_FILE="/etc/default/raspotify"

echo -e "\n${GREEN}installing raspotify...${NC}"

curl -k -L https://github.com/dtcooper/raspotify/releases/download/0.16.0/raspotify_0.16.0.librespot.v0.1.3-37-g0adb851_armhf.deb -o 'raspotify.deb' &&
curl -k -L https://github.com/dtcooper/raspotify/releases/download/0.31.3/raspotify_0.31.3.librespot.v0.3.1-19-gbbd575e_armhf.deb -o 'raspotify.deb' &&
sudo apt install ./raspotify.deb -y
rm -f raspotify.deb

Expand All @@ -81,17 +81,18 @@ fi

# shairport setup
if $INSTALL_SHAIRPORT; then
SHAIRPORT_VERSION="3.3.8"
echo -e "\n${YELLOW}building shairport-sync...${NC}"
curl -sL https://github.com/mikebrady/shairport-sync/archive/3.3.7rc2.tar.gz | tar xz
cd shairport-sync-3.3.7rc2/
curl -sL https://github.com/mikebrady/shairport-sync/archive/$SHAIRPORT_VERSION.tar.gz | tar xz
cd shairport-sync-$SHAIRPORT_VERSION/
autoreconf -i -f
./configure 'CFLAGS=-O3' 'CXXFLAGS=-O3' --sysconfdir=/etc --with-pipe --with-systemd --with-avahi --with-ssl=openssl
make

echo -e "\n${GREEN}installing shairport-sync...${NC}"
sudo make install
cd ..
rm -r shairport-sync-3.3.7rc2/
rm -r shairport-sync-$SHAIRPORT_VERSION/
sudo systemctl enable shairport-sync

echo -e "\n${LIGHT_BLUE}configuring shairport-sync...${NC}"
Expand All @@ -102,8 +103,9 @@ fi
# bluetooth setup
if $INSTALL_BLUETOOTH; then
if ! command -v bluealsa &> /dev/null; then
echo -e "\n{RED}bluealsa could not be found${NC}"
echo -e "{LIGHT_GRAY}skipping bluetooth instalation${NC}"
echo -e "\n${RED}bluealsa could not be found${NC}"
echo -e "${LIGHT_GRAY}skipping bluetooth instalation${NC}"
INSTALL_BLUETOOTH=false
else
echo -e "\n${LIGHT_BLUE}configuring BlueAlsa...${NC}"
bash ./scripts/config-bluetooth.sh "$DEVICE_NAME"
Expand All @@ -114,7 +116,6 @@ if $INSTALL_BLUETOOTH; then
fi

# snapserver setup

echo -e "\n${GREEN}installing snapcast server...${NC}"
curl -k -L https://github.com/badaix/snapcast/releases/download/v0.25.0/snapserver_0.25.0-1_armhf.deb -o 'snapserver.deb' &&
sudo apt install ./snapserver.deb -y
Expand All @@ -123,21 +124,12 @@ rm -f snapserver.deb

echo -e "\n${LIGHT_BLUE}configuring snapserver...${NC}"
sudo cp ./etc/snapserver.conf /etc/snapserver.conf

# old way to configure (and with multiple streams)
#sudo sed -i "0,/^stream.*/s//first_mark_point_stream/" /etc/snapserver.conf
#sudo sed -i "s/^stream.*//g" /etc/snapserver.conf

#sudo sed -i "s/^first_mark_point_stream/# raspotify pipe stream\\n# shairport pipe stream/g" /etc/snapserver.conf

#value="stream = pipe:///tmp/snapfifo?name=Spotify&sampleformat=44100:16:2"
#sudo sed -i "/# raspotify pipe stream/a ${value}" /etc/snapserver.conf
#value="stream = pipe:///tmp/snapfifo_shairport?name=ShairportSync&sampleformat=44100:16:2"
#sudo sed -i "/# shairport pipe stream/a ${value}" /etc/snapserver.conf
sed -i '/\[Service\]/a RuntimeDirectory=snapserver' /lib/systemd/system/snapserver.service


echo -e "\n${CYAN}restarting raspotify, shairport-sync and snapcast services${NC}"
if $INSTALL_RASPOTIFY; then sudo systemctl restart raspotify.service; fi
if $INSTALL_SHAIRPORT; then sudo systemctl restart shairport-sync.service; fi
if $INSTALL_BLUETOOTH; then sudo systemctl restart bluealsa.service bluealsa-aplay.service; fi
sudo systemctl daemon-reload
sudo systemctl restart snapserver.service
9 changes: 5 additions & 4 deletions uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,17 @@ else
fi

if command -v shairport-sync &> /dev/null; then
SHAIRPORT_VERSION="3.3.8"
echo -e "\n${YELLOW}removing ${LIGHT_BLUE}shairport${NC}"
echo -e "\n${WHITE}building ${LIGHT_BLUE}shairport${WHITE} makefile${NC}"
curl -sL https://github.com/mikebrady/shairport-sync/archive/3.3.7rc2.tar.gz | tar xz
cd shairport-sync-3.3.7rc2/
curl -sL https://github.com/mikebrady/shairport-sync/archive/$SHAIRPORT_VERSION.tar.gz | tar xz
cd shairport-sync-$SHAIRPORT_VERSION/
autoreconf -i -f
./configure --sysconfdir=/etc --with-pipe --with-systemd --with-avahi --with-ssl=openssl

echo -e "\n${YELLOW}runing make uninstall for ${LIGHT_BLUE}shairport${NC}"
sudo make uninstall
rm -r shairport-sync-3.3.7rc2/
rm -r shairport-sync-$SHAIRPORT_VERSION/

echo -e "\n${YELLOW}cleaning ${LIGHT_BLUE}shairport${YELLOW}configuration files${NC}"
sudo systemctl stop shairport-sync.service
Expand Down

0 comments on commit 647ab6e

Please sign in to comment.