diff --git a/doc/player_setup.md b/doc/player_setup.md index d568d34f..35fd6f61 100644 --- a/doc/player_setup.md +++ b/doc/player_setup.md @@ -133,7 +133,7 @@ Snapserver supports [shairport-sync](https://github.com/mikebrady/shairport-sync ### Spotify Snapserver supports [librespot](https://github.com/plietar/librespot) with `pipe` backend. 1. Build and copy the `librespot` binary somewhere to your `PATH`, e.g. `/usr/local/bin/` - 2. Configure snapserver with `-s "spotify:///librespot?name=Spotify[&username=&password=][&devicename=Snapcast][&bitrate=320][&onstart=][&onstop=]"` + 2. Configure snapserver with `-s "spotify:///librespot?name=Spotify[&username=&password=][&devicename=Snapcast][&bitrate=320][&onstart=][&onstop=][&cache=]"` * Valid bitrates are 96, 160, 320 * `start command` and `stop command` are executed by Librespot at start/stop * For example: `onstart=/usr/bin/logger -t Snapcast Starting spotify...` diff --git a/server/streamreader/spotifyStream.cpp b/server/streamreader/spotifyStream.cpp index cc11edda..aa7dc3f3 100644 --- a/server/streamreader/spotifyStream.cpp +++ b/server/streamreader/spotifyStream.cpp @@ -35,6 +35,7 @@ SpotifyStream::SpotifyStream(PcmListener* pcmListener, const StreamUri& uri) : P string username = uri_.getQuery("username", ""); string password = uri_.getQuery("password", ""); + string cache = uri_.getQuery("cache", ""); string bitrate = uri_.getQuery("bitrate", "320"); string devicename = uri_.getQuery("devicename", "Snapcast"); string onstart = uri_.getQuery("onstart", ""); @@ -47,6 +48,8 @@ SpotifyStream::SpotifyStream(PcmListener* pcmListener, const StreamUri& uri) : P if (!username.empty() && !password.empty()) params_ += " --username \"" + username + "\" --password \"" + password + "\""; params_ += " --bitrate " + bitrate + " --backend pipe"; + if (!cache.empty()) + params_ += " --cache \"" + cache + "\""; if (!onstart.empty()) params_ += " --onstart \"" + onstart + "\""; if (!onstop.empty()) diff --git a/server/streamreader/spotifyStream.h b/server/streamreader/spotifyStream.h index 8bcf3a6b..a80bed4e 100644 --- a/server/streamreader/spotifyStream.h +++ b/server/streamreader/spotifyStream.h @@ -28,7 +28,7 @@ * Implements EncoderListener to get the encoded data. * Data is passed to the PcmListener * usage: - * snapserver -s "spotify:///librespot?name=Spotify&username=&password=[&devicename=Snapcast][&bitrate=320]" + * snapserver -s "spotify:///librespot?name=Spotify&username=&password=[&devicename=Snapcast][&bitrate=320][&cache=]" */ class SpotifyStream : public ProcessStream, WatchdogListener {