rename spotify to librespot

This commit is contained in:
badaix 2019-10-13 19:32:11 +02:00
parent 7fda592d13
commit 08a0def6c5
4 changed files with 12 additions and 12 deletions

View file

@ -297,7 +297,7 @@ void ControlSessionHttp::on_write(beast::error_code ec, std::size_t, bool close)
req_ = {}; req_ = {};
// Read another request // Read another request
http::async_read(socket_, buffer_, req_, [this, self = shared_from_this()](beast::error_code ec, std::size_t bytes) { on_read(ec, bytes); }); http::async_read(socket_, buffer_, req_, [ this, self = shared_from_this() ](beast::error_code ec, std::size_t bytes) { on_read(ec, bytes); });
} }

View file

@ -28,7 +28,7 @@ using namespace std;
SpotifyStream::SpotifyStream(PcmListener* pcmListener, const StreamUri& uri) : ProcessStream(pcmListener, uri) LibrespotStream::LibrespotStream(PcmListener* pcmListener, const StreamUri& uri) : ProcessStream(pcmListener, uri)
{ {
sampleFormat_ = SampleFormat("44100:16:2"); sampleFormat_ = SampleFormat("44100:16:2");
uri_.query["sampleformat"] = sampleFormat_.getFormat(); uri_.query["sampleformat"] = sampleFormat_.getFormat();
@ -63,10 +63,10 @@ SpotifyStream::SpotifyStream(PcmListener* pcmListener, const StreamUri& uri) : P
} }
SpotifyStream::~SpotifyStream() = default; LibrespotStream::~LibrespotStream() = default;
void SpotifyStream::initExeAndPath(const std::string& filename) void LibrespotStream::initExeAndPath(const std::string& filename)
{ {
path_ = ""; path_ = "";
exe_ = findExe(filename); exe_ = findExe(filename);
@ -88,7 +88,7 @@ void SpotifyStream::initExeAndPath(const std::string& filename)
} }
void SpotifyStream::onStderrMsg(const char* buffer, size_t n) void LibrespotStream::onStderrMsg(const char* buffer, size_t n)
{ {
static bool libreelec_patched = false; static bool libreelec_patched = false;
smatch m; smatch m;
@ -153,7 +153,7 @@ void SpotifyStream::onStderrMsg(const char* buffer, size_t n)
} }
void SpotifyStream::stderrReader() void LibrespotStream::stderrReader()
{ {
watchdog_.reset(new Watchdog(this)); watchdog_.reset(new Watchdog(this));
/// 130min /// 130min
@ -162,7 +162,7 @@ void SpotifyStream::stderrReader()
} }
void SpotifyStream::onTimeout(const Watchdog* /*watchdog*/, size_t ms) void LibrespotStream::onTimeout(const Watchdog* /*watchdog*/, size_t ms)
{ {
LOG(ERROR) << "Spotify timeout: " << ms / 1000 << "\n"; LOG(ERROR) << "Spotify timeout: " << ms / 1000 << "\n";
if (process_) if (process_)

View file

@ -31,12 +31,12 @@
* snapserver -s "spotify:///librespot?name=Spotify&username=<my username>&password=<my password>[&devicename=Snapcast][&bitrate=320][&volume=<volume in * snapserver -s "spotify:///librespot?name=Spotify&username=<my username>&password=<my password>[&devicename=Snapcast][&bitrate=320][&volume=<volume in
* percent>][&cache=<cache dir>]" * percent>][&cache=<cache dir>]"
*/ */
class SpotifyStream : public ProcessStream, WatchdogListener class LibrespotStream : public ProcessStream, WatchdogListener
{ {
public: public:
/// ctor. Encoded PCM data is passed to the PipeListener /// ctor. Encoded PCM data is passed to the PipeListener
SpotifyStream(PcmListener* pcmListener, const StreamUri& uri); LibrespotStream(PcmListener* pcmListener, const StreamUri& uri);
~SpotifyStream() override; ~LibrespotStream() override;
protected: protected:
std::unique_ptr<Watchdog> watchdog_; std::unique_ptr<Watchdog> watchdog_;

View file

@ -69,9 +69,9 @@ PcmStreamPtr StreamManager::addStream(const std::string& uri)
{ {
stream = make_shared<ProcessStream>(pcmListener_, streamUri); stream = make_shared<ProcessStream>(pcmListener_, streamUri);
} }
else if (streamUri.scheme == "spotify") else if ((streamUri.scheme == "spotify") || (streamUri.scheme == "librespot"))
{ {
stream = make_shared<SpotifyStream>(pcmListener_, streamUri); stream = make_shared<LibrespotStream>(pcmListener_, streamUri);
} }
else if (streamUri.scheme == "airplay") else if (streamUri.scheme == "airplay")
{ {