[LmsAPI] Fix build
This commit is contained in:
@@ -77,8 +77,9 @@ ConfigReader::getUserInterfaceConfig(Service::UserInterfaceService::Config& conf
|
|||||||
config.dbPath = _config.lookup("main.database.path");
|
config.dbPath = _config.lookup("main.database.path");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined HAVE_LMSAPI
|
||||||
void
|
void
|
||||||
ConfigReader::getRemoteServerConfig(Service::RemoteServerService::Config& config)
|
ConfigReader::getLmsAPIConfig(Service::LmsAPIService::Config& config)
|
||||||
{
|
{
|
||||||
config.enable = _config.lookup("remote.enable");
|
config.enable = _config.lookup("remote.enable");
|
||||||
if (!config.enable)
|
if (!config.enable)
|
||||||
@@ -92,6 +93,7 @@ ConfigReader::getRemoteServerConfig(Service::RemoteServerService::Config& config
|
|||||||
|
|
||||||
config.dbPath = _config.lookup("main.database.path");
|
config.dbPath = _config.lookup("main.database.path");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
ConfigReader::getDatabaseUpdateConfig(Service::DatabaseUpdateService::Config& config)
|
ConfigReader::getDatabaseUpdateConfig(Service::DatabaseUpdateService::Config& config)
|
||||||
|
|||||||
@@ -23,12 +23,16 @@
|
|||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <libconfig.h++>
|
#include <libconfig.h++>
|
||||||
|
|
||||||
|
#include "config/config.h"
|
||||||
|
|
||||||
#include "cover/CoverArtGrabber.hpp"
|
#include "cover/CoverArtGrabber.hpp"
|
||||||
#include "logger/Logger.hpp"
|
#include "logger/Logger.hpp"
|
||||||
|
|
||||||
#include "service/UserInterfaceService.hpp"
|
#include "service/UserInterfaceService.hpp"
|
||||||
#include "service/LmsAPIServerService.hpp"
|
|
||||||
#include "service/DatabaseUpdateService.hpp"
|
#include "service/DatabaseUpdateService.hpp"
|
||||||
|
#if defined HAVE_LMSAPI
|
||||||
|
#include "service/LmsAPIServerService.hpp"
|
||||||
|
#endif
|
||||||
|
|
||||||
class ConfigReader
|
class ConfigReader
|
||||||
{
|
{
|
||||||
@@ -44,9 +48,12 @@ class ConfigReader
|
|||||||
|
|
||||||
// Service configurations
|
// Service configurations
|
||||||
void getUserInterfaceConfig(Service::UserInterfaceService::Config& config);
|
void getUserInterfaceConfig(Service::UserInterfaceService::Config& config);
|
||||||
void getRemoteServerConfig(Service::RemoteServerService::Config& config);
|
|
||||||
void getDatabaseUpdateConfig(Service::DatabaseUpdateService::Config& config);
|
void getDatabaseUpdateConfig(Service::DatabaseUpdateService::Config& config);
|
||||||
|
|
||||||
|
#if defined HAVE_LMSAPI
|
||||||
|
void getLmsAPIConfig(Service::LmsAPIService::Config& config);
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
libconfig::Config _config;
|
libconfig::Config _config;
|
||||||
|
|||||||
+8
-9
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
|
|
||||||
|
#include "config/config.h"
|
||||||
#include "logger/Logger.hpp"
|
#include "logger/Logger.hpp"
|
||||||
|
|
||||||
#include "config/ConfigReader.hpp"
|
#include "config/ConfigReader.hpp"
|
||||||
@@ -28,7 +29,9 @@
|
|||||||
#include "service/ServiceManager.hpp"
|
#include "service/ServiceManager.hpp"
|
||||||
#include "service/DatabaseUpdateService.hpp"
|
#include "service/DatabaseUpdateService.hpp"
|
||||||
#include "service/UserInterfaceService.hpp"
|
#include "service/UserInterfaceService.hpp"
|
||||||
|
#if defined HAVE_LMSAPI
|
||||||
#include "service/LmsAPIServerService.hpp"
|
#include "service/LmsAPIServerService.hpp"
|
||||||
|
#endif
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
@@ -81,9 +84,6 @@ int main(int argc, char* argv[])
|
|||||||
Service::UserInterfaceService::Config uiConfig;
|
Service::UserInterfaceService::Config uiConfig;
|
||||||
configReader.getUserInterfaceConfig(uiConfig);
|
configReader.getUserInterfaceConfig(uiConfig);
|
||||||
|
|
||||||
Service::RemoteServerService::Config remoteConfig;
|
|
||||||
configReader.getRemoteServerConfig(remoteConfig);
|
|
||||||
|
|
||||||
Service::ServiceManager& serviceManager = Service::ServiceManager::instance();
|
Service::ServiceManager& serviceManager = Service::ServiceManager::instance();
|
||||||
|
|
||||||
// lib init
|
// lib init
|
||||||
@@ -96,14 +96,13 @@ int main(int argc, char* argv[])
|
|||||||
if (dbUpdateConfig.enable)
|
if (dbUpdateConfig.enable)
|
||||||
serviceManager.startService( std::make_shared<Service::DatabaseUpdateService>( dbUpdateConfig ) );
|
serviceManager.startService( std::make_shared<Service::DatabaseUpdateService>( dbUpdateConfig ) );
|
||||||
|
|
||||||
if (remoteConfig.enable)
|
|
||||||
{
|
|
||||||
#if defined HAVE_LMSAPI
|
#if defined HAVE_LMSAPI
|
||||||
serviceManager.startService( std::make_shared<Service::RemoteServerService>( remoteConfig ));
|
Service::LmsAPIService::Config lmsAPIConfig;
|
||||||
#else
|
configReader.getLmsAPIConfig(lmsAPIConfig);
|
||||||
LMS_LOG(MOD_MAIN, SEV_ERROR) << "LMS API cannot be activated since it is not compiled";
|
|
||||||
|
if (lmsAPIConfig.enable)
|
||||||
|
serviceManager.startService( std::make_shared<Service::LmsAPIService>( lmsAPIConfig ));
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
if (uiConfig.enable)
|
if (uiConfig.enable)
|
||||||
serviceManager.startService( std::make_shared<Service::UserInterfaceService>(boost::filesystem::path(argv[0]), uiConfig));
|
serviceManager.startService( std::make_shared<Service::UserInterfaceService>(boost::filesystem::path(argv[0]), uiConfig));
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
namespace Service {
|
namespace Service {
|
||||||
|
|
||||||
RemoteServerService::RemoteServerService(const Config& config)
|
LmsAPIService::LmsAPIService(const Config& config)
|
||||||
: _server(boost::asio::ip::tcp::endpoint(config.address, config.port),
|
: _server(boost::asio::ip::tcp::endpoint(config.address, config.port),
|
||||||
config.sslCertificatePath,
|
config.sslCertificatePath,
|
||||||
config.sslPrivateKeyPath,
|
config.sslPrivateKeyPath,
|
||||||
@@ -33,26 +33,26 @@ RemoteServerService::RemoteServerService(const Config& config)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RemoteServerService::start(void)
|
LmsAPIService::start(void)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_SERVICE, SEV_DEBUG) << "RemoteServerService::start, starting...";
|
LMS_LOG(MOD_SERVICE, SEV_DEBUG) << "LmsAPIService::start, starting...";
|
||||||
_server.start();
|
_server.start();
|
||||||
LMS_LOG(MOD_SERVICE, SEV_DEBUG) << "RemoteServerService::start, started!";
|
LMS_LOG(MOD_SERVICE, SEV_DEBUG) << "LmsAPIService::start, started!";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
RemoteServerService::stop(void)
|
LmsAPIService::stop(void)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_SERVICE, SEV_DEBUG) << "RemoteServerService::stop, stopping...";
|
LMS_LOG(MOD_SERVICE, SEV_DEBUG) << "LmsAPIService::stop, stopping...";
|
||||||
_server.stop();
|
_server.stop();
|
||||||
LMS_LOG(MOD_SERVICE, SEV_DEBUG) << "RemoteServerService::stop, stopped!";
|
LMS_LOG(MOD_SERVICE, SEV_DEBUG) << "LmsAPIService::stop, stopped!";
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RemoteServerService::restart(void)
|
LmsAPIService::restart(void)
|
||||||
{
|
{
|
||||||
LMS_LOG(MOD_SERVICE, SEV_DEBUG) << "RemoteServerService::restart, not implemented!";
|
LMS_LOG(MOD_SERVICE, SEV_DEBUG) << "LmsAPIService::restart, not implemented!";
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service
|
} // namespace Service
|
||||||
|
|||||||
@@ -23,13 +23,15 @@
|
|||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <boost/asio/ip/address.hpp>
|
#include <boost/asio/ip/address.hpp>
|
||||||
|
|
||||||
|
#include "config/config.h"
|
||||||
|
|
||||||
#include "Service.hpp"
|
#include "Service.hpp"
|
||||||
|
|
||||||
#include "lms-api/server/Server.hpp"
|
#include "lms-api/server/Server.hpp"
|
||||||
|
|
||||||
namespace Service {
|
namespace Service {
|
||||||
|
|
||||||
class RemoteServerService : public Service
|
class LmsAPIService : public Service
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@@ -43,7 +45,7 @@ class RemoteServerService : public Service
|
|||||||
boost::filesystem::path dbPath;
|
boost::filesystem::path dbPath;
|
||||||
};
|
};
|
||||||
|
|
||||||
RemoteServerService(const Config& config);
|
LmsAPIService(const Config& config);
|
||||||
|
|
||||||
void start(void);
|
void start(void);
|
||||||
void stop(void);
|
void stop(void);
|
||||||
|
|||||||
+2
-2
@@ -26,8 +26,8 @@ BUILT_SOURCES = \
|
|||||||
|
|
||||||
remote_client_CXXFLAGS=-std=c++11 -Wall -Wextra -DBOOST_LOG_DYN_LINK -I$(top_srcdir)/src
|
remote_client_CXXFLAGS=-std=c++11 -Wall -Wextra -DBOOST_LOG_DYN_LINK -I$(top_srcdir)/src
|
||||||
|
|
||||||
%.pb.cc %.pb.h: $(top_srcdir)/src/remote/proto/%.proto
|
%.pb.cc %.pb.h: $(top_srcdir)/src/lms-api/proto/%.proto
|
||||||
$(PROTOC) --proto_path=$(top_srcdir)/src/remote/proto/ --cpp_out=$(builddir)/ $^
|
$(PROTOC) --proto_path=$(top_srcdir)/src/lms-api/proto/ --cpp_out=$(builddir)/ $^
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user