[WIP] Added Artist/ReleaseInfo

This commit is contained in:
emeric
2019-01-23 13:22:43 +01:00
parent b76c60f437
commit 3e142b5507
77 changed files with 2706 additions and 716 deletions
+31
View File
@@ -0,0 +1,31 @@
/*
* Copyright (C) 2019 Emeric Poupon
*
* This file is part of LMS.
*
* LMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Services.hpp"
#include "cover/CoverArtGrabber.hpp"
#include "scanner/MediaScanner.hpp"
#include "similarity/SimilaritySearcher.hpp"
Services& getServices()
{
static Services services;
return services;
}
+44
View File
@@ -0,0 +1,44 @@
/*
* Copyright (C) 2019 Emeric Poupon
*
* This file is part of LMS.
*
* LMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
*/
#include <memory>
namespace CoverArt
{
class Grabber;
}
namespace Scanner {
class MediaScanner;
}
namespace Similarity {
class Searcher;
}
struct Services
{
std::unique_ptr<CoverArt::Grabber> coverArtGrabber;
std::unique_ptr<Scanner::MediaScanner> mediaScanner;
std::unique_ptr<Similarity::Searcher> similaritySearcher;
};
Services& getServices();
+20 -10
View File
@@ -23,15 +23,17 @@
#include <Wt/WServer.h>
#include <Wt/WApplication.h>
#include "utils/Config.hpp"
#include "utils/Logger.hpp"
#include "av/AvInfo.hpp"
#include "av/AvTranscoder.hpp"
#include "cover/CoverArtGrabber.hpp"
#include "image/Image.hpp"
#include "scanner/MediaScanner.hpp"
#include "similarity/som/SimilaritySOMScannerAddon.hpp"
#include "similarity/SimilaritySearcher.hpp"
#include "ui/LmsApplication.hpp"
#include "utils/Config.hpp"
#include "utils/Logger.hpp"
#include "Services.hpp"
std::vector<std::string> generateWtConfig(std::string execPath)
{
@@ -123,16 +125,24 @@ int main(int argc, char* argv[])
auto connectionPool = Database::Handler::createConnectionPool(Config::instance().getPath("working-dir") / "lms.db");
UserInterface::LmsApplicationGroupContainer appGroups;
Scanner::MediaScanner scanner(*connectionPool);
// Service initialization order is important
getServices().mediaScanner = std::make_unique<Scanner::MediaScanner>(*connectionPool);
Similarity::SOMScannerAddon similaritySOMScannerAddon(*connectionPool);
getServices().mediaScanner->setAddon(similaritySOMScannerAddon);
getServices().coverArtGrabber = std::make_unique<CoverArt::Grabber>();
getServices().similaritySearcher = std::make_unique<Similarity::Searcher>(similaritySOMScannerAddon);
// bind entry point
server.addEntryPoint(Wt::EntryPointType::Application,
std::bind(UserInterface::LmsApplication::create,
std::placeholders::_1, std::ref(*connectionPool), std::ref(appGroups), std::ref(scanner)));
std::placeholders::_1, std::ref(*connectionPool), std::ref(appGroups)));
// Start
LMS_LOG(MAIN, INFO) << "Starting Media scanner...";
scanner.start();
LMS_LOG(MAIN, INFO) << "Starting media scanner...";
getServices().mediaScanner->start();
LMS_LOG(MAIN, INFO) << "Starting server...";
server.start();
@@ -145,8 +155,8 @@ int main(int argc, char* argv[])
LMS_LOG(MAIN, INFO) << "Stopping server...";
server.stop();
LMS_LOG(MAIN, INFO) << "Stopping database updater...";
scanner.stop();
LMS_LOG(MAIN, INFO) << "Stopping media scanner...";
getServices().mediaScanner->stop();
LMS_LOG(MAIN, INFO) << "Clean stop!";
res = EXIT_SUCCESS;