Add autoplay option for librespot

This commit is contained in:
badaix 2020-03-02 21:12:27 +01:00
parent bcf48a2b4e
commit 0256409189
2 changed files with 11 additions and 4 deletions

View file

@ -14,6 +14,9 @@
# default values are commented
# uncomment and edit to change them
# Settings can be overwritten on command line with:
# "--<section>.<name>=<value>", e.g. --server.threads=4
# General server settings #####################################################
#
@ -103,14 +106,15 @@
# parameters have the form "key=value", they are concatenated with an "&" character
# parameter "name" is mandatory for all streams, while codec, sampleformat and chunk_ms are optional
# and will override the default codec, sampleformat or chunk_ms settings
# Non blocking streams support the dryout_ms parameter: when no new data is read from the stream, send silence to the clients
# Available types are:
# pipe: pipe:///<path/to/pipe>?name=<name>
# librespot: librespot:///<path/to/librespot>?name=<name>[&username=<my username>&password=<my password>][&devicename=Snapcast][&bitrate=320][&wd_timeout=7800][&volume=100][&onevent=""][&nomalize=false]
# pipe: pipe:///<path/to/pipe>?name=<name>[&mode=create][&dryout_ms=2000], mode can be "create" or "read"
# librespot: librespot:///<path/to/librespot>?name=<name>[&dryout_ms=2000][&username=<my username>&password=<my password>][&devicename=Snapcast][&bitrate=320][&wd_timeout=7800][&volume=100][&onevent=""][&nomalize=false][&autoplay=false]
# note that you need to have the librespot binary on your machine
# sampleformat will be set to "44100:16:2"
# file: file:///<path/to/PCM/file>?name=<name>
# process: process:///<path/to/process>?name=<name>[&wd_timeout=0][&log_stderr=false][&params=<process arguments>]
# airplay: airplay:///<path/to/airplay>?name=<name>[&port=5000]
# process: process:///<path/to/process>?name=<name>[&dryout_ms=2000][&wd_timeout=0][&log_stderr=false][&params=<process arguments>]
# airplay: airplay:///<path/to/airplay>?name=<name>[&dryout_ms=2000][&port=5000]
# note that you need to have the airplay binary on your machine
# sampleformat will be set to "44100:16:2"
# tcp server: tcp://<listen IP, e.g. 127.0.0.1>:<port>?name=<name>[&mode=server]

View file

@ -44,6 +44,7 @@ LibrespotStream::LibrespotStream(PcmListener* pcmListener, boost::asio::io_conte
string devicename = uri_.getQuery("devicename", "Snapcast");
string onevent = uri_.getQuery("onevent", "");
bool normalize = (uri_.getQuery("normalize", "false") == "true");
bool autoplay = (uri_.getQuery("autoplay", "false") == "true");
killall_ = (uri_.getQuery("killall", "true") == "true");
if (username.empty() != password.empty())
@ -61,6 +62,8 @@ LibrespotStream::LibrespotStream(PcmListener* pcmListener, boost::asio::io_conte
params_ += " --onevent \"" + onevent + "\"";
if (normalize)
params_ += " --enable-volume-normalisation";
if (autoplay)
params_ += " --autoplay";
params_ += " --verbose";
if (uri_.query.find("username") != uri_.query.end())