From 97a630ce7f203e0d6af438746d2b597988975ad7 Mon Sep 17 00:00:00 2001 From: emeric Date: Fri, 18 May 2018 13:50:05 +0200 Subject: [PATCH] Split Cluster and Track in order to reduce compile dependencies --- src/Makefile.am | 1 + src/database/Cluster.cpp | 126 +++++++++++++++ src/database/Cluster.hpp | 115 ++++++++++++++ src/database/DatabaseHandler.cpp | 1 + src/database/DbArtist.cpp | 1 + src/database/DbArtist.hpp | 1 - src/database/MediaDirectory.hpp | 1 - src/database/Release.cpp | 1 + src/database/Track.cpp | 101 +----------- src/database/Track.hpp | 84 +--------- src/scanner/MediaScanner.cpp | 212 +++++++++++++------------- src/scanner/MediaScanner.hpp | 19 --- src/ui/LmsApplication.hpp | 6 +- src/ui/MediaPlayer.cpp | 3 + src/ui/explore/ExploreUtils.hpp | 2 +- src/ui/explore/ReleaseView.cpp | 1 + src/ui/resource/ImageResource.cpp | 2 + src/ui/resource/TranscodeResource.cpp | 2 + 18 files changed, 369 insertions(+), 310 deletions(-) create mode 100644 src/database/Cluster.cpp create mode 100644 src/database/Cluster.hpp diff --git a/src/Makefile.am b/src/Makefile.am index 8d0239b2..1866457c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -5,6 +5,7 @@ lms_SOURCES = \ $(srcdir)/av/AvInfo.cpp \ $(srcdir)/av/AvTranscoder.cpp \ $(srcdir)/cover/CoverArtGrabber.cpp \ + $(srcdir)/database/Cluster.cpp \ $(srcdir)/database/DbArtist.cpp \ $(srcdir)/database/DatabaseHandler.cpp \ $(srcdir)/database/MediaDirectory.cpp \ diff --git a/src/database/Cluster.cpp b/src/database/Cluster.cpp new file mode 100644 index 00000000..b32ac64d --- /dev/null +++ b/src/database/Cluster.cpp @@ -0,0 +1,126 @@ +/* + * Copyright (C) 2013-2016 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 . + */ + +#include "Cluster.hpp" + +#include "DbArtist.hpp" +#include "Release.hpp" +#include "SqlQuery.hpp" +#include "Track.hpp" + +namespace Database { + +Cluster::Cluster() +{ +} + +Cluster::Cluster(Wt::Dbo::ptr type, std::string name) + : _name(std::string(name, 0, _maxNameLength)), + _clusterType(type) +{ +} + +Cluster::pointer +Cluster::create(Wt::Dbo::Session& session, Wt::Dbo::ptr type, std::string name) +{ + return session.add(std::make_unique(type, name)); +} + +std::vector +Cluster::getAll(Wt::Dbo::Session& session) +{ + Wt::Dbo::collection res = session.find(); + + return std::vector(res.begin(), res.end()); +} + +Cluster::pointer +Cluster::getById(Wt::Dbo::Session& session, IdType id) +{ + return session.find().where("id = ?").bind(id); +} + +ClusterType::ClusterType(std::string name) + : _name(name) +{ +} + +std::vector +ClusterType::getAllOrphans(Wt::Dbo::Session& session) +{ + Wt::Dbo::collection res = session.query>("select c_t from cluster_type c_t LEFT OUTER JOIN cluster c ON c_t.id = c.cluster_type_id WHERE c.id IS NULL"); + + return std::vector(res.begin(), res.end()); +} + + +ClusterType::pointer +ClusterType::getByName(Wt::Dbo::Session& session, std::string name) +{ + return session.find().where("name = ?").bind(name); +} + +std::vector +ClusterType::getAll(Wt::Dbo::Session& session) +{ + Wt::Dbo::collection res = session.find(); + + return std::vector(res.begin(), res.end()); +} + +ClusterType::pointer +ClusterType::create(Wt::Dbo::Session& session, std::string name) +{ + return session.add(std::make_unique(name)); +} + +Cluster::pointer +ClusterType::getCluster(std::string name) const +{ + assert(self()); + assert(IdIsValid(self()->id())); + assert(session()); + + return session()->find() + .where("name = ?").bind(name) + .where("cluster_type_id = ?").bind(self()->id()); +} + +std::vector +ClusterType::getClusters() const +{ + assert(self()); + assert(IdIsValid(self()->id())); + assert(session()); + + Wt::Dbo::collection res = session()->find() + .where("cluster_type_id = ?").bind(self()->id()) + .orderBy("name"); + + return std::vector(res.begin(), res.end()); +} + +void +Cluster::addTrack(Wt::Dbo::ptr track) +{ + _tracks.insert(track); +} + +} // namespace Database + diff --git a/src/database/Cluster.hpp b/src/database/Cluster.hpp new file mode 100644 index 00000000..65abf978 --- /dev/null +++ b/src/database/Cluster.hpp @@ -0,0 +1,115 @@ +/* + * Copyright (C) 2018 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 . + */ + +#pragma once + +#include +#include + +#include + +#include + +#include "Types.hpp" + +namespace Database { + +class Track; +class ClusterType; + +class Cluster : public Wt::Dbo::Dbo +{ + public: + typedef Wt::Dbo::ptr pointer; + + Cluster(); + Cluster(Wt::Dbo::ptr type, std::string name); + + // Find utility + static std::vector getAll(Wt::Dbo::Session& session); + static pointer getById(Wt::Dbo::Session& session, IdType id); + + // Create utility + static pointer create(Wt::Dbo::Session& session, Wt::Dbo::ptr type, std::string name); + + // Accessors + const std::string& getName(void) const { return _name; } + Wt::Dbo::ptr getType() const { return _clusterType; } + const Wt::Dbo::collection>& getTracks() const { return _tracks; } + + void addTrack(Wt::Dbo::ptr track); + + template + void persist(Action& a) + { + Wt::Dbo::field(a, _name, "name"); + + Wt::Dbo::belongsTo(a, _clusterType, "cluster_type", Wt::Dbo::OnDeleteCascade); + Wt::Dbo::hasMany(a, _tracks, Wt::Dbo::ManyToMany, "track_cluster", "", Wt::Dbo::OnDeleteCascade); + } + + private: + + static const std::size_t _maxNameLength = 128; + + std::string _name; + + Wt::Dbo::ptr _clusterType; + Wt::Dbo::collection< Wt::Dbo::ptr > _tracks; +}; + + +class ClusterType : public Wt::Dbo::Dbo +{ + public: + + using pointer = Wt::Dbo::ptr; + + ClusterType() {} + ClusterType(std::string name); + + static std::vector getAllOrphans(Wt::Dbo::Session& session); + static pointer getByName(Wt::Dbo::Session& session, std::string name); + static std::vector getAll(Wt::Dbo::Session& session); + + static pointer create(Wt::Dbo::Session& session, std::string name); + static void remove(Wt::Dbo::Session& session, std::string name); + + // Accessors + const std::string& getName(void) const { return _name; } + std::vector getClusters() const; + Cluster::pointer getCluster(std::string name) const; + + template + void persist(Action& a) + { + Wt::Dbo::field(a, _name, "name"); + Wt::Dbo::hasMany(a, _clusters, Wt::Dbo::ManyToOne, "cluster_type"); + } + + private: + + static const std::size_t _maxNameLength = 128; + + std::string _name; + Wt::Dbo::collection< Wt::Dbo::ptr > _clusters; +}; + +} // namespace Database + diff --git a/src/database/DatabaseHandler.cpp b/src/database/DatabaseHandler.cpp index f6ed9e6b..2f34c468 100644 --- a/src/database/DatabaseHandler.cpp +++ b/src/database/DatabaseHandler.cpp @@ -36,6 +36,7 @@ #include "utils/Logger.hpp" #include "DbArtist.hpp" +#include "Cluster.hpp" #include "MediaDirectory.hpp" #include "Playlist.hpp" #include "Release.hpp" diff --git a/src/database/DbArtist.cpp b/src/database/DbArtist.cpp index 87d90567..f3aa714d 100644 --- a/src/database/DbArtist.cpp +++ b/src/database/DbArtist.cpp @@ -20,6 +20,7 @@ #include "utils/Logger.hpp" +#include "Cluster.hpp" #include "Release.hpp" #include "SqlQuery.hpp" #include "Track.hpp" diff --git a/src/database/DbArtist.hpp b/src/database/DbArtist.hpp index 9ff9c673..1c814a0d 100644 --- a/src/database/DbArtist.hpp +++ b/src/database/DbArtist.hpp @@ -23,7 +23,6 @@ #include #include -#include #include "Types.hpp" diff --git a/src/database/MediaDirectory.hpp b/src/database/MediaDirectory.hpp index 7b640967..84201b1d 100644 --- a/src/database/MediaDirectory.hpp +++ b/src/database/MediaDirectory.hpp @@ -24,7 +24,6 @@ #include #include -#include namespace Database { diff --git a/src/database/Release.cpp b/src/database/Release.cpp index c5f610e9..5088f040 100644 --- a/src/database/Release.cpp +++ b/src/database/Release.cpp @@ -19,6 +19,7 @@ #include "Release.hpp" +#include "Cluster.hpp" #include "DbArtist.hpp" #include "SqlQuery.hpp" #include "Track.hpp" diff --git a/src/database/Track.cpp b/src/database/Track.cpp index aeedf327..1e509f7e 100644 --- a/src/database/Track.cpp +++ b/src/database/Track.cpp @@ -19,8 +19,11 @@ #include "Track.hpp" +#include + #include "utils/Logger.hpp" +#include "Cluster.hpp" #include "DbArtist.hpp" #include "Release.hpp" #include "SqlQuery.hpp" @@ -93,7 +96,7 @@ Track::getChecksumDuplicates(Wt::Dbo::Session& session) return std::vector(res.begin(), res.end()); } -std::vector< Cluster::pointer > +std::vector Track::getClusters(void) const { std::vector< Cluster::pointer > clusters; @@ -254,101 +257,5 @@ Track::getClusterGroups(std::vector clusterTypes, std::siz return res; } -Cluster::Cluster() -{ -} - -Cluster::Cluster(Wt::Dbo::ptr type, std::string name) - : _name(std::string(name, 0, _maxNameLength)), - _clusterType(type) -{ -} - -Cluster::pointer -Cluster::create(Wt::Dbo::Session& session, Wt::Dbo::ptr type, std::string name) -{ - return session.add(std::make_unique(type, name)); -} - -std::vector -Cluster::getAll(Wt::Dbo::Session& session) -{ - Wt::Dbo::collection res = session.find(); - - return std::vector(res.begin(), res.end()); -} - -Cluster::pointer -Cluster::getById(Wt::Dbo::Session& session, IdType id) -{ - return session.find().where("id = ?").bind(id); -} - -ClusterType::ClusterType(std::string name) - : _name(name) -{ -} - -std::vector -ClusterType::getAllOrphans(Wt::Dbo::Session& session) -{ - Wt::Dbo::collection res = session.query>("select c_t from cluster_type c_t LEFT OUTER JOIN cluster c ON c_t.id = c.cluster_type_id WHERE c.id IS NULL"); - - return std::vector(res.begin(), res.end()); -} - - -ClusterType::pointer -ClusterType::getByName(Wt::Dbo::Session& session, std::string name) -{ - return session.find().where("name = ?").bind(name); -} - -std::vector -ClusterType::getAll(Wt::Dbo::Session& session) -{ - Wt::Dbo::collection res = session.find(); - - return std::vector(res.begin(), res.end()); -} - -ClusterType::pointer -ClusterType::create(Wt::Dbo::Session& session, std::string name) -{ - return session.add(std::make_unique(name)); -} - -Cluster::pointer -ClusterType::getCluster(std::string name) const -{ - assert(self()); - assert(IdIsValid(self()->id())); - assert(session()); - - return session()->find() - .where("name = ?").bind(name) - .where("cluster_type_id = ?").bind(self()->id()); -} - -std::vector -ClusterType::getClusters() const -{ - assert(self()); - assert(IdIsValid(self()->id())); - assert(session()); - - Wt::Dbo::collection res = session()->find() - .where("cluster_type_id = ?").bind(self()->id()) - .orderBy("name"); - - return std::vector(res.begin(), res.end()); -} - -void -Cluster::addTrack(Wt::Dbo::ptr track) -{ - _tracks.insert(track); -} - } // namespace Database diff --git a/src/database/Track.hpp b/src/database/Track.hpp index c367fc98..cb619296 100644 --- a/src/database/Track.hpp +++ b/src/database/Track.hpp @@ -27,7 +27,6 @@ #include #include -#include #include @@ -35,91 +34,12 @@ namespace Database { - class Artist; class Release; -class Track; class PlaylistEntry; +class Cluster; class ClusterType; -class Cluster : public Wt::Dbo::Dbo -{ - public: - typedef Wt::Dbo::ptr pointer; - - Cluster(); - Cluster(Wt::Dbo::ptr type, std::string name); - - // Find utility - static std::vector getAll(Wt::Dbo::Session& session); - static pointer getById(Wt::Dbo::Session& session, IdType id); - - // Create utility - static pointer create(Wt::Dbo::Session& session, Wt::Dbo::ptr type, std::string name); - - // Accessors - const std::string& getName(void) const { return _name; } - Wt::Dbo::ptr getType() const { return _clusterType; } - const Wt::Dbo::collection>& getTracks() const { return _tracks; } - - void addTrack(Wt::Dbo::ptr track); - - template - void persist(Action& a) - { - Wt::Dbo::field(a, _name, "name"); - - Wt::Dbo::belongsTo(a, _clusterType, "cluster_type", Wt::Dbo::OnDeleteCascade); - Wt::Dbo::hasMany(a, _tracks, Wt::Dbo::ManyToMany, "track_cluster", "", Wt::Dbo::OnDeleteCascade); - } - - private: - - static const std::size_t _maxNameLength = 128; - - std::string _name; - - Wt::Dbo::ptr _clusterType; - Wt::Dbo::collection< Wt::Dbo::ptr > _tracks; -}; - - -class ClusterType : public Wt::Dbo::Dbo -{ - public: - - using pointer = Wt::Dbo::ptr; - - ClusterType() {} - ClusterType(std::string name); - - static std::vector getAllOrphans(Wt::Dbo::Session& session); - static pointer getByName(Wt::Dbo::Session& session, std::string name); - static std::vector getAll(Wt::Dbo::Session& session); - - static pointer create(Wt::Dbo::Session& session, std::string name); - static void remove(Wt::Dbo::Session& session, std::string name); - - // Accessors - const std::string& getName(void) const { return _name; } - std::vector getClusters() const; - Cluster::pointer getCluster(std::string name) const; - - template - void persist(Action& a) - { - Wt::Dbo::field(a, _name, "name"); - Wt::Dbo::hasMany(a, _clusters, Wt::Dbo::ManyToOne, "cluster_type"); - } - - private: - - static const std::size_t _maxNameLength = 128; - - std::string _name; - Wt::Dbo::collection< Wt::Dbo::ptr > _clusters; -}; - class Track : public Wt::Dbo::Dbo { public: @@ -194,7 +114,7 @@ class Track : public Wt::Dbo::Dbo const std::string& getMBID(void) const { return _MBID; } Wt::Dbo::ptr getArtist(void) const { return _artist; } Wt::Dbo::ptr getRelease(void) const { return _release; } - std::vector< Cluster::pointer > getClusters(void) const; + std::vector> getClusters(void) const; std::vector>> getClusterGroups(std::vector> clusterTypes, std::size_t size) const; diff --git a/src/scanner/MediaScanner.cpp b/src/scanner/MediaScanner.cpp index 7b05e795..1235c89e 100644 --- a/src/scanner/MediaScanner.cpp +++ b/src/scanner/MediaScanner.cpp @@ -28,6 +28,7 @@ #include "cover/CoverArtGrabber.hpp" +#include "database/Cluster.hpp" #include "database/DbArtist.hpp" #include "database/Release.hpp" #include "database/MediaDirectory.hpp" @@ -38,6 +39,8 @@ #include "utils/Path.hpp" #include "utils/Utils.hpp" +using namespace Database; + namespace { const std::string updatePeriodSetting = "update_period"; @@ -114,13 +117,108 @@ isPathInParentPath(const boost::filesystem::path& path, const boost::filesystem: return false; } +Artist::pointer +getArtist(Wt::Dbo::Session& session, const std::string& name, const std::string& mbid) +{ + Artist::pointer artist; + + // First try to get by MBID + if (!mbid.empty()) + { + artist = Artist::getByMBID(session, mbid); + if (!artist) + artist = Artist::create(session, name, mbid); + + return artist; + } + + // Fall back on artist name (collisions may occur) + if (!name.empty()) + { + for (Artist::pointer sameNamedArtist : Artist::getByName(session, name)) + { + if (sameNamedArtist->getMBID().empty()) + { + artist = sameNamedArtist; + break; + } + } + + // No Artist found with the same name and without MBID -> creating + if (!artist) + artist = Artist::create(session, name); + + return artist; + } + + return Artist::pointer(); +} + +Release::pointer +getRelease(Wt::Dbo::Session& session, const std::string& name, const std::string& mbid) +{ + Release::pointer release; + + // First try to get by MBID + if (!mbid.empty()) + { + release = Release::getByMBID(session, mbid ); + if (!release) + release = Release::create(session, name, mbid); + + return release; + } + + // Fall back on release name (collisions may occur) + if (!name.empty()) + { + for (Release::pointer sameNamedRelease : Release::getByName(session, name)) + { + if (sameNamedRelease->getMBID().empty()) + { + release = sameNamedRelease; + break; + } + } + + // No release found with the same name and without MBID -> creating + if (!release) + release = Release::create(session, name); + + return release; + } + + return Release::pointer(); +} + +std::vector +getClusters(Wt::Dbo::Session& session, const MetaData::Clusters& clustersNames) +{ + std::vector< Cluster::pointer > clusters; + + for (auto clusterNames : clustersNames) + { + auto clusterType = ClusterType::getByName(session, clusterNames.first); + if (!clusterType) + continue; + + for (auto clusterName : clusterNames.second) + { + auto cluster = clusterType->getCluster(clusterName); + if (!cluster) + cluster = Cluster::create(session, clusterType, clusterName); + + clusters.push_back(cluster); + } + } + + return clusters; +} + } // namespace - namespace Scanner { -using namespace Database; - UpdatePeriod getUpdatePeriod(Wt::Dbo::Session& session) { @@ -345,104 +443,6 @@ MediaScanner::refreshScanSettings() _metadataParser.updateClusterTypes(getClusterTypes(_db.getSession())); } -Artist::pointer -MediaScanner::getArtist( const boost::filesystem::path& file, const std::string& name, const std::string& mbid) -{ - Artist::pointer artist; - - // First try to get by MBID - if (!mbid.empty()) - { - artist = Artist::getByMBID( _db.getSession(), mbid ); - if (!artist) - artist = Artist::create( _db.getSession(), name, mbid); - - return artist; - } - - // Fall back on artist name (collisions may occur) - if (!name.empty()) - { - for (Artist::pointer sameNamedArtist : Artist::getByName( _db.getSession(), name )) - { - if (sameNamedArtist->getMBID().empty()) - { - artist = sameNamedArtist; - break; - } - } - - // No Artist found with the same name and without MBID -> creating - if (!artist) - artist = Artist::create( _db.getSession(), name); - - return artist; - } - - return Artist::pointer(); -} - -Release::pointer -MediaScanner::getRelease( const boost::filesystem::path& file, const std::string& name, const std::string& mbid) -{ - Release::pointer release; - - // First try to get by MBID - if (!mbid.empty()) - { - release = Release::getByMBID( _db.getSession(), mbid ); - if (!release) - release = Release::create( _db.getSession(), name, mbid); - - return release; - } - - // Fall back on release name (collisions may occur) - if (!name.empty()) - { - for (Release::pointer sameNamedRelease : Release::getByName( _db.getSession(), name )) - { - if (sameNamedRelease->getMBID().empty()) - { - release = sameNamedRelease; - break; - } - } - - // No release found with the same name and without MBID -> creating - if (!release) - release = Release::create( _db.getSession(), name); - - return release; - } - - return Release::pointer(); -} - -std::vector -MediaScanner::getClusters( const MetaData::Clusters& clustersNames) -{ - std::vector< Cluster::pointer > clusters; - - for (auto clusterNames : clustersNames) - { - auto clusterType = ClusterType::getByName(_db.getSession(), clusterNames.first); - if (!clusterType) - continue; - - for (auto clusterName : clusterNames.second) - { - auto cluster = clusterType->getCluster(clusterName); - if (!cluster) - cluster = Cluster::create(_db.getSession(), clusterType, clusterName); - - clusters.push_back(cluster); - } - } - - return clusters; -} - void MediaScanner::scanAudioFile(const boost::filesystem::path& file, bool forceScan, Stats& stats) { @@ -535,8 +535,7 @@ MediaScanner::scanAudioFile(const boost::filesystem::path& file, bool forceScan, clusterNames = boost::any_cast ((*items)[MetaData::Type::Clusters]); } - // TODO rename - genres = getClusters( clusterNames ); + genres = getClusters(_db.getSession(), clusterNames); } // ***** Artist @@ -551,7 +550,7 @@ MediaScanner::scanAudioFile(const boost::filesystem::path& file, bool forceScan, if ((*items).find(MetaData::Type::Artist) != (*items).end()) artistName = boost::any_cast((*items)[MetaData::Type::Artist]); - artist = getArtist(file, artistName, artistMusicBrainzID); + artist = getArtist(_db.getSession(), artistName, artistMusicBrainzID); } // ***** Release @@ -566,7 +565,7 @@ MediaScanner::scanAudioFile(const boost::filesystem::path& file, bool forceScan, if ((*items).find(MetaData::Type::Album) != (*items).end()) releaseName = boost::any_cast((*items)[MetaData::Type::Album]); - release = getRelease(file, releaseName, releaseMusicBrainzID); + release = getRelease(_db.getSession(), releaseName, releaseMusicBrainzID); } // If file already exist, update data @@ -650,9 +649,6 @@ MediaScanner::scanAudioFile(const boost::filesystem::path& file, bool forceScan, track.modify()->setCoverType( hasCover ? Track::CoverType::Embedded : Track::CoverType::None ); } - // TODO check added/modified - _sigAddedTrack.emit(track); - transaction.commit(); } diff --git a/src/scanner/MediaScanner.hpp b/src/scanner/MediaScanner.hpp index cedf2922..a18d0153 100644 --- a/src/scanner/MediaScanner.hpp +++ b/src/scanner/MediaScanner.hpp @@ -29,9 +29,6 @@ #include "metadata/TagLibParser.hpp" #include "database/DatabaseHandler.hpp" -#include "database/Track.hpp" -#include "database/DbArtist.hpp" -#include "database/Release.hpp" namespace Scanner { @@ -83,16 +80,6 @@ class MediaScanner std::size_t nbDuplicates() const { return duplicateHashes + duplicateMBID; } }; - - // Called just after track addition - Wt::Signal& addedTrack() { return _sigAddedTrack; } - - // Called just before track removal - Wt::Signal& removedTrack() { return _sigRemovedTrack; } - - // Called just after track modification - Wt::Signal& modifiedTrack() { return _sigModifiedTrack; } - // Called just after scan complete Wt::Signal& scanComplete() { return _sigScanComplete; } @@ -109,9 +96,6 @@ class MediaScanner void scanRootDirectory( boost::filesystem::path rootDirectory, bool forceScan, Stats& stats); // Helpers - Database::Artist::pointer getArtist( const boost::filesystem::path& file, const std::string& name, const std::string& MBID); - Database::Release::pointer getRelease( const boost::filesystem::path& file, const std::string& name, const std::string& MBID); - std::vector getClusters( const MetaData::Clusters& names); void refreshScanSettings(); void checkAudioFiles( Stats& stats ); @@ -123,9 +107,6 @@ class MediaScanner Wt::WIOService _ioService; Wt::Signal _sigScanComplete; - Wt::Signal _sigModifiedTrack; - Wt::Signal _sigAddedTrack; - Wt::Signal _sigRemovedTrack; boost::asio::system_timer _scheduleTimer; diff --git a/src/ui/LmsApplication.hpp b/src/ui/LmsApplication.hpp index e9499347..5de87a0e 100644 --- a/src/ui/LmsApplication.hpp +++ b/src/ui/LmsApplication.hpp @@ -26,6 +26,10 @@ #include "database/DatabaseHandler.hpp" #include "scanner/MediaScanner.hpp" +#include "database/Cluster.hpp" +#include "database/DbArtist.hpp" +#include "database/Release.hpp" + #include "Auth.hpp" namespace UserInterface { @@ -60,7 +64,7 @@ class LmsApplication : public Wt::WApplication static std::unique_ptr createArtistAnchor(Database::Artist::pointer artist, bool addText = true); static std::unique_ptr createReleaseAnchor(Database::Release::pointer release, bool addText = true); - static std::unique_ptr createCluster(Database::Cluster::pointer cluster, bool canDelete= false); + static std::unique_ptr createCluster(Database::Cluster::pointer cluster, bool canDelete = false); private: diff --git a/src/ui/MediaPlayer.cpp b/src/ui/MediaPlayer.cpp index 3c001c01..961d33d2 100644 --- a/src/ui/MediaPlayer.cpp +++ b/src/ui/MediaPlayer.cpp @@ -24,6 +24,9 @@ #include "av/AvInfo.hpp" #include "utils/Logger.hpp" +#include "database/Track.hpp" + + #include "resource/ImageResource.hpp" #include "resource/TranscodeResource.hpp" diff --git a/src/ui/explore/ExploreUtils.hpp b/src/ui/explore/ExploreUtils.hpp index a46a2be9..f805a480 100644 --- a/src/ui/explore/ExploreUtils.hpp +++ b/src/ui/explore/ExploreUtils.hpp @@ -18,7 +18,7 @@ * along with LMS. If not, see . */ -#include "database/Track.hpp" +#include "database/Cluster.hpp" namespace UserInterface { diff --git a/src/ui/explore/ReleaseView.cpp b/src/ui/explore/ReleaseView.cpp index 079d9ecb..8efc7560 100644 --- a/src/ui/explore/ReleaseView.cpp +++ b/src/ui/explore/ReleaseView.cpp @@ -27,6 +27,7 @@ #include "database/Release.hpp" #include "database/Setting.hpp" +#include "database/Track.hpp" #include "utils/Logger.hpp" #include "utils/Utils.hpp" diff --git a/src/ui/resource/ImageResource.cpp b/src/ui/resource/ImageResource.cpp index 58ba6b0a..d78c2b46 100644 --- a/src/ui/resource/ImageResource.cpp +++ b/src/ui/resource/ImageResource.cpp @@ -25,6 +25,8 @@ #include "utils/Logger.hpp" #include "utils/Utils.hpp" +#include "database/Track.hpp" + #include "LmsApplication.hpp" #include "cover/CoverArtGrabber.hpp" diff --git a/src/ui/resource/TranscodeResource.cpp b/src/ui/resource/TranscodeResource.cpp index 7b70991f..c27e2355 100644 --- a/src/ui/resource/TranscodeResource.cpp +++ b/src/ui/resource/TranscodeResource.cpp @@ -23,6 +23,8 @@ #include "utils/Logger.hpp" +#include "database/Track.hpp" + #include "LmsApplication.hpp" namespace UserInterface {