Updated the Service interface
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
#include "database/Cluster.hpp"
|
||||
#include "database/Release.hpp"
|
||||
#include "explore/Explore.hpp"
|
||||
#include "main/Services.hpp"
|
||||
#include "main/Service.hpp"
|
||||
#include "utils/Logger.hpp"
|
||||
#include "utils/Utils.hpp"
|
||||
|
||||
@@ -459,7 +459,7 @@ LmsApplication::createHome()
|
||||
|
||||
// Events from MediaScanner
|
||||
std::string sessionId = LmsApp->sessionId();
|
||||
getServices().mediaScanner->scanComplete().connect([=] (Scanner::MediaScanner::Stats stats)
|
||||
getService<Scanner::MediaScanner>()->scanComplete().connect([=] (Scanner::MediaScanner::Stats stats)
|
||||
{
|
||||
// Runs from media scanner context
|
||||
Wt::WServer::instance()->post(sessionId, [=]
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <Wt/WText.h>
|
||||
|
||||
#include "database/TrackList.hpp"
|
||||
#include "main/Services.hpp"
|
||||
#include "main/Service.hpp"
|
||||
#include "similarity/SimilaritySearcher.hpp"
|
||||
#include "utils/Logger.hpp"
|
||||
#include "LmsApplication.hpp"
|
||||
@@ -399,7 +399,7 @@ PlayQueue::addRadioTrack()
|
||||
if (trackIds.empty())
|
||||
return;
|
||||
|
||||
auto res = getServices().similaritySearcher->getSimilarTracks(LmsApp->getDboSession(), std::set<Database::IdType>(trackIds.begin(), trackIds.end()), 1);
|
||||
auto res = getService<Similarity::Searcher>()->getSimilarTracks(LmsApp->getDboSession(), std::set<Database::IdType>(trackIds.begin(), trackIds.end()), 1);
|
||||
for (auto trackId : res)
|
||||
{
|
||||
auto trackToAdd = Database::Track::getById(LmsApp->getDboSession(), trackId);
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <Wt/WTemplateFormView.h>
|
||||
|
||||
#include "database/Cluster.hpp"
|
||||
#include "main/Services.hpp"
|
||||
#include "main/Service.hpp"
|
||||
#include "utils/Logger.hpp"
|
||||
#include "utils/Utils.hpp"
|
||||
|
||||
@@ -288,7 +288,7 @@ DatabaseSettingsView::refreshView()
|
||||
{
|
||||
model->saveData();
|
||||
|
||||
getServices().mediaScanner->reschedule();
|
||||
getService<Scanner::MediaScanner>()->reschedule();
|
||||
LmsApp->notifyMsg(MsgType::Success, Wt::WString::tr("Lms.Admin.Database.settings-saved"));
|
||||
}
|
||||
|
||||
@@ -305,7 +305,7 @@ DatabaseSettingsView::refreshView()
|
||||
|
||||
immScanBtn->clicked().connect([=] ()
|
||||
{
|
||||
getServices().mediaScanner->scheduleImmediateScan();
|
||||
getService<Scanner::MediaScanner>()->scheduleImmediateScan();
|
||||
LmsApp->notifyMsg(MsgType::Info, Wt::WString::tr("Lms.Admin.Database.scan-launched"));
|
||||
});
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "ArtistInfoView.hpp"
|
||||
|
||||
#include "database/Artist.hpp"
|
||||
#include "main/Services.hpp"
|
||||
#include "main/Service.hpp"
|
||||
#include "similarity/SimilaritySearcher.hpp"
|
||||
#include "utils/Utils.hpp"
|
||||
|
||||
@@ -63,7 +63,7 @@ ArtistInfo::refresh()
|
||||
if (!artistId)
|
||||
return;
|
||||
|
||||
auto artistsIds = getServices().similaritySearcher->getSimilarArtists(LmsApp->getDboSession(), *artistId, 5);
|
||||
auto artistsIds = getService<Similarity::Searcher>()->getSimilarArtists(LmsApp->getDboSession(), *artistId, 5);
|
||||
|
||||
Wt::Dbo::Transaction transaction(LmsApp->getDboSession());
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <Wt/WAnchor.h>
|
||||
|
||||
#include "database/Release.hpp"
|
||||
#include "main/Services.hpp"
|
||||
#include "main/Service.hpp"
|
||||
#include "similarity/SimilaritySearcher.hpp"
|
||||
#include "utils/Utils.hpp"
|
||||
|
||||
@@ -68,7 +68,7 @@ ReleaseInfo::refresh()
|
||||
if (!releaseId)
|
||||
return;
|
||||
|
||||
std::vector<Database::IdType> releasesIds {getServices().similaritySearcher->getSimilarReleases(LmsApp->getDboSession(), *releaseId, 5)};
|
||||
std::vector<Database::IdType> releasesIds {getService<Similarity::Searcher>()->getSimilarReleases(LmsApp->getDboSession(), *releaseId, 5)};
|
||||
|
||||
Wt::Dbo::Transaction transaction {LmsApp->getDboSession()};
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
#include "cover/CoverArtGrabber.hpp"
|
||||
#include "database/Track.hpp"
|
||||
#include "main/Services.hpp"
|
||||
#include "main/Service.hpp"
|
||||
#include "utils/Exception.hpp"
|
||||
#include "utils/Logger.hpp"
|
||||
#include "utils/Utils.hpp"
|
||||
@@ -80,7 +80,7 @@ ImageResource::handleRequest(const Wt::Http::Request& request, Wt::Http::Respons
|
||||
// transactions are not thread safe
|
||||
{
|
||||
Wt::WApplication::UpdateLock lock(LmsApp);
|
||||
cover = getServices().coverArtGrabber->getFromTrack(LmsApp->getDboSession(), *trackId, Image::Format::JPEG, *size);
|
||||
cover = getService<CoverArt::Grabber>()->getFromTrack(LmsApp->getDboSession(), *trackId, Image::Format::JPEG, *size);
|
||||
}
|
||||
}
|
||||
else if (releaseIdStr)
|
||||
@@ -92,7 +92,7 @@ ImageResource::handleRequest(const Wt::Http::Request& request, Wt::Http::Respons
|
||||
// transactions are not thread safe
|
||||
{
|
||||
Wt::WApplication::UpdateLock lock(LmsApp);
|
||||
cover = getServices().coverArtGrabber->getFromRelease(LmsApp->getDboSession(), *releaseId, Image::Format::JPEG, *size);
|
||||
cover = getService<CoverArt::Grabber>()->getFromRelease(LmsApp->getDboSession(), *releaseId, Image::Format::JPEG, *size);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user