Add &params= option to librespot to support other librespot parameters.

This commit is contained in:
Alexandre Macabies 2020-09-01 02:34:16 +02:00 committed by badaix
parent 469bfeb1f8
commit 57c0c5262a
2 changed files with 3 additions and 2 deletions

View file

@ -38,7 +38,7 @@ pipe:///<path/to/pipe>?name=<name>[&mode=create][&dryout_ms=2000]
Launches librespot and reads audio from stdout Launches librespot and reads audio from stdout
```sh ```sh
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=""][&normalize=false][&autoplay=false][&cache=""][&disable_audio_cache=false][&killall=true] 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=""][&normalize=false][&autoplay=false][&cache=""][&disable_audio_cache=false][&killall=true][&params=extra-params]
``` ```
Note that you need to have the librespot binary on your machine and the sampleformat will be set to `44100:16:2` Note that you need to have the librespot binary on your machine and the sampleformat will be set to `44100:16:2`
@ -57,6 +57,7 @@ Parameters used to configure the librespot binary ([see librespot-org options](h
- `autoplay`: Autoplay similar songs when your music ends - `autoplay`: Autoplay similar songs when your music ends
- `cache`: Path to a directory where files will be cached - `cache`: Path to a directory where files will be cached
- `disable_audio_cache`: Disable caching of the audio data - `disable_audio_cache`: Disable caching of the audio data
- `params`: Optional string appended to the librespot invocation. This allows for arbitrary flags to be passed to librespot, for instance `params=--device-type%20avr`. The value has to be properly URL-encoded.
Parameters introduced by Snapclient: Parameters introduced by Snapclient:

View file

@ -51,7 +51,7 @@ LibrespotStream::LibrespotStream(PcmListener* pcmListener, boost::asio::io_conte
if (username.empty() != password.empty()) if (username.empty() != password.empty())
throw SnapException("missing parameter \"username\" or \"password\" (must provide both, or neither)"); throw SnapException("missing parameter \"username\" or \"password\" (must provide both, or neither)");
params_ = "--name \"" + devicename + "\""; params_ += "--name \"" + devicename + "\"";
if (!username.empty() && !password.empty()) if (!username.empty() && !password.empty())
params_ += " --username \"" + username + "\" --password \"" + password + "\""; params_ += " --username \"" + username + "\" --password \"" + password + "\"";
params_ += " --bitrate " + bitrate + " --backend pipe"; params_ += " --bitrate " + bitrate + " --backend pipe";