0
0
mirror of https://github.com/libretro/Lakka-LibreELEC.git synced 2024-12-15 14:29:49 +00:00

64 lines
1.5 KiB
Bash

#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
. /etc/profile
oe_setup_addon service.snapserver
config="pulseaudio.conf"
link="/storage/.config/pulse-daemon.conf.d/50-snapserver.conf"
mkdir -p "$(dirname $link)"
ln -sf "$ADDON_HOME/$config" "$link"
if [ ! -e "$ADDON_HOME/$config" ]; then
cp "$ADDON_DIR/config/$config" "$ADDON_HOME"
fi
file="/tmp/snapkodi"
sink_name="Snapserver"
if [ -z "$(pactl list short | grep $sink_name)" ]; then
pactl load-module module-pipe-sink \
file="$file" \
rate=48000 \
sink_name="$sink_name" \
sink_properties=device.description="$sink_name"
fi
case "$ss_st" in
Default)
stream="pipe:///tmp/snapfifo?name=Default"
;;
Kodi)
stream="pipe://$file?name=Kodi"
;;
Spotify)
stream="spotify:///librespot?name=Spotify&devicename=$ss_ln"
if [ "$ss_lp" != 0 ]; then
stream="$stream&params=--zeroconf-port%3D$ss_lp"
fi
;;
*)
stream="airplay:///shairport-sync?name=AirPlay"
;;
esac
if [ "$ss_eh" = "true" ] ; then
enable_http=1
else
enable_http=0
fi
nqptp &
HOME="$ADDON_HOME" \
nice -n "$ss_ni" \
snapserver \
--controlPort "$ss_cp" \
--port "$ss_sp" \
--http.enabled "$enable_http" \
--http.port "$ss_hp" \
--http.bind_to_address "$ss_ha" \
--http.doc_root="$ADDON_DIR/snapweb" \
--stream.stream "$stream" \
> /dev/null