Conditionally enable piggy; disabled by default.

This commit is contained in:
casey langen 2022-04-23 13:39:49 -07:00
parent fa2d95a9e6
commit 4ff25b19d2
5 changed files with 22 additions and 8 deletions

View File

@ -6,11 +6,13 @@
a list of actions for the current track/artist/album
* added the ability to use `libelogind` or `basu` instead of `libsystemd` for
the `mpris` plugin (@robertgzr)
* some warning cleanups when using wsprintw (@trofi)
* some warning cleanups when using `wsprintw` (@trofi)
* further improvements to build system to remove OS-specific conditionals in
favor of library detection
* added color output to various important cmake messages, making it much easier
to spot check configuration issues.
* added support for the `piggy` debug tool to help with log collection and
remote app monitoring. disabled by default.
--------------------------------------------------------------------------------

View File

@ -82,6 +82,8 @@ namespace musik { namespace core { namespace prefs {
const std::string keys::RemoteLibraryTranscoderBitrate = "RemoteLibraryTranscoderBitrate";
const std::string keys::RemoteLibraryIgnoreVersionMismatch = "RemoteLibraryIgnoreVersionMismatch";
const std::string keys::AsyncTrackListQueries = "AsyncTrackListQueries";
const std::string keys::PiggyEnabled = "PiggyEnabled";
const std::string keys::PiggyHostname = "PiggyHostname";
} } }

View File

@ -86,6 +86,8 @@ namespace musik { namespace core { namespace prefs {
extern const std::string RemoteLibraryTranscoderBitrate;
extern const std::string RemoteLibraryIgnoreVersionMismatch;
extern const std::string AsyncTrackListQueries;
extern const std::string PiggyEnabled;
extern const std::string PiggyHostname;
}
} } }

View File

@ -116,13 +116,21 @@ int main(int argc, char* argv[]) {
std::string errorFn = core::GetDataDirectory() + "stderr.txt";
freopen(errorFn.c_str(), "w", stderr);
auto piggyClient = std::make_shared<PiggyWebSocketClient>(&Window::MessageQueue());
piggyClient->Connect("localhost");
auto piggyLogger = new PiggyDebugBackend(piggyClient);
auto prefs = Preferences::ForComponent(core::prefs::components::Settings);
auto fileLogger = new debug::SimpleFileBackend();
auto consoleLogger = new ConsoleLogger(Window::MessageQueue());
debug::Start({ fileLogger, consoleLogger, piggyLogger });
std::vector<debug::IBackend*> debuggerBackends = {
new debug::SimpleFileBackend(), consoleLogger
};
if (prefs->GetBool(core::prefs::keys::PiggyEnabled, false)) {
auto piggyClient = std::make_shared<PiggyWebSocketClient>(&Window::MessageQueue());
piggyClient->Connect(prefs->GetString(core::prefs::keys::PiggyHostname, "localhost"));
debuggerBackends.push_back(new PiggyDebugBackend(piggyClient));
}
debug::Start(debuggerBackends);
plugin::Init();
@ -138,8 +146,6 @@ int main(int argc, char* argv[]) {
#endif
{
auto prefs = Preferences::ForComponent(core::prefs::components::Settings);
PlaybackService playback(Window::MessageQueue(), library);
GlobalHotkeys globalHotkeys(playback, library);

View File

@ -123,6 +123,8 @@ static inline std::shared_ptr<ISchema> AdvancedSettingsSchema() {
schema->AddInt(core::prefs::keys::IndexerTransactionInterval, 300);
schema->AddString(core::prefs::keys::AuddioApiToken, "");
schema->AddBool(core::prefs::keys::ResumePlaybackOnStartup, false);
schema->AddBool(core::prefs::keys::PiggyEnabled, false);
schema->AddString(core::prefs::keys::PiggyHostname, "localhost");
return schema;
}