Reduce database include dependencies
This commit is contained in:
@@ -17,8 +17,13 @@
|
||||
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#include "av/AvInfo.hpp"
|
||||
|
||||
#include "database/Release.hpp"
|
||||
#include "database/Track.hpp"
|
||||
|
||||
#include "utils/Logger.hpp"
|
||||
|
||||
#include "CoverArtGrabber.hpp"
|
||||
@@ -145,7 +150,7 @@ Grabber::getFromTrack(const boost::filesystem::path& p, std::size_t nbMaxCovers)
|
||||
}
|
||||
|
||||
std::vector<Image::Image>
|
||||
Grabber::getFromTrack(Wt::Dbo::Session& session, Database::Track::id_type trackId, std::size_t nbMaxCovers) const
|
||||
Grabber::getFromTrack(Wt::Dbo::Session& session, Database::IdType trackId, std::size_t nbMaxCovers) const
|
||||
{
|
||||
using namespace Database;
|
||||
|
||||
@@ -173,7 +178,7 @@ Grabber::getFromTrack(Wt::Dbo::Session& session, Database::Track::id_type trackI
|
||||
|
||||
|
||||
std::vector<Image::Image>
|
||||
Grabber::getFromRelease(Wt::Dbo::Session& session, Database::Release::id_type releaseId, std::size_t nbMaxCovers) const
|
||||
Grabber::getFromRelease(Wt::Dbo::Session& session, Database::IdType releaseId, std::size_t nbMaxCovers) const
|
||||
{
|
||||
using namespace Database;
|
||||
|
||||
|
||||
@@ -38,8 +38,8 @@ class Grabber
|
||||
std::vector<boost::filesystem::path> getCoverPaths(const boost::filesystem::path& directoryPath, std::size_t nbMaxCovers = 1) const;
|
||||
std::vector<Image::Image> getFromDirectory(const boost::filesystem::path& path, std::size_t nbMaxCovers = 1) const;
|
||||
std::vector<Image::Image> getFromTrack(const boost::filesystem::path& path, std::size_t nbMaxCovers = 1) const;
|
||||
std::vector<Image::Image> getFromTrack(Wt::Dbo::Session& session, Database::Track::id_type trackId, std::size_t nbMaxCovers = 1) const;
|
||||
std::vector<Image::Image> getFromRelease(Wt::Dbo::Session& session, Database::Release::id_type releaseId, std::size_t nbMaxCovers = 1) const;
|
||||
std::vector<Image::Image> getFromTrack(Wt::Dbo::Session& session, Database::IdType trackId, std::size_t nbMaxCovers = 1) const;
|
||||
std::vector<Image::Image> getFromRelease(Wt::Dbo::Session& session, Database::IdType releaseId, std::size_t nbMaxCovers = 1) const;
|
||||
|
||||
private:
|
||||
Grabber();
|
||||
|
||||
@@ -33,6 +33,12 @@
|
||||
|
||||
#include "utils/Logger.hpp"
|
||||
|
||||
#include "DbArtist.hpp"
|
||||
#include "MediaDirectory.hpp"
|
||||
#include "Playlist.hpp"
|
||||
#include "Release.hpp"
|
||||
#include "Track.hpp"
|
||||
|
||||
#include "DatabaseHandler.hpp"
|
||||
|
||||
namespace Database {
|
||||
|
||||
@@ -17,8 +17,7 @@
|
||||
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef DATABASE_HANDLER_HPP
|
||||
#define DATABASE_HANDLER_HPP
|
||||
#pragma once
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <memory>
|
||||
@@ -30,12 +29,11 @@
|
||||
#include <Wt/Auth/Login.h>
|
||||
#include <Wt/Auth/PasswordService.h>
|
||||
|
||||
#include "Types.hpp"
|
||||
#include "User.hpp"
|
||||
|
||||
namespace Database {
|
||||
|
||||
typedef Wt::Dbo::dbo_default_traits::IdType id_type;
|
||||
typedef Wt::Auth::Dbo::UserDatabase<AuthInfo> UserDatabase;
|
||||
using UserDatabase = Wt::Auth::Dbo::UserDatabase<AuthInfo>;
|
||||
|
||||
// Session living class handling the database and the login
|
||||
class Handler
|
||||
@@ -72,5 +70,4 @@ class Handler
|
||||
|
||||
} // namespace Database
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -17,11 +17,14 @@
|
||||
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Types.hpp"
|
||||
#include "SqlQuery.hpp"
|
||||
|
||||
#include "utils/Logger.hpp"
|
||||
|
||||
#include "Release.hpp"
|
||||
#include "DbArtist.hpp"
|
||||
#include "Track.hpp"
|
||||
|
||||
namespace Database
|
||||
{
|
||||
|
||||
@@ -46,7 +49,7 @@ Artist::getByMBID(Wt::Dbo::Session& session, const std::string& mbid)
|
||||
}
|
||||
|
||||
Artist::pointer
|
||||
Artist::getById(Wt::Dbo::Session& session, Artist::id_type id)
|
||||
Artist::getById(Wt::Dbo::Session& session, IdType id)
|
||||
{
|
||||
return session.find<Artist>().where("id = ?").bind(id);
|
||||
}
|
||||
@@ -75,7 +78,7 @@ Artist::getAllOrphans(Wt::Dbo::Session& session)
|
||||
static
|
||||
Wt::Dbo::Query<Artist::pointer>
|
||||
getQuery(Wt::Dbo::Session& session,
|
||||
const std::set<Artist::id_type>& clusterIds,
|
||||
const std::set<IdType>& clusterIds,
|
||||
const std::vector<std::string>& keywords)
|
||||
{
|
||||
WhereClause where;
|
||||
@@ -116,7 +119,7 @@ getQuery(Wt::Dbo::Session& session,
|
||||
|
||||
std::vector<Artist::pointer>
|
||||
Artist::getByFilter(Wt::Dbo::Session& session,
|
||||
const std::set<id_type>& clusters,
|
||||
const std::set<IdType>& clusters,
|
||||
const std::vector<std::string> keywords,
|
||||
int offset, int size, bool& moreResults)
|
||||
{
|
||||
@@ -138,7 +141,7 @@ Artist::getByFilter(Wt::Dbo::Session& session,
|
||||
}
|
||||
|
||||
std::vector<Wt::Dbo::ptr<Release>>
|
||||
Artist::getReleases(const std::set<id_type>& clusterIds) const
|
||||
Artist::getReleases(const std::set<IdType>& clusterIds) const
|
||||
{
|
||||
assert(self());
|
||||
assert(self()->id() != Wt::Dbo::dbo_traits<Artist>::invalidId() );
|
||||
@@ -212,7 +215,7 @@ Artist::getClusterGroups(std::vector<ClusterType::pointer> clusterTypes, std::si
|
||||
|
||||
Wt::Dbo::collection<Cluster::pointer> queryRes = query;
|
||||
|
||||
std::map<ClusterType::id_type, std::vector<Cluster::pointer>> clusters;
|
||||
std::map<IdType, std::vector<Cluster::pointer>> clusters;
|
||||
for (auto cluster : queryRes)
|
||||
{
|
||||
if (clusters[cluster->getType().id()].size() < size)
|
||||
|
||||
@@ -17,8 +17,7 @@
|
||||
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _DB_ARTIST_HPP_
|
||||
#define _DB_ARTIST_HPP_
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -26,6 +25,8 @@
|
||||
#include <Wt/Dbo/Dbo.h>
|
||||
#include <Wt/Dbo/QueryModel.h>
|
||||
|
||||
#include "Types.hpp"
|
||||
|
||||
namespace Database
|
||||
{
|
||||
|
||||
@@ -39,17 +40,16 @@ class Artist : public Wt::Dbo::Dbo<Artist>
|
||||
public:
|
||||
|
||||
typedef Wt::Dbo::ptr<Artist> pointer;
|
||||
typedef Wt::Dbo::dbo_traits<Artist>::IdType id_type;
|
||||
|
||||
Artist() {}
|
||||
Artist(const std::string& name, const std::string& MBID = "");
|
||||
|
||||
// Accessors
|
||||
static pointer getByMBID(Wt::Dbo::Session& session, const std::string& MBID);
|
||||
static pointer getById(Wt::Dbo::Session& session, id_type id);
|
||||
static pointer getById(Wt::Dbo::Session& session, IdType id);
|
||||
static std::vector<pointer> getByName(Wt::Dbo::Session& session, const std::string& name);
|
||||
static std::vector<pointer> getByFilter(Wt::Dbo::Session& session,
|
||||
const std::set<id_type>& clusters, // at least one track that belongs to these clusters
|
||||
const std::set<IdType>& clusters, // at least one track that belongs to these clusters
|
||||
const std::vector<std::string> keywords, // name must match all of these keywords
|
||||
int offset,
|
||||
int size,
|
||||
@@ -63,7 +63,7 @@ class Artist : public Wt::Dbo::Dbo<Artist>
|
||||
std::string getMBID(void) const { return _MBID; }
|
||||
|
||||
// Get the releases that have at least one track for this artist that belongs to optional cluster filters
|
||||
std::vector<Wt::Dbo::ptr<Release>> getReleases(const std::set<id_type>& clusterIds = std::set<id_type>()) const;
|
||||
std::vector<Wt::Dbo::ptr<Release>> getReleases(const std::set<IdType>& clusterIds = std::set<IdType>()) const;
|
||||
|
||||
// Get the cluster of the tracks made by this artist
|
||||
// Each clusters are grouped by cluster type, sorted by the number of occurence
|
||||
@@ -97,4 +97,3 @@ class Artist : public Wt::Dbo::Dbo<Artist>
|
||||
|
||||
} // namespace Database
|
||||
|
||||
#endif
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#include "utils/Utils.hpp"
|
||||
|
||||
#include "Types.hpp"
|
||||
#include "MediaDirectory.hpp"
|
||||
|
||||
namespace Database {
|
||||
|
||||
|
||||
@@ -17,8 +17,7 @@
|
||||
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef DATABASE_MEDIA_DIRECTORY_HPP
|
||||
#define DATABASE_MEDIA_DIRECTORY_HPP
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -59,5 +58,3 @@ class MediaDirectory
|
||||
|
||||
} // namespace Database
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -16,8 +16,12 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <cassert>
|
||||
|
||||
#include "Types.hpp"
|
||||
#include "User.hpp"
|
||||
#include "Track.hpp"
|
||||
|
||||
#include "Playlist.hpp"
|
||||
|
||||
namespace Database {
|
||||
|
||||
|
||||
@@ -17,8 +17,7 @@
|
||||
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef DATABASE_PLAYLIST_HPP
|
||||
#define DATABASE_PLAYLIST_HPP
|
||||
#pragma once
|
||||
|
||||
#include <Wt/Dbo/Dbo.h>
|
||||
|
||||
@@ -108,4 +107,3 @@ class PlaylistEntry
|
||||
|
||||
} // namespace Database
|
||||
|
||||
#endif
|
||||
|
||||
@@ -17,9 +17,13 @@
|
||||
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Types.hpp"
|
||||
#include "SqlQuery.hpp"
|
||||
|
||||
#include "DbArtist.hpp"
|
||||
#include "Track.hpp"
|
||||
|
||||
#include "Release.hpp"
|
||||
|
||||
namespace Database
|
||||
{
|
||||
|
||||
@@ -44,7 +48,7 @@ Release::getByMBID(Wt::Dbo::Session& session, const std::string& mbid)
|
||||
}
|
||||
|
||||
Release::pointer
|
||||
Release::getById(Wt::Dbo::Session& session, Release::id_type id)
|
||||
Release::getById(Wt::Dbo::Session& session, IdType id)
|
||||
{
|
||||
return session.find<Release>().where("id = ?").bind(id);
|
||||
}
|
||||
@@ -73,7 +77,7 @@ Release::getAllOrphans(Wt::Dbo::Session& session)
|
||||
static
|
||||
Wt::Dbo::Query<Release::pointer>
|
||||
getQuery(Wt::Dbo::Session& session,
|
||||
const std::set<Release::id_type>& clusterIds,
|
||||
const std::set<IdType>& clusterIds,
|
||||
const std::vector<std::string> keywords)
|
||||
{
|
||||
WhereClause where;
|
||||
@@ -113,7 +117,7 @@ getQuery(Wt::Dbo::Session& session,
|
||||
|
||||
std::vector<Release::pointer>
|
||||
Release::getByFilter(Wt::Dbo::Session& session,
|
||||
const std::set<id_type>& clusterIds,
|
||||
const std::set<IdType>& clusterIds,
|
||||
const std::vector<std::string> keywords,
|
||||
int offset, int size, bool& moreResults)
|
||||
{
|
||||
@@ -182,7 +186,7 @@ Release::hasVariousArtists() const
|
||||
}
|
||||
|
||||
std::vector<Wt::Dbo::ptr<Track>>
|
||||
Release::getTracks(const std::set<id_type>& clusterIds) const
|
||||
Release::getTracks(const std::set<IdType>& clusterIds) const
|
||||
{
|
||||
assert(self());
|
||||
assert(self()->id() != Wt::Dbo::dbo_traits<Release>::invalidId() );
|
||||
@@ -256,7 +260,7 @@ Release::getClusterGroups(std::vector<ClusterType::pointer> clusterTypes, std::s
|
||||
|
||||
Wt::Dbo::collection<Cluster::pointer> queryRes = query;
|
||||
|
||||
std::map<ClusterType::id_type, std::vector<Cluster::pointer>> clusters;
|
||||
std::map<IdType, std::vector<Cluster::pointer>> clusters;
|
||||
for (auto cluster : queryRes)
|
||||
{
|
||||
if (clusters[cluster->getType().id()].size() < size)
|
||||
|
||||
@@ -23,19 +23,22 @@
|
||||
|
||||
#include <Wt/Dbo/Dbo.h>
|
||||
|
||||
#include "Types.hpp"
|
||||
|
||||
namespace Database
|
||||
{
|
||||
|
||||
class Track;
|
||||
class Release;
|
||||
class Artist;
|
||||
class Cluster;
|
||||
class ClusterType;
|
||||
|
||||
class Release : public Wt::Dbo::Dbo<Release>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef Wt::Dbo::ptr<Release> pointer;
|
||||
typedef Wt::Dbo::dbo_traits<Release>::IdType id_type;
|
||||
|
||||
Release() {}
|
||||
Release(const std::string& name, const std::string& MBID = "");
|
||||
@@ -43,18 +46,18 @@ class Release : public Wt::Dbo::Dbo<Release>
|
||||
// Accessors
|
||||
static pointer getByMBID(Wt::Dbo::Session& session, const std::string& MBID);
|
||||
static std::vector<pointer> getByName(Wt::Dbo::Session& session, const std::string& name);
|
||||
static pointer getById(Wt::Dbo::Session& session, id_type id);
|
||||
static pointer getById(Wt::Dbo::Session& session, IdType id);
|
||||
static std::vector<pointer> getAllOrphans(Wt::Dbo::Session& session); // no track related
|
||||
static std::vector<pointer> getAll(Wt::Dbo::Session& session, int offset, int size);
|
||||
|
||||
static std::vector<pointer> getByFilter(Wt::Dbo::Session& session,
|
||||
const std::set<id_type>& clusters, // at least one track that belongs to these clusters
|
||||
const std::set<IdType>& clusters, // at least one track that belongs to these clusters
|
||||
const std::vector<std::string> keywords, // name must match all of these keywords
|
||||
int offset,
|
||||
int size,
|
||||
bool& moreExpected);
|
||||
|
||||
std::vector<Wt::Dbo::ptr<Track>> getTracks(const std::set<id_type>& clusters = std::set<id_type>()) const;
|
||||
std::vector<Wt::Dbo::ptr<Track>> getTracks(const std::set<IdType>& clusters = std::set<IdType>()) const;
|
||||
// Get the cluster of the tracks that belong to this release
|
||||
// Each clusters are grouped by cluster type, sorted by the number of occurence
|
||||
// size is the max number of cluster per cluster type
|
||||
|
||||
@@ -17,8 +17,7 @@
|
||||
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef SQL_QUERY_HPP___
|
||||
#define SQL_QUERY_HPP___
|
||||
#pragma once
|
||||
|
||||
#include <list>
|
||||
#include <string>
|
||||
@@ -134,5 +133,3 @@ class SqlQuery
|
||||
GroupByStatement _groupByStatement; // GROUP BY statement
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
+19
-10
@@ -21,7 +21,10 @@
|
||||
|
||||
#include "SqlQuery.hpp"
|
||||
|
||||
#include "Types.hpp"
|
||||
#include "DbArtist.hpp"
|
||||
#include "Release.hpp"
|
||||
|
||||
#include "Track.hpp"
|
||||
|
||||
namespace Database {
|
||||
|
||||
@@ -37,12 +40,12 @@ Track::getAll(Wt::Dbo::Session& session)
|
||||
return session.find<Track>();
|
||||
}
|
||||
|
||||
std::vector<Track::id_type>
|
||||
std::vector<IdType>
|
||||
Track::getAllIds(Wt::Dbo::Session& session)
|
||||
{
|
||||
Wt::Dbo::Transaction transaction(session);
|
||||
Wt::Dbo::collection<Track::id_type> res = session.query<Track::id_type>("SELECT id from track");
|
||||
return std::vector<Track::id_type>(res.begin(), res.end());
|
||||
Wt::Dbo::collection<IdType> res = session.query<IdType>("SELECT id from track");
|
||||
return std::vector<IdType>(res.begin(), res.end());
|
||||
}
|
||||
|
||||
Track::pointer
|
||||
@@ -52,7 +55,7 @@ Track::getByPath(Wt::Dbo::Session& session, const boost::filesystem::path& p)
|
||||
}
|
||||
|
||||
Track::pointer
|
||||
Track::getById(Wt::Dbo::Session& session, id_type id)
|
||||
Track::getById(Wt::Dbo::Session& session, IdType id)
|
||||
{
|
||||
return session.find<Track>().where("id = ?").bind(id);
|
||||
}
|
||||
@@ -102,7 +105,7 @@ Track::getClusters(void) const
|
||||
static
|
||||
Wt::Dbo::Query< Track::pointer >
|
||||
getQuery(Wt::Dbo::Session& session,
|
||||
const std::set<Cluster::id_type>& clusterIds,
|
||||
const std::set<IdType>& clusterIds,
|
||||
const std::vector<std::string> keywords)
|
||||
{
|
||||
WhereClause where;
|
||||
@@ -142,7 +145,7 @@ getQuery(Wt::Dbo::Session& session,
|
||||
|
||||
std::vector<Track::pointer>
|
||||
Track::getByFilter(Wt::Dbo::Session& session,
|
||||
const std::set<id_type>& clusterIds,
|
||||
const std::set<IdType>& clusterIds,
|
||||
const std::vector<std::string> keywords,
|
||||
int offset, int size, bool& moreResults)
|
||||
{
|
||||
@@ -165,7 +168,7 @@ Track::getByFilter(Wt::Dbo::Session& session,
|
||||
|
||||
std::vector<Track::pointer>
|
||||
Track::getByFilter(Wt::Dbo::Session& session,
|
||||
const std::set<id_type>& clusters)
|
||||
const std::set<IdType>& clusters)
|
||||
{
|
||||
bool moreResults;
|
||||
|
||||
@@ -233,7 +236,7 @@ Cluster::getAll(Wt::Dbo::Session& session)
|
||||
}
|
||||
|
||||
Cluster::pointer
|
||||
Cluster::getById(Wt::Dbo::Session& session, id_type id)
|
||||
Cluster::getById(Wt::Dbo::Session& session, IdType id)
|
||||
{
|
||||
return session.find<Cluster>().where("id = ?").bind(id);
|
||||
}
|
||||
@@ -288,7 +291,7 @@ std::vector<Cluster::pointer>
|
||||
ClusterType::getClusters() const
|
||||
{
|
||||
assert(self());
|
||||
assert(self()->id() != Wt::Dbo::dbo_traits<Release>::invalidId() );
|
||||
assert(self()->id() != Wt::Dbo::dbo_traits<ClusterType>::invalidId() );
|
||||
assert(session());
|
||||
|
||||
Wt::Dbo::collection<Cluster::pointer> res = session()->find<Cluster>()
|
||||
@@ -298,5 +301,11 @@ ClusterType::getClusters() const
|
||||
return std::vector<Cluster::pointer>(res.begin(), res.end());
|
||||
}
|
||||
|
||||
void
|
||||
Cluster::addTrack(Wt::Dbo::ptr<Track> track)
|
||||
{
|
||||
_tracks.insert(track);
|
||||
}
|
||||
|
||||
} // namespace Database
|
||||
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
|
||||
#include <Wt/WDateTime.h>
|
||||
|
||||
#include "Types.hpp"
|
||||
|
||||
namespace Database {
|
||||
|
||||
|
||||
@@ -44,14 +46,13 @@ class Cluster : public Wt::Dbo::Dbo<Cluster>
|
||||
{
|
||||
public:
|
||||
typedef Wt::Dbo::ptr<Cluster> pointer;
|
||||
typedef Wt::Dbo::dbo_traits<Cluster>::IdType id_type;
|
||||
|
||||
Cluster();
|
||||
Cluster(Wt::Dbo::ptr<ClusterType> type, std::string name);
|
||||
|
||||
// Find utility
|
||||
static std::vector<pointer> getAll(Wt::Dbo::Session& session);
|
||||
static pointer getById(Wt::Dbo::Session& session, id_type id);
|
||||
static pointer getById(Wt::Dbo::Session& session, IdType id);
|
||||
|
||||
// Create utility
|
||||
static pointer create(Wt::Dbo::Session& session, Wt::Dbo::ptr<ClusterType> type, std::string name);
|
||||
@@ -61,7 +62,7 @@ class Cluster : public Wt::Dbo::Dbo<Cluster>
|
||||
Wt::Dbo::ptr<ClusterType> getType() const { return _clusterType; }
|
||||
const Wt::Dbo::collection<Wt::Dbo::ptr<Track>>& getTracks() const { return _tracks; }
|
||||
|
||||
void addTrack(Wt::Dbo::ptr<Track> track) { _tracks.insert(track); }
|
||||
void addTrack(Wt::Dbo::ptr<Track> track);
|
||||
|
||||
template<class Action>
|
||||
void persist(Action& a)
|
||||
@@ -88,7 +89,6 @@ class ClusterType : public Wt::Dbo::Dbo<ClusterType>
|
||||
public:
|
||||
|
||||
using pointer = Wt::Dbo::ptr<ClusterType>;
|
||||
using id_type = Wt::Dbo::dbo_traits<ClusterType>::IdType;
|
||||
|
||||
ClusterType() {}
|
||||
ClusterType(std::string name);
|
||||
@@ -126,7 +126,6 @@ class Track
|
||||
public:
|
||||
|
||||
typedef Wt::Dbo::ptr<Track> pointer;
|
||||
typedef Wt::Dbo::dbo_traits<Track>::IdType id_type;
|
||||
|
||||
Track() {}
|
||||
Track(const boost::filesystem::path& p);
|
||||
@@ -139,19 +138,19 @@ class Track
|
||||
|
||||
// Find utility functions
|
||||
static pointer getByPath(Wt::Dbo::Session& session, const boost::filesystem::path& p);
|
||||
static pointer getById(Wt::Dbo::Session& session, id_type id);
|
||||
static pointer getById(Wt::Dbo::Session& session, IdType id);
|
||||
static pointer getByMBID(Wt::Dbo::Session& session, const std::string& MBID);
|
||||
static std::vector<pointer> getByFilter(Wt::Dbo::Session& session,
|
||||
const std::set<id_type>& clusters); // tracks that belong to these clusters
|
||||
const std::set<IdType>& clusters); // tracks that belong to these clusters
|
||||
static std::vector<pointer> getByFilter(Wt::Dbo::Session& session,
|
||||
const std::set<id_type>& clusters, // tracks that belong to these clusters
|
||||
const std::set<IdType>& clusters, // tracks that belong to these clusters
|
||||
const std::vector<std::string> keywords, // name must match all of these keywords
|
||||
int offset,
|
||||
int size,
|
||||
bool& moreExpected);
|
||||
|
||||
static Wt::Dbo::collection< pointer > getAll(Wt::Dbo::Session& session);
|
||||
static std::vector<id_type> getAllIds(Wt::Dbo::Session& session); // nested transaction
|
||||
static std::vector<IdType> getAllIds(Wt::Dbo::Session& session); // nested transaction
|
||||
static std::vector<boost::filesystem::path> getAllPaths(Wt::Dbo::Session& session); // nested transaction
|
||||
static std::vector<pointer> getMBIDDuplicates(Wt::Dbo::Session& session);
|
||||
static std::vector<pointer> getChecksumDuplicates(Wt::Dbo::Session& session);
|
||||
|
||||
@@ -17,12 +17,11 @@
|
||||
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// header file aimed to ease database class declarations
|
||||
#pragma once
|
||||
|
||||
#include "DbArtist.hpp"
|
||||
#include "Track.hpp"
|
||||
#include "Playlist.hpp"
|
||||
#include "Release.hpp"
|
||||
#include "MediaDirectory.hpp"
|
||||
#include "User.hpp"
|
||||
#include <Wt/Dbo/Dbo.h>
|
||||
|
||||
namespace Database {
|
||||
using IdType = Wt::Dbo::dbo_default_traits::IdType;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Types.hpp"
|
||||
#include "User.hpp"
|
||||
|
||||
namespace Database {
|
||||
|
||||
|
||||
@@ -17,8 +17,7 @@
|
||||
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef DATABASE_USER_HPP
|
||||
#define DATABASE_USER_HPP
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -28,7 +27,7 @@
|
||||
namespace Database {
|
||||
|
||||
class User;
|
||||
typedef Wt::Auth::Dbo::AuthInfo<User> AuthInfo;
|
||||
using AuthInfo = Wt::Auth::Dbo::AuthInfo<User>;
|
||||
|
||||
class Playlist;
|
||||
|
||||
@@ -109,4 +108,3 @@ class User : public Wt::Dbo::Dbo<User>
|
||||
|
||||
} // namespace Databas'
|
||||
|
||||
#endif
|
||||
|
||||
@@ -26,8 +26,11 @@
|
||||
|
||||
#include "cover/CoverArtGrabber.hpp"
|
||||
|
||||
#include "database/DbArtist.hpp"
|
||||
#include "database/Release.hpp"
|
||||
#include "database/MediaDirectory.hpp"
|
||||
#include "database/Track.hpp"
|
||||
#include "database/Setting.hpp"
|
||||
#include "database/Types.hpp"
|
||||
|
||||
#include "utils/Logger.hpp"
|
||||
#include "utils/Path.hpp"
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
#include "metadata/TagLibParser.hpp"
|
||||
|
||||
#include "database/DatabaseHandler.hpp"
|
||||
#include "database/Track.hpp"
|
||||
#include "database/DbArtist.hpp"
|
||||
#include "database/Release.hpp"
|
||||
|
||||
namespace Scanner {
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ static std::string escape(const std::string& str)
|
||||
}
|
||||
|
||||
void
|
||||
MediaPlayer::playTrack(Database::Track::id_type trackId)
|
||||
MediaPlayer::playTrack(Database::IdType trackId)
|
||||
{
|
||||
LMS_LOG(UI, DEBUG) << "Playing track ID = " << trackId;
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ class MediaPlayer : public Wt::WTemplate
|
||||
MediaPlayer();
|
||||
|
||||
void stop();
|
||||
void playTrack(Database::Track::id_type);
|
||||
void playTrack(Database::IdType trackId);
|
||||
|
||||
// Signals
|
||||
Wt::JSignal<> playbackEnded;
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
|
||||
#include "utils/Logger.hpp"
|
||||
|
||||
#include "database/Playlist.hpp"
|
||||
|
||||
#include "LmsApplication.hpp"
|
||||
#include "PlayQueueView.hpp"
|
||||
|
||||
@@ -91,7 +93,7 @@ PlayQueue::play(std::size_t pos)
|
||||
{
|
||||
updateCurrentTrack(false);
|
||||
|
||||
Database::Track::id_type trackId;
|
||||
Database::IdType trackId;
|
||||
{
|
||||
Wt::Dbo::Transaction transaction(LmsApp->getDboSession());
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
#include "database/Types.hpp"
|
||||
#include "database/Track.hpp"
|
||||
|
||||
namespace UserInterface {
|
||||
|
||||
@@ -45,7 +45,7 @@ class PlayQueue : public Wt::WTemplate
|
||||
void playPrevious();
|
||||
|
||||
// Signal emitted when a track is to be played
|
||||
Wt::Signal<Database::Track::id_type> playTrack;
|
||||
Wt::Signal<Database::IdType> playTrack;
|
||||
|
||||
// Signal emitted when play has to be stopped
|
||||
Wt::Signal<> playbackStop;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include <Wt/WTemplate.h>
|
||||
#include <Wt/WPushButton.h>
|
||||
|
||||
#include "database/Types.hpp"
|
||||
#include "database/User.hpp"
|
||||
#include "utils/Logger.hpp"
|
||||
|
||||
#include "LmsApplication.hpp"
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
#include <Wt/WTemplate.h>
|
||||
#include <Wt/WText.h>
|
||||
|
||||
#include "database/DbArtist.hpp"
|
||||
#include "database/Setting.hpp"
|
||||
#include "database/Types.hpp"
|
||||
|
||||
#include "utils/Logger.hpp"
|
||||
#include "utils/Utils.hpp"
|
||||
@@ -92,7 +92,7 @@ Artist::refresh()
|
||||
|
||||
clear();
|
||||
|
||||
auto artistId = readAs<Database::Artist::id_type>(wApp->internalPathNextPart("/artist/"));
|
||||
auto artistId = readAs<Database::IdType>(wApp->internalPathNextPart("/artist/"));
|
||||
if (!artistId)
|
||||
return;
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
#include <Wt/WContainerWidget.h>
|
||||
#include <Wt/WSignal.h>
|
||||
|
||||
#include "database/Types.hpp"
|
||||
|
||||
namespace UserInterface {
|
||||
|
||||
class Filters;
|
||||
@@ -31,11 +33,11 @@ class Artist : public Wt::WContainerWidget
|
||||
public:
|
||||
Artist(Filters* filters);
|
||||
|
||||
Wt::Signal<Database::id_type> artistAdd;
|
||||
Wt::Signal<Database::id_type> artistPlay;
|
||||
Wt::Signal<Database::IdType> artistAdd;
|
||||
Wt::Signal<Database::IdType> artistPlay;
|
||||
|
||||
Wt::Signal<Database::id_type> releaseAdd;
|
||||
Wt::Signal<Database::id_type> releasePlay;
|
||||
Wt::Signal<Database::IdType> releaseAdd;
|
||||
Wt::Signal<Database::IdType> releasePlay;
|
||||
|
||||
private:
|
||||
void refresh();
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
#include <Wt/WTemplate.h>
|
||||
#include <Wt/WLineEdit.h>
|
||||
|
||||
#include "database/DbArtist.hpp"
|
||||
#include "database/Setting.hpp"
|
||||
#include "database/Types.hpp"
|
||||
|
||||
#include "utils/Logger.hpp"
|
||||
#include "utils/Utils.hpp"
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#include <Wt/WLineEdit.h>
|
||||
#include <Wt/WSignal.h>
|
||||
|
||||
#include "database/Types.hpp"
|
||||
|
||||
namespace UserInterface {
|
||||
|
||||
class Filters;
|
||||
@@ -33,8 +35,8 @@ class Artists : public Wt::WTemplate
|
||||
public:
|
||||
Artists(Filters* filters);
|
||||
|
||||
Wt::Signal<Database::id_type> artistAdd;
|
||||
Wt::Signal<Database::id_type> artistPlay;
|
||||
Wt::Signal<Database::IdType> artistAdd;
|
||||
Wt::Signal<Database::IdType> artistPlay;
|
||||
|
||||
private:
|
||||
void refresh();
|
||||
|
||||
@@ -118,7 +118,7 @@ Explore::Explore()
|
||||
}
|
||||
|
||||
// TODO SQL this?
|
||||
static std::vector<Database::Track::pointer> getArtistTracks(Wt::Dbo::Session& session, Database::id_type artistId, std::set<Database::id_type> clusters)
|
||||
static std::vector<Database::Track::pointer> getArtistTracks(Wt::Dbo::Session& session, Database::IdType artistId, std::set<Database::IdType> clusters)
|
||||
{
|
||||
std::vector<Database::Track::pointer> res;
|
||||
|
||||
@@ -140,7 +140,7 @@ static std::vector<Database::Track::pointer> getArtistTracks(Wt::Dbo::Session& s
|
||||
return res;
|
||||
}
|
||||
|
||||
static std::vector<Database::Track::pointer> getReleaseTracks(Wt::Dbo::Session& session, Database::id_type releaseId, std::set<Database::id_type> clusters)
|
||||
static std::vector<Database::Track::pointer> getReleaseTracks(Wt::Dbo::Session& session, Database::IdType releaseId, std::set<Database::IdType> clusters)
|
||||
{
|
||||
std::vector<Database::Track::pointer> res;
|
||||
|
||||
@@ -151,7 +151,7 @@ static std::vector<Database::Track::pointer> getReleaseTracks(Wt::Dbo::Session&
|
||||
return release->getTracks(clusters);
|
||||
}
|
||||
|
||||
static std::vector<Database::Track::pointer> getTrack(Wt::Dbo::Session& session, Database::id_type trackId)
|
||||
static std::vector<Database::Track::pointer> getTrack(Wt::Dbo::Session& session, Database::IdType trackId)
|
||||
{
|
||||
std::vector<Database::Track::pointer> res;
|
||||
|
||||
@@ -163,7 +163,7 @@ static std::vector<Database::Track::pointer> getTrack(Wt::Dbo::Session& session,
|
||||
}
|
||||
|
||||
void
|
||||
Explore::handleArtistAdd(Database::id_type id)
|
||||
Explore::handleArtistAdd(Database::IdType id)
|
||||
{
|
||||
Wt::Dbo::Transaction transaction(LmsApp->getDboSession());
|
||||
|
||||
@@ -171,7 +171,7 @@ Explore::handleArtistAdd(Database::id_type id)
|
||||
}
|
||||
|
||||
void
|
||||
Explore::handleArtistPlay(Database::id_type id)
|
||||
Explore::handleArtistPlay(Database::IdType id)
|
||||
{
|
||||
Wt::Dbo::Transaction transaction(LmsApp->getDboSession());
|
||||
|
||||
@@ -179,7 +179,7 @@ Explore::handleArtistPlay(Database::id_type id)
|
||||
}
|
||||
|
||||
void
|
||||
Explore::handleReleaseAdd(Database::id_type id)
|
||||
Explore::handleReleaseAdd(Database::IdType id)
|
||||
{
|
||||
Wt::Dbo::Transaction transaction(LmsApp->getDboSession());
|
||||
|
||||
@@ -187,7 +187,7 @@ Explore::handleReleaseAdd(Database::id_type id)
|
||||
}
|
||||
|
||||
void
|
||||
Explore::handleReleasePlay(Database::id_type id)
|
||||
Explore::handleReleasePlay(Database::IdType id)
|
||||
{
|
||||
Wt::Dbo::Transaction transaction(LmsApp->getDboSession());
|
||||
|
||||
@@ -195,7 +195,7 @@ Explore::handleReleasePlay(Database::id_type id)
|
||||
}
|
||||
|
||||
void
|
||||
Explore::handleTrackAdd(Database::id_type id)
|
||||
Explore::handleTrackAdd(Database::IdType id)
|
||||
{
|
||||
Wt::Dbo::Transaction transaction(LmsApp->getDboSession());
|
||||
|
||||
@@ -203,7 +203,7 @@ Explore::handleTrackAdd(Database::id_type id)
|
||||
}
|
||||
|
||||
void
|
||||
Explore::handleTrackPlay(Database::id_type id)
|
||||
Explore::handleTrackPlay(Database::IdType id)
|
||||
{
|
||||
Wt::Dbo::Transaction transaction(LmsApp->getDboSession());
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include <Wt/WTemplate.h>
|
||||
|
||||
#include "database/Track.hpp"
|
||||
#include "database/Types.hpp"
|
||||
|
||||
namespace UserInterface {
|
||||
@@ -37,12 +38,12 @@ class Explore : public Wt::WTemplate
|
||||
|
||||
private:
|
||||
|
||||
void handleArtistAdd(Database::Artist::id_type id);
|
||||
void handleArtistPlay(Database::Artist::id_type id);
|
||||
void handleReleaseAdd(Database::Release::id_type id);
|
||||
void handleReleasePlay(Database::Release::id_type id);
|
||||
void handleTrackAdd(Database::Track::id_type id);
|
||||
void handleTrackPlay(Database::Track::id_type id);
|
||||
void handleArtistAdd(Database::IdType id);
|
||||
void handleArtistPlay(Database::IdType id);
|
||||
void handleReleaseAdd(Database::IdType id);
|
||||
void handleReleasePlay(Database::IdType id);
|
||||
void handleTrackAdd(Database::IdType id);
|
||||
void handleTrackPlay(Database::IdType id);
|
||||
void handleTracksAdd(std::vector<Database::Track::pointer> tracks);
|
||||
void handleTracksPlay(std::vector<Database::Track::pointer> tracks);
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ Filters::showDialog()
|
||||
}
|
||||
|
||||
void
|
||||
Filters::add(Database::Cluster::id_type clusterId)
|
||||
Filters::add(Database::IdType clusterId)
|
||||
{
|
||||
Wt::Dbo::Transaction transaction(LmsApp->getDboSession());
|
||||
|
||||
|
||||
@@ -34,9 +34,9 @@ class Filters : public Wt::WTemplate
|
||||
public:
|
||||
Filters();
|
||||
|
||||
void add(Database::Cluster::id_type clusterId);
|
||||
void add(Database::IdType clusterId);
|
||||
|
||||
std::set<Database::Cluster::id_type> getClusterIds() const { return _filterIds; }
|
||||
std::set<Database::IdType> getClusterIds() const { return _filterIds; }
|
||||
|
||||
Wt::Signal<>& updated() { return _sigUpdated; }
|
||||
|
||||
@@ -46,7 +46,7 @@ class Filters : public Wt::WTemplate
|
||||
|
||||
Wt::WContainerWidget *_filters;
|
||||
Wt::Signal<> _sigUpdated;
|
||||
std::set<Database::Cluster::id_type> _filterIds;
|
||||
std::set<Database::IdType> _filterIds;
|
||||
};
|
||||
|
||||
} // namespace UserInterface
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <Wt/WTemplate.h>
|
||||
#include <Wt/WText.h>
|
||||
|
||||
#include "database/Types.hpp"
|
||||
#include "database/Release.hpp"
|
||||
#include "database/Setting.hpp"
|
||||
|
||||
#include "utils/Logger.hpp"
|
||||
@@ -92,7 +92,7 @@ Release::refresh()
|
||||
|
||||
clear();
|
||||
|
||||
auto releaseId = readAs<Database::Release::id_type>(wApp->internalPathNextPart("/release/"));
|
||||
auto releaseId = readAs<Database::IdType>(wApp->internalPathNextPart("/release/"));
|
||||
if (!releaseId)
|
||||
return;
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
#include <Wt/WSignal.h>
|
||||
|
||||
#include "database/Types.hpp"
|
||||
|
||||
namespace UserInterface {
|
||||
|
||||
class Filters;
|
||||
@@ -29,11 +31,11 @@ class Release : public Wt::WContainerWidget
|
||||
public:
|
||||
Release(Filters* filters);
|
||||
|
||||
Wt::Signal<Database::id_type> releaseAdd;
|
||||
Wt::Signal<Database::id_type> releasePlay;
|
||||
Wt::Signal<Database::IdType> releaseAdd;
|
||||
Wt::Signal<Database::IdType> releasePlay;
|
||||
|
||||
Wt::Signal<Database::id_type> trackAdd;
|
||||
Wt::Signal<Database::id_type> trackPlay;
|
||||
Wt::Signal<Database::IdType> trackAdd;
|
||||
Wt::Signal<Database::IdType> trackPlay;
|
||||
|
||||
private:
|
||||
void refresh();
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <Wt/WText.h>
|
||||
#include <Wt/WTemplate.h>
|
||||
|
||||
#include "database/Types.hpp"
|
||||
#include "database/Release.hpp"
|
||||
|
||||
#include "utils/Logger.hpp"
|
||||
#include "utils/Utils.hpp"
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#include <Wt/WText.h>
|
||||
#include <Wt/WTemplate.h>
|
||||
|
||||
#include "database/Types.hpp"
|
||||
|
||||
namespace UserInterface {
|
||||
|
||||
class Filters;
|
||||
@@ -33,8 +35,8 @@ class Releases : public Wt::WTemplate
|
||||
public:
|
||||
Releases(Filters* filters);
|
||||
|
||||
Wt::Signal<Database::id_type> releaseAdd;
|
||||
Wt::Signal<Database::id_type> releasePlay;
|
||||
Wt::Signal<Database::IdType> releaseAdd;
|
||||
Wt::Signal<Database::IdType> releasePlay;
|
||||
|
||||
private:
|
||||
void refresh();
|
||||
|
||||
@@ -22,7 +22,9 @@
|
||||
#include <Wt/WLineEdit.h>
|
||||
#include <Wt/WText.h>
|
||||
|
||||
#include "database/Types.hpp"
|
||||
#include "database/DbArtist.hpp"
|
||||
#include "database/Track.hpp"
|
||||
#include "database/Release.hpp"
|
||||
|
||||
#include "utils/Logger.hpp"
|
||||
#include "utils/Utils.hpp"
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
#include <Wt/WLineEdit.h>
|
||||
#include <Wt/WTemplate.h>
|
||||
|
||||
#include "database/Types.hpp"
|
||||
#include "database/Track.hpp"
|
||||
|
||||
namespace UserInterface {
|
||||
|
||||
class Filters;
|
||||
@@ -31,8 +34,8 @@ class Tracks : public Wt::WTemplate
|
||||
public:
|
||||
Tracks(Filters* filters);
|
||||
|
||||
Wt::Signal<Database::id_type> trackAdd;
|
||||
Wt::Signal<Database::id_type> trackPlay;
|
||||
Wt::Signal<Database::IdType> trackAdd;
|
||||
Wt::Signal<Database::IdType> trackPlay;
|
||||
|
||||
Wt::Signal<std::vector<Database::Track::pointer>> tracksAdd;
|
||||
Wt::Signal<std::vector<Database::Track::pointer>> tracksPlay;
|
||||
|
||||
@@ -90,19 +90,19 @@ ImageResource::getDefaultArtistImage(std::size_t size)
|
||||
}
|
||||
|
||||
std::string
|
||||
ImageResource::getReleaseUrl(Database::Release::id_type releaseId, std::size_t size) const
|
||||
ImageResource::getReleaseUrl(Database::IdType releaseId, std::size_t size) const
|
||||
{
|
||||
return url() + "&releaseid=" + std::to_string(releaseId) + "&size=" + std::to_string(size);
|
||||
}
|
||||
|
||||
std::string
|
||||
ImageResource::getTrackUrl(Database::Track::id_type trackId, std::size_t size) const
|
||||
ImageResource::getTrackUrl(Database::IdType trackId, std::size_t size) const
|
||||
{
|
||||
return url() + "&trackid=" + std::to_string(trackId) + "&size=" + std::to_string(size);
|
||||
}
|
||||
|
||||
std::string
|
||||
ImageResource::getArtistUrl(Database::Artist::id_type artistId, std::size_t size) const
|
||||
ImageResource::getArtistUrl(Database::IdType artistId, std::size_t size) const
|
||||
{
|
||||
return url() + "&artistid=" + std::to_string(artistId) + "&size=" + std::to_string(size);
|
||||
}
|
||||
@@ -159,7 +159,7 @@ ImageResource::handleRequest(const Wt::Http::Request& request, Wt::Http::Respons
|
||||
|
||||
if (trackIdStr)
|
||||
{
|
||||
auto trackId = readAs<Database::Track::id_type>(*trackIdStr);
|
||||
auto trackId = readAs<Database::IdType>(*trackIdStr);
|
||||
if (!trackId)
|
||||
return;
|
||||
|
||||
@@ -202,7 +202,7 @@ ImageResource::handleRequest(const Wt::Http::Request& request, Wt::Http::Respons
|
||||
}
|
||||
else if (releaseIdStr)
|
||||
{
|
||||
auto releaseId = readAs<Database::Release::id_type>(*releaseIdStr);
|
||||
auto releaseId = readAs<Database::IdType>(*releaseIdStr);
|
||||
if (!releaseId)
|
||||
return;
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#include <Wt/WResource.h>
|
||||
|
||||
#include "database/DatabaseHandler.hpp"
|
||||
#include "database/Types.hpp"
|
||||
|
||||
#include "image/Image.hpp"
|
||||
|
||||
namespace UserInterface {
|
||||
@@ -38,9 +40,9 @@ class ImageResource : public Wt::WResource
|
||||
ImageResource(Database::Handler& db);
|
||||
~ImageResource();
|
||||
|
||||
std::string getReleaseUrl(Database::Release::id_type releaseId, size_t size) const;
|
||||
std::string getTrackUrl(Database::Track::id_type trackId, size_t size) const;
|
||||
std::string getArtistUrl(Database::Artist::id_type artistId, size_t size) const;
|
||||
std::string getReleaseUrl(Database::IdType releaseId, size_t size) const;
|
||||
std::string getTrackUrl(Database::IdType trackId, size_t size) const;
|
||||
std::string getArtistUrl(Database::IdType artistId, size_t size) const;
|
||||
std::string getUnknownTrackUrl(size_t size) const;
|
||||
|
||||
void handleRequest(const Wt::Http::Request& request, Wt::Http::Response& response);
|
||||
|
||||
@@ -40,7 +40,7 @@ TranscodeResource:: ~TranscodeResource()
|
||||
}
|
||||
|
||||
std::string
|
||||
TranscodeResource::getUrl(Database::Track::id_type trackId, Av::Encoding encoding) const
|
||||
TranscodeResource::getUrl(Database::IdType trackId, Av::Encoding encoding) const
|
||||
{
|
||||
std::string res = url()+ "&trackid=" + std::to_string(trackId) + "&encoding=" + std::to_string(Av::encodingToInt(encoding));
|
||||
|
||||
@@ -64,7 +64,7 @@ TranscodeResource::handleRequest(const Wt::Http::Request& request,
|
||||
}
|
||||
else
|
||||
{
|
||||
Database::Track::id_type trackId;
|
||||
Database::IdType trackId;
|
||||
Av::TranscodeParameters parameters;
|
||||
|
||||
LMS_LOG(UI, DEBUG) << "No continuation yet";
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
#include "av/AvTranscoder.hpp"
|
||||
|
||||
#include "database/DatabaseHandler.hpp"
|
||||
#include "database/Types.hpp"
|
||||
|
||||
|
||||
namespace UserInterface {
|
||||
|
||||
@@ -35,7 +37,7 @@ class TranscodeResource : public Wt::WResource
|
||||
TranscodeResource(Database::Handler& db);
|
||||
~TranscodeResource();
|
||||
|
||||
std::string getUrl(Database::Track::id_type trackId, Av::Encoding encoding) const;
|
||||
std::string getUrl(Database::IdType trackId, Av::Encoding encoding) const;
|
||||
|
||||
void handleRequest(const Wt::Http::Request& request,
|
||||
Wt::Http::Response& response);
|
||||
|
||||
Reference in New Issue
Block a user