WIP: adding service files, still not working
This commit is contained in:
+30
-37
@@ -1,53 +1,46 @@
|
||||
#include <boost/thread.hpp>
|
||||
|
||||
#include "LmsApplication.hpp"
|
||||
|
||||
#include "metadata/AvFormat.hpp"
|
||||
#include "metadata/Extractor.hpp"
|
||||
#include "database/Database.hpp"
|
||||
#include <memory>
|
||||
#include <Wt/WServer>
|
||||
|
||||
#include "transcode/AvConvTranscoder.hpp"
|
||||
|
||||
#include "av/Common.hpp"
|
||||
|
||||
Wt::WApplication *createApplication(const Wt::WEnvironment& env)
|
||||
{
|
||||
/*
|
||||
* You could read information from the environment to decide whether
|
||||
* the user has permission to start a new application
|
||||
*/
|
||||
return new LmsApplication(env);
|
||||
}
|
||||
#include "ServiceManager.hpp"
|
||||
#include "DatabaseRefreshService.hpp"
|
||||
#include "WebServerService.hpp"
|
||||
#include "RemoteServerService.hpp"
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
Av::AvInit();
|
||||
Transcode::AvConvTranscoder::init();
|
||||
int res = EXIT_FAILURE;
|
||||
|
||||
// std::locale::global(std::locale(""));
|
||||
MetaData::AvFormat metadataParser;
|
||||
// MetaData::Extractor metadataParser;
|
||||
try
|
||||
{
|
||||
ServiceManager serviceManager;
|
||||
|
||||
// Set up the long living database session
|
||||
Database database("test.db", metadataParser);
|
||||
// lib init
|
||||
Av::AvInit();
|
||||
Transcode::AvConvTranscoder::init();
|
||||
|
||||
// database.watchDirectory( WatchedDirectory("/storage/common/Media/Son", WatchedDirectory::Audio ));
|
||||
database.watchDirectory(WatchedDirectory("/storage/common/Media/Son/Metal", WatchedDirectory::Audio));
|
||||
// database.watchDirectory("/storage/common/Media/Son/Metal/Iced Earth/2004 - The Glorious Burden");
|
||||
// database.watchDirectory("/storage/common/Media/Son/Metal/System Of a Down");
|
||||
// database.watchDirectory("/storage/common/Media/Son/Metal/Leprous");
|
||||
// database.watchDirectory("/storage/common/Media/Son/Electro");
|
||||
// database.watchDirectory( WatchedDirectory("/storage/common/Media/Son/Electro", WatchedDirectory::Audio) );
|
||||
// database.watchDirectory("/storage/common/Media/Son/Metal/Lacuna Coil");
|
||||
database.watchDirectory( WatchedDirectory("/storage/common/Media/Video", WatchedDirectory::Video) );
|
||||
// database.watchDirectory( WatchedDirectory("/storage/common/Media/Video/Films", WatchedDirectory::Video) );
|
||||
// database.watchDirectory( WatchedDirectory("/storage/common/Media/Video/Series", WatchedDirectory::Video) );
|
||||
serviceManager.startService( std::make_shared<DatabaseRefreshService>( "test.db" ) );
|
||||
serviceManager.startService( std::make_shared<WebServerService>(argc, argv) );
|
||||
serviceManager.startService( std::make_shared<RemoteServerService>( Remote::Server::Server::endpoint_type() ) );
|
||||
|
||||
std::cout << "Starting refresh..." << std::endl;
|
||||
// boost::thread refreshThread(boost::bind(&Database::refresh, &database));
|
||||
serviceManager.run();
|
||||
|
||||
res = EXIT_SUCCESS;
|
||||
|
||||
return Wt::WRun(argc, argv, &createApplication);
|
||||
}
|
||||
catch( Wt::WServer::Exception& e)
|
||||
{
|
||||
std::cerr << "Caught WServer::Exception: " << e.what() << std::endl;
|
||||
|
||||
}
|
||||
catch( std::exception& e)
|
||||
{
|
||||
std::cerr << "Caught std::exception: " << e.what() << std::endl;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user