WIP, Remote Client/Server, fist working track list

This commit is contained in:
emeric
2014-05-23 14:56:22 +02:00
parent d945f4623f
commit 61341a090a
19 changed files with 932 additions and 587 deletions
+2
View File
@@ -21,6 +21,8 @@
- TrackView : Reselect the current playing song when displaying the updated search results
- ReleaseView: display the release's publication year
- OGG metadata -> properly handle metadata nested in the audio stream
- TrackView : when udating the view, reselect the current playing track
- Filters: use directly the id as constraint, instead of the name?
[Video]
- View the Videos in a WtTableView ?
+26 -12
View File
@@ -21,7 +21,7 @@ class Artist
typedef Wt::Dbo::ptr<Artist> pointer;
typedef Wt::Dbo::dbo_traits<Artist>::IdType id_type;
Artist() {}
Artist(const std::string& p_name);
@@ -59,6 +59,7 @@ class Release
public:
typedef Wt::Dbo::ptr<Release> pointer;
typedef Wt::Dbo::dbo_traits<Release>::IdType id_type;
Release() {}
Release(const std::string& name);
@@ -67,13 +68,15 @@ class Release
static pointer getByName(Wt::Dbo::Session& session, const std::string& name);
static pointer getNone(Wt::Dbo::Session& session);
static Wt::Dbo::collection<pointer> getAll(Wt::Dbo::Session& session, Artist::id_type id, int offset = -1, int size = -1);
static Wt::Dbo::collection<pointer> getAll(Wt::Dbo::Session& session, std::vector<Artist::id_type> artistIds, int offset = -1, int size = -1);
// Create
static pointer create(Wt::Dbo::Session& session, const std::string& name);
std::string getName() const;
std::string getName() const { return _name; }
bool isNone(void) const;
Wt::Dbo::collection<Wt::Dbo::ptr<Track> > getTracks(void) const { return _tracks;}
boost::posix_time::time_duration getDuration(void) const;
template<class Action>
void persist(Action& a)
@@ -95,6 +98,7 @@ class Genre
public:
typedef Wt::Dbo::ptr<Genre> pointer;
typedef Wt::Dbo::dbo_traits<Genre>::IdType id_type;
Genre();
Genre(const std::string& name);
@@ -129,6 +133,7 @@ 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, Artist::pointer artist, Release::pointer release);
@@ -136,6 +141,11 @@ class Track
// Find utilities
static pointer getByPath(Wt::Dbo::Session& session, const boost::filesystem::path& p);
static Wt::Dbo::collection< pointer > getAll(Wt::Dbo::Session& session);
static Wt::Dbo::collection< pointer > getAll(Wt::Dbo::Session& session,
const std::vector<Artist::id_type>& artistIds,
const std::vector<Release::id_type>& releaseIds,
const std::vector<Genre::id_type>& genreIds,
int offset = -1, int size = -1);
// Create utility
static pointer create(Wt::Dbo::Session& session, const boost::filesystem::path& p, Artist::pointer artist, Release::pointer release);
@@ -153,15 +163,19 @@ class Track
void setArtist(Artist::pointer artist) { _artist = artist; }
void setRelease(Release::pointer release) { _release = release; }
std::string getName(void) const { return _name; }
const std::string& getPath(void) const { return _filePath; }
boost::posix_time::time_duration getDuration(void) const { return _duration; }
boost::posix_time::ptime getLastWriteTime(void) const { return _fileLastWrite; }
const std::vector<unsigned char>& getChecksum(void) const { return _fileChecksum; }
Artist::pointer getArtist(void) const { return _artist; }
Release::pointer getRelease(void) const { return _release; }
bool hasGenre(Genre::pointer genre) const { return _genres.count(genre); }
std::vector< Genre::pointer > getGenres(void) const;
int getTrackNumber(void) const { return _trackNumber; }
int getDiscNumber(void) const { return _discNumber; }
std::string getName(void) const { return _name; }
const std::string& getPath(void) const { return _filePath; }
boost::posix_time::time_duration getDuration(void) const { return _duration; }
boost::posix_time::ptime getCreationTime(void) const { return _creationTime; }
Artist::pointer getArtist(void) const { return _artist; }
Release::pointer getRelease(void) const { return _release; }
bool hasGenre(Genre::pointer genre) const { return _genres.count(genre); }
std::vector< Genre::pointer > getGenres(void) const;
boost::posix_time::ptime getLastWriteTime(void) const { return _fileLastWrite; }
const std::vector<unsigned char>& getChecksum(void) const { return _fileChecksum; }
template<class Action>
void persist(Action& a)
+35 -2
View File
@@ -1,5 +1,10 @@
#include <boost/foreach.hpp>
#include "SqlQuery.hpp"
#include "AudioTypes.hpp"
Release::Release(const std::string& name)
: _name(name)
{
@@ -28,8 +33,36 @@ Release::create(Wt::Dbo::Session& session, const std::string& name)
}
Wt::Dbo::collection<Release::pointer>
Release::getAll(Wt::Dbo::Session& session, Artist::id_type id, int offset, int size)
Release::getAll(Wt::Dbo::Session& session, std::vector<Artist::id_type> artistIds, int offset, int size)
{
return session.query<Release::pointer>("select * from Release INNER JOIN Release.id = Artist.id").where("artist.id = ?").bind(id);
std::string sqlQuery = "SELECT r FROM release r";
if (!artistIds.empty())
{
sqlQuery += " INNER JOIN artist a ON a.id = t.artist_id";
sqlQuery += " INNER JOIN track t ON t.release_id = r.id";
}
Wt::Dbo::Query<Release::pointer> query = session.query<Release::pointer>( sqlQuery ).offset(offset).limit(size);
BOOST_FOREACH(const Artist::id_type artistId, artistIds)
query.where("a.id = ?").bind(artistId);
query.groupBy("r");
return query;
}
boost::posix_time::time_duration
Release::getDuration(void) const
{
typedef Wt::Dbo::collection< Wt::Dbo::ptr<Track> > Tracks;
boost::posix_time::time_duration res;
for (Tracks::const_iterator it = _tracks.begin(); it != _tracks.end(); ++it)
res += (*it)->getDuration();
return res;
}
+47 -10
View File
@@ -59,24 +59,54 @@ WhereClause::bind(const std::string& bindArg)
return *this;
}
SelectStatement&
SelectStatement::And(const SelectStatement& statement)
InnerJoinClause::InnerJoinClause(const std::string& clause)
:_clause(clause)
{
if( _statement.empty() && !statement._statement.empty())
_statement = "SELECT ";
else if (!_statement.empty() && !statement._statement.empty())
_statement += ",";
}
InnerJoinClause&
InnerJoinClause::And(const InnerJoinClause& clause)
{
if (!_clause.empty())
_clause += " ";
_clause += clause._clause;
_statement += statement._statement;
return *this;
}
FromClause::FromClause(const std::string& clause)
SelectStatement::SelectStatement(const std::string& statement)
{
_clause.push_back(clause);
And(statement);
}
SelectStatement&
SelectStatement::And(const std::string& statement)
{
_statement.push_back(statement);
_statement.sort();
_statement.unique();
return *this;
}
std::string
SelectStatement::get() const
{
std::string res = "SELECT ";
for (std::list<std::string>::const_iterator it = _statement.begin(); it != _statement.end(); ++it)
{
if (it != _statement.begin())
res += ",";
res += *it;
}
return res;
}
GroupByStatement&
GroupByStatement::And(const GroupByStatement& statement)
@@ -90,6 +120,10 @@ GroupByStatement::And(const GroupByStatement& statement)
return *this;
}
FromClause::FromClause(const std::string& clause)
{
_clause.push_back(clause);
}
FromClause&
FromClause::And(const FromClause& clause)
@@ -133,6 +167,9 @@ SqlQuery::get(void) const
if (!_fromClause.get().empty())
oss << " " << _fromClause.get();
if (!_innerJoinClause.get().empty())
oss << " " << _innerJoinClause.get();
if (!_whereClause.get().empty())
oss << " " << _whereClause.get();
+24 -5
View File
@@ -28,6 +28,21 @@ class WhereClause
};
class InnerJoinClause
{
public:
InnerJoinClause() {}
InnerJoinClause(const std::string& clause);
InnerJoinClause& And(const InnerJoinClause& clause);
std::string get() const { return _clause;}
private:
std::string _clause;
};
class GroupByStatement
{
public:
@@ -46,16 +61,16 @@ class GroupByStatement
class SelectStatement
{
public:
SelectStatement() {}
SelectStatement(const std::string& statement) { _statement = statement; }
SelectStatement() {};
SelectStatement(const std::string& item);
SelectStatement& And(const SelectStatement& statement);
SelectStatement& And(const std::string& item);
std::string get() const {return _statement;}
std::string get() const;
private:
std::string _statement; // SELECT statement
std::list<std::string> _statement;
};
class FromClause
@@ -80,7 +95,10 @@ class SqlQuery
public:
SelectStatement& select(void) { return _selectStatement;}
SelectStatement& select(const std::string& statement) { _selectStatement = SelectStatement(statement); return _selectStatement; }
FromClause& from(void) { return _fromClause; }
FromClause& from(const std::string& clause) { _whereClause = WhereClause(clause); return _fromClause; }
InnerJoinClause& innerJoin(void) { return _innerJoinClause; }
WhereClause& where(void) { return _whereClause; }
const WhereClause& where(void) const { return _whereClause; }
GroupByStatement& groupBy(void) { return _groupByStatement; }
@@ -91,6 +109,7 @@ class SqlQuery
private:
SelectStatement _selectStatement; // SELECT statement
InnerJoinClause _innerJoinClause; // INNER JOIN
FromClause _fromClause; // FROM tables
WhereClause _whereClause; // WHERE clause
GroupByStatement _groupByStatement; // GROUP BY statement
+74
View File
@@ -1,5 +1,7 @@
#include <boost/foreach.hpp>
#include "SqlQuery.hpp"
#include "AudioTypes.hpp"
@@ -53,3 +55,75 @@ Track::getGenres(void) const
std::copy(_genres.begin(), _genres.end(), std::back_inserter(genres));
return genres;
}
Wt::Dbo::collection< Track::pointer >
Track::getAll(Wt::Dbo::Session& session,
const std::vector<Artist::id_type>& artistIds,
const std::vector<Release::id_type>& releaseIds,
const std::vector<Genre::id_type>& genreIds,
int offset, int size)
{
std::string sqlQuery = "SELECT t FROM track t";
if (!artistIds.empty())
sqlQuery += " INNER JOIN artist a ON a.id = t.artist_id";
if (!releaseIds.empty())
sqlQuery += " INNER JOIN release r ON r.id = t.release_id";
if (!genreIds.empty())
{
sqlQuery += " INNER JOIN genre g ON g.id = t_g.genre_id";
sqlQuery += " INNER JOIN track_genre t_g ON t_g.track_id = t.id AND t_d.genre_id = g.id";
}
WhereClause where;
{
WhereClause artistWhere;
for (std::size_t i = 0; i < artistIds.size(); ++i)
artistWhere.Or( WhereClause("a.id = ?") );
where.And(artistWhere);
}
{
WhereClause releaseWhere;
for (std::size_t i = 0; i < releaseIds.size(); ++i)
releaseWhere.Or( WhereClause("r.id = ?") );
where.And(releaseWhere);
}
{
WhereClause genreWhere;
for (std::size_t i = 0; i < genreIds.size(); ++i)
genreWhere.Or( WhereClause("g.id = ?") );
where.And(genreWhere);
}
Wt::Dbo::Query<Track::pointer> query = session.query<Track::pointer>( sqlQuery + " " + where.get() ).offset(offset).limit(size);
BOOST_FOREACH(const Artist::id_type artistId, artistIds)
query.bind(artistId);
BOOST_FOREACH(const Release::id_type releaseId, releaseIds)
query.bind(releaseId);
BOOST_FOREACH(const Genre::id_type genreId, genreIds)
query.bind(genreId);
query.groupBy("t");
return query;
}
+194 -227
View File
@@ -336,15 +336,15 @@ void protobuf_AssignDesc_collection_2eproto() {
AudioCollectionResponse_Track_descriptor_ = AudioCollectionResponse_descriptor_->nested_type(8);
static const int AudioCollectionResponse_Track_offsets_[11] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AudioCollectionResponse_Track, id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AudioCollectionResponse_Track, artist_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AudioCollectionResponse_Track, release_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AudioCollectionResponse_Track, genre_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AudioCollectionResponse_Track, disc_number_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AudioCollectionResponse_Track, track_number_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AudioCollectionResponse_Track, artist_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AudioCollectionResponse_Track, release_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AudioCollectionResponse_Track, name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AudioCollectionResponse_Track, duration_secs_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AudioCollectionResponse_Track, release_date_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AudioCollectionResponse_Track, original_release_date_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AudioCollectionResponse_Track, genres_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AudioCollectionResponse_Track, coverart_),
};
AudioCollectionResponse_Track_reflection_ =
@@ -476,7 +476,7 @@ void protobuf_AddDesc_collection_2eproto() {
"nRequest.BatchParameter\"a\n\004Type\022\024\n\020TypeG"
"etGenreList\020\001\022\025\n\021TypeGetArtistList\020\002\022\026\n\022"
"TypeGetReleaseList\020\003\022\024\n\020TypeGetTrackList"
"\020\004\"\365\t\n\027AudioCollectionResponse\0222\n\004type\030\001"
"\020\004\"\375\t\n\027AudioCollectionResponse\0222\n\004type\030\001"
" \001(\0162$.Remote.AudioCollectionResponse.Ty"
"pe\022\034\n\005error\030\002 \001(\0132\r.Remote.Error\022=\n\ngenr"
"e_list\030\003 \001(\0132).Remote.AudioCollectionRes"
@@ -499,15 +499,16 @@ void protobuf_AddDesc_collection_2eproto() {
"\022\n\n\002id\030\001 \002(\004\022\014\n\004name\030\002 \002(\t\022\021\n\tnb_tracks\030"
"\003 \002(\r\022\025\n\rduration_secs\030\004 \002(\r\022\024\n\014release_"
"date\030\005 \001(\t\022:\n\010coverArt\030\006 \001(\0132(.Remote.Au"
"dioCollectionResponse.CoverArt\032\333\001\n\005Track"
"\022\n\n\002id\030\001 \002(\004\022\023\n\013disc_number\030\002 \001(\r\022\024\n\014tra"
"ck_number\030\003 \001(\r\022\016\n\006artist\030\004 \001(\t\022\017\n\007relea"
"se\030\005 \001(\t\022\014\n\004name\030\006 \002(\t\022\025\n\rduration_secs\030"
"\007 \002(\r\022\024\n\014release_date\030\010 \001(\t\022\035\n\025original_"
"release_date\030\t \001(\t\022\016\n\006genres\030\n \003(\t\022\020\n\010co"
"verArt\030\013 \001(\014\"d\n\004Type\022\r\n\tTypeError\020\001\022\021\n\rT"
"ypeGenreList\020\002\022\022\n\016TypeArtistList\020\003\022\023\n\017Ty"
"peReleaseList\020\004\022\021\n\rTypeTrackList\020\005", 2314);
"dioCollectionResponse.CoverArt\032\343\001\n\005Track"
"\022\n\n\002id\030\001 \002(\004\022\021\n\tartist_id\030\002 \002(\004\022\022\n\nrelea"
"se_id\030\003 \002(\004\022\020\n\010genre_id\030\004 \003(\004\022\023\n\013disc_nu"
"mber\030\005 \001(\r\022\024\n\014track_number\030\006 \001(\r\022\014\n\004name"
"\030\007 \002(\t\022\025\n\rduration_secs\030\010 \002(\r\022\024\n\014release"
"_date\030\t \001(\t\022\035\n\025original_release_date\030\n \001"
"(\t\022\020\n\010coverArt\030\013 \001(\014\"d\n\004Type\022\r\n\tTypeErro"
"r\020\001\022\021\n\rTypeGenreList\020\002\022\022\n\016TypeArtistList"
"\020\003\022\023\n\017TypeReleaseList\020\004\022\021\n\rTypeTrackList"
"\020\005", 2322);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"collection.proto", &protobuf_RegisterTypes);
AudioCollectionRequest::default_instance_ = new AudioCollectionRequest();
@@ -4606,15 +4607,15 @@ void AudioCollectionResponse_Release::Swap(AudioCollectionResponse_Release* othe
#ifndef _MSC_VER
const int AudioCollectionResponse_Track::kIdFieldNumber;
const int AudioCollectionResponse_Track::kArtistIdFieldNumber;
const int AudioCollectionResponse_Track::kReleaseIdFieldNumber;
const int AudioCollectionResponse_Track::kGenreIdFieldNumber;
const int AudioCollectionResponse_Track::kDiscNumberFieldNumber;
const int AudioCollectionResponse_Track::kTrackNumberFieldNumber;
const int AudioCollectionResponse_Track::kArtistFieldNumber;
const int AudioCollectionResponse_Track::kReleaseFieldNumber;
const int AudioCollectionResponse_Track::kNameFieldNumber;
const int AudioCollectionResponse_Track::kDurationSecsFieldNumber;
const int AudioCollectionResponse_Track::kReleaseDateFieldNumber;
const int AudioCollectionResponse_Track::kOriginalReleaseDateFieldNumber;
const int AudioCollectionResponse_Track::kGenresFieldNumber;
const int AudioCollectionResponse_Track::kCoverArtFieldNumber;
#endif // !_MSC_VER
@@ -4635,10 +4636,10 @@ AudioCollectionResponse_Track::AudioCollectionResponse_Track(const AudioCollecti
void AudioCollectionResponse_Track::SharedCtor() {
_cached_size_ = 0;
id_ = GOOGLE_ULONGLONG(0);
artist_id_ = GOOGLE_ULONGLONG(0);
release_id_ = GOOGLE_ULONGLONG(0);
disc_number_ = 0u;
track_number_ = 0u;
artist_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
release_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
duration_secs_ = 0u;
release_date_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
@@ -4652,12 +4653,6 @@ AudioCollectionResponse_Track::~AudioCollectionResponse_Track() {
}
void AudioCollectionResponse_Track::SharedDtor() {
if (artist_ != &::google::protobuf::internal::kEmptyString) {
delete artist_;
}
if (release_ != &::google::protobuf::internal::kEmptyString) {
delete release_;
}
if (name_ != &::google::protobuf::internal::kEmptyString) {
delete name_;
}
@@ -4698,31 +4693,23 @@ AudioCollectionResponse_Track* AudioCollectionResponse_Track::New() const {
void AudioCollectionResponse_Track::Clear() {
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
id_ = GOOGLE_ULONGLONG(0);
artist_id_ = GOOGLE_ULONGLONG(0);
release_id_ = GOOGLE_ULONGLONG(0);
disc_number_ = 0u;
track_number_ = 0u;
if (has_artist()) {
if (artist_ != &::google::protobuf::internal::kEmptyString) {
artist_->clear();
}
}
if (has_release()) {
if (release_ != &::google::protobuf::internal::kEmptyString) {
release_->clear();
}
}
if (has_name()) {
if (name_ != &::google::protobuf::internal::kEmptyString) {
name_->clear();
}
}
duration_secs_ = 0u;
}
if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) {
if (has_release_date()) {
if (release_date_ != &::google::protobuf::internal::kEmptyString) {
release_date_->clear();
}
}
}
if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) {
if (has_original_release_date()) {
if (original_release_date_ != &::google::protobuf::internal::kEmptyString) {
original_release_date_->clear();
@@ -4734,7 +4721,7 @@ void AudioCollectionResponse_Track::Clear() {
}
}
}
genres_.Clear();
genre_id_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
@@ -4756,12 +4743,66 @@ bool AudioCollectionResponse_Track::MergePartialFromCodedStream(
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(16)) goto parse_disc_number;
if (input->ExpectTag(16)) goto parse_artist_id;
break;
}
// optional uint32 disc_number = 2;
// required uint64 artist_id = 2;
case 2: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_artist_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &artist_id_)));
set_has_artist_id();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(24)) goto parse_release_id;
break;
}
// required uint64 release_id = 3;
case 3: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_release_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &release_id_)));
set_has_release_id();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(32)) goto parse_genre_id;
break;
}
// repeated uint64 genre_id = 4;
case 4: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_genre_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
1, 32, input, this->mutable_genre_id())));
} else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag)
== ::google::protobuf::internal::WireFormatLite::
WIRETYPE_LENGTH_DELIMITED) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitiveNoInline<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, this->mutable_genre_id())));
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(32)) goto parse_genre_id;
if (input->ExpectTag(40)) goto parse_disc_number;
break;
}
// optional uint32 disc_number = 5;
case 5: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_disc_number:
@@ -4772,12 +4813,12 @@ bool AudioCollectionResponse_Track::MergePartialFromCodedStream(
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(24)) goto parse_track_number;
if (input->ExpectTag(48)) goto parse_track_number;
break;
}
// optional uint32 track_number = 3;
case 3: {
// optional uint32 track_number = 6;
case 6: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_track_number:
@@ -4788,46 +4829,12 @@ bool AudioCollectionResponse_Track::MergePartialFromCodedStream(
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(34)) goto parse_artist;
if (input->ExpectTag(58)) goto parse_name;
break;
}
// optional string artist = 4;
case 4: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_artist:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_artist()));
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->artist().data(), this->artist().length(),
::google::protobuf::internal::WireFormat::PARSE);
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(42)) goto parse_release;
break;
}
// optional string release = 5;
case 5: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_release:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_release()));
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->release().data(), this->release().length(),
::google::protobuf::internal::WireFormat::PARSE);
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(50)) goto parse_name;
break;
}
// required string name = 6;
case 6: {
// required string name = 7;
case 7: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_name:
@@ -4839,12 +4846,12 @@ bool AudioCollectionResponse_Track::MergePartialFromCodedStream(
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(56)) goto parse_duration_secs;
if (input->ExpectTag(64)) goto parse_duration_secs;
break;
}
// required uint32 duration_secs = 7;
case 7: {
// required uint32 duration_secs = 8;
case 8: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_duration_secs:
@@ -4855,12 +4862,12 @@ bool AudioCollectionResponse_Track::MergePartialFromCodedStream(
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(66)) goto parse_release_date;
if (input->ExpectTag(74)) goto parse_release_date;
break;
}
// optional string release_date = 8;
case 8: {
// optional string release_date = 9;
case 9: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_release_date:
@@ -4872,12 +4879,12 @@ bool AudioCollectionResponse_Track::MergePartialFromCodedStream(
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(74)) goto parse_original_release_date;
if (input->ExpectTag(82)) goto parse_original_release_date;
break;
}
// optional string original_release_date = 9;
case 9: {
// optional string original_release_date = 10;
case 10: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_original_release_date:
@@ -4889,25 +4896,6 @@ bool AudioCollectionResponse_Track::MergePartialFromCodedStream(
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(82)) goto parse_genres;
break;
}
// repeated string genres = 10;
case 10: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_genres:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->add_genres()));
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->genres(this->genres_size() - 1).data(),
this->genres(this->genres_size() - 1).length(),
::google::protobuf::internal::WireFormat::PARSE);
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(82)) goto parse_genres;
if (input->ExpectTag(90)) goto parse_coverArt;
break;
}
@@ -4949,73 +4937,62 @@ void AudioCollectionResponse_Track::SerializeWithCachedSizes(
::google::protobuf::internal::WireFormatLite::WriteUInt64(1, this->id(), output);
}
// optional uint32 disc_number = 2;
// required uint64 artist_id = 2;
if (has_artist_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(2, this->artist_id(), output);
}
// required uint64 release_id = 3;
if (has_release_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(3, this->release_id(), output);
}
// repeated uint64 genre_id = 4;
for (int i = 0; i < this->genre_id_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(
4, this->genre_id(i), output);
}
// optional uint32 disc_number = 5;
if (has_disc_number()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->disc_number(), output);
::google::protobuf::internal::WireFormatLite::WriteUInt32(5, this->disc_number(), output);
}
// optional uint32 track_number = 3;
// optional uint32 track_number = 6;
if (has_track_number()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(3, this->track_number(), output);
::google::protobuf::internal::WireFormatLite::WriteUInt32(6, this->track_number(), output);
}
// optional string artist = 4;
if (has_artist()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->artist().data(), this->artist().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
::google::protobuf::internal::WireFormatLite::WriteString(
4, this->artist(), output);
}
// optional string release = 5;
if (has_release()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->release().data(), this->release().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
::google::protobuf::internal::WireFormatLite::WriteString(
5, this->release(), output);
}
// required string name = 6;
// required string name = 7;
if (has_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
::google::protobuf::internal::WireFormatLite::WriteString(
6, this->name(), output);
7, this->name(), output);
}
// required uint32 duration_secs = 7;
// required uint32 duration_secs = 8;
if (has_duration_secs()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(7, this->duration_secs(), output);
::google::protobuf::internal::WireFormatLite::WriteUInt32(8, this->duration_secs(), output);
}
// optional string release_date = 8;
// optional string release_date = 9;
if (has_release_date()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->release_date().data(), this->release_date().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
::google::protobuf::internal::WireFormatLite::WriteString(
8, this->release_date(), output);
9, this->release_date(), output);
}
// optional string original_release_date = 9;
// optional string original_release_date = 10;
if (has_original_release_date()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->original_release_date().data(), this->original_release_date().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
::google::protobuf::internal::WireFormatLite::WriteString(
9, this->original_release_date(), output);
}
// repeated string genres = 10;
for (int i = 0; i < this->genres_size(); i++) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->genres(i).data(), this->genres(i).length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
::google::protobuf::internal::WireFormatLite::WriteString(
10, this->genres(i), output);
10, this->original_release_date(), output);
}
// optional bytes coverArt = 11;
@@ -5037,78 +5014,65 @@ void AudioCollectionResponse_Track::SerializeWithCachedSizes(
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(1, this->id(), target);
}
// optional uint32 disc_number = 2;
// required uint64 artist_id = 2;
if (has_artist_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(2, this->artist_id(), target);
}
// required uint64 release_id = 3;
if (has_release_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(3, this->release_id(), target);
}
// repeated uint64 genre_id = 4;
for (int i = 0; i < this->genre_id_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteUInt64ToArray(4, this->genre_id(i), target);
}
// optional uint32 disc_number = 5;
if (has_disc_number()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->disc_number(), target);
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(5, this->disc_number(), target);
}
// optional uint32 track_number = 3;
// optional uint32 track_number = 6;
if (has_track_number()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(3, this->track_number(), target);
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(6, this->track_number(), target);
}
// optional string artist = 4;
if (has_artist()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->artist().data(), this->artist().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
4, this->artist(), target);
}
// optional string release = 5;
if (has_release()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->release().data(), this->release().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
5, this->release(), target);
}
// required string name = 6;
// required string name = 7;
if (has_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
6, this->name(), target);
7, this->name(), target);
}
// required uint32 duration_secs = 7;
// required uint32 duration_secs = 8;
if (has_duration_secs()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(7, this->duration_secs(), target);
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(8, this->duration_secs(), target);
}
// optional string release_date = 8;
// optional string release_date = 9;
if (has_release_date()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->release_date().data(), this->release_date().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
8, this->release_date(), target);
9, this->release_date(), target);
}
// optional string original_release_date = 9;
// optional string original_release_date = 10;
if (has_original_release_date()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->original_release_date().data(), this->original_release_date().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
9, this->original_release_date(), target);
}
// repeated string genres = 10;
for (int i = 0; i < this->genres_size(); i++) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->genres(i).data(), this->genres(i).length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
target = ::google::protobuf::internal::WireFormatLite::
WriteStringToArray(10, this->genres(i), target);
10, this->original_release_date(), target);
}
// optional bytes coverArt = 11;
@@ -5136,58 +5100,58 @@ int AudioCollectionResponse_Track::ByteSize() const {
this->id());
}
// optional uint32 disc_number = 2;
// required uint64 artist_id = 2;
if (has_artist_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->artist_id());
}
// required uint64 release_id = 3;
if (has_release_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->release_id());
}
// optional uint32 disc_number = 5;
if (has_disc_number()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->disc_number());
}
// optional uint32 track_number = 3;
// optional uint32 track_number = 6;
if (has_track_number()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->track_number());
}
// optional string artist = 4;
if (has_artist()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->artist());
}
// optional string release = 5;
if (has_release()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->release());
}
// required string name = 6;
// required string name = 7;
if (has_name()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->name());
}
// required uint32 duration_secs = 7;
// required uint32 duration_secs = 8;
if (has_duration_secs()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->duration_secs());
}
// optional string release_date = 8;
}
if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) {
// optional string release_date = 9;
if (has_release_date()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->release_date());
}
}
if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) {
// optional string original_release_date = 9;
// optional string original_release_date = 10;
if (has_original_release_date()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
@@ -5202,11 +5166,14 @@ int AudioCollectionResponse_Track::ByteSize() const {
}
}
// repeated string genres = 10;
total_size += 1 * this->genres_size();
for (int i = 0; i < this->genres_size(); i++) {
total_size += ::google::protobuf::internal::WireFormatLite::StringSize(
this->genres(i));
// repeated uint64 genre_id = 4;
{
int data_size = 0;
for (int i = 0; i < this->genre_id_size(); i++) {
data_size += ::google::protobuf::internal::WireFormatLite::
UInt64Size(this->genre_id(i));
}
total_size += 1 * this->genre_id_size() + data_size;
}
if (!unknown_fields().empty()) {
@@ -5234,34 +5201,34 @@ void AudioCollectionResponse_Track::MergeFrom(const ::google::protobuf::Message&
void AudioCollectionResponse_Track::MergeFrom(const AudioCollectionResponse_Track& from) {
GOOGLE_CHECK_NE(&from, this);
genres_.MergeFrom(from.genres_);
genre_id_.MergeFrom(from.genre_id_);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_id()) {
set_id(from.id());
}
if (from.has_artist_id()) {
set_artist_id(from.artist_id());
}
if (from.has_release_id()) {
set_release_id(from.release_id());
}
if (from.has_disc_number()) {
set_disc_number(from.disc_number());
}
if (from.has_track_number()) {
set_track_number(from.track_number());
}
if (from.has_artist()) {
set_artist(from.artist());
}
if (from.has_release()) {
set_release(from.release());
}
if (from.has_name()) {
set_name(from.name());
}
if (from.has_duration_secs()) {
set_duration_secs(from.duration_secs());
}
}
if (from._has_bits_[8 / 32] & (0xffu << (8 % 32))) {
if (from.has_release_date()) {
set_release_date(from.release_date());
}
}
if (from._has_bits_[8 / 32] & (0xffu << (8 % 32))) {
if (from.has_original_release_date()) {
set_original_release_date(from.original_release_date());
}
@@ -5285,7 +5252,7 @@ void AudioCollectionResponse_Track::CopyFrom(const AudioCollectionResponse_Track
}
bool AudioCollectionResponse_Track::IsInitialized() const {
if ((_has_bits_[0] & 0x00000061) != 0x00000061) return false;
if ((_has_bits_[0] & 0x000000c7) != 0x000000c7) return false;
return true;
}
@@ -5293,15 +5260,15 @@ bool AudioCollectionResponse_Track::IsInitialized() const {
void AudioCollectionResponse_Track::Swap(AudioCollectionResponse_Track* other) {
if (other != this) {
std::swap(id_, other->id_);
std::swap(artist_id_, other->artist_id_);
std::swap(release_id_, other->release_id_);
genre_id_.Swap(&other->genre_id_);
std::swap(disc_number_, other->disc_number_);
std::swap(track_number_, other->track_number_);
std::swap(artist_, other->artist_);
std::swap(release_, other->release_);
std::swap(name_, other->name_);
std::swap(duration_secs_, other->duration_secs_);
std::swap(release_date_, other->release_date_);
std::swap(original_release_date_, other->original_release_date_);
genres_.Swap(&other->genres_);
std::swap(coverart_, other->coverart_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
+138 -267
View File
@@ -1638,48 +1638,50 @@ class AudioCollectionResponse_Track : public ::google::protobuf::Message {
inline ::google::protobuf::uint64 id() const;
inline void set_id(::google::protobuf::uint64 value);
// optional uint32 disc_number = 2;
// required uint64 artist_id = 2;
inline bool has_artist_id() const;
inline void clear_artist_id();
static const int kArtistIdFieldNumber = 2;
inline ::google::protobuf::uint64 artist_id() const;
inline void set_artist_id(::google::protobuf::uint64 value);
// required uint64 release_id = 3;
inline bool has_release_id() const;
inline void clear_release_id();
static const int kReleaseIdFieldNumber = 3;
inline ::google::protobuf::uint64 release_id() const;
inline void set_release_id(::google::protobuf::uint64 value);
// repeated uint64 genre_id = 4;
inline int genre_id_size() const;
inline void clear_genre_id();
static const int kGenreIdFieldNumber = 4;
inline ::google::protobuf::uint64 genre_id(int index) const;
inline void set_genre_id(int index, ::google::protobuf::uint64 value);
inline void add_genre_id(::google::protobuf::uint64 value);
inline const ::google::protobuf::RepeatedField< ::google::protobuf::uint64 >&
genre_id() const;
inline ::google::protobuf::RepeatedField< ::google::protobuf::uint64 >*
mutable_genre_id();
// optional uint32 disc_number = 5;
inline bool has_disc_number() const;
inline void clear_disc_number();
static const int kDiscNumberFieldNumber = 2;
static const int kDiscNumberFieldNumber = 5;
inline ::google::protobuf::uint32 disc_number() const;
inline void set_disc_number(::google::protobuf::uint32 value);
// optional uint32 track_number = 3;
// optional uint32 track_number = 6;
inline bool has_track_number() const;
inline void clear_track_number();
static const int kTrackNumberFieldNumber = 3;
static const int kTrackNumberFieldNumber = 6;
inline ::google::protobuf::uint32 track_number() const;
inline void set_track_number(::google::protobuf::uint32 value);
// optional string artist = 4;
inline bool has_artist() const;
inline void clear_artist();
static const int kArtistFieldNumber = 4;
inline const ::std::string& artist() const;
inline void set_artist(const ::std::string& value);
inline void set_artist(const char* value);
inline void set_artist(const char* value, size_t size);
inline ::std::string* mutable_artist();
inline ::std::string* release_artist();
inline void set_allocated_artist(::std::string* artist);
// optional string release = 5;
inline bool has_release() const;
inline void clear_release();
static const int kReleaseFieldNumber = 5;
inline const ::std::string& release() const;
inline void set_release(const ::std::string& value);
inline void set_release(const char* value);
inline void set_release(const char* value, size_t size);
inline ::std::string* mutable_release();
inline ::std::string* release_release();
inline void set_allocated_release(::std::string* release);
// required string name = 6;
// required string name = 7;
inline bool has_name() const;
inline void clear_name();
static const int kNameFieldNumber = 6;
static const int kNameFieldNumber = 7;
inline const ::std::string& name() const;
inline void set_name(const ::std::string& value);
inline void set_name(const char* value);
@@ -1688,17 +1690,17 @@ class AudioCollectionResponse_Track : public ::google::protobuf::Message {
inline ::std::string* release_name();
inline void set_allocated_name(::std::string* name);
// required uint32 duration_secs = 7;
// required uint32 duration_secs = 8;
inline bool has_duration_secs() const;
inline void clear_duration_secs();
static const int kDurationSecsFieldNumber = 7;
static const int kDurationSecsFieldNumber = 8;
inline ::google::protobuf::uint32 duration_secs() const;
inline void set_duration_secs(::google::protobuf::uint32 value);
// optional string release_date = 8;
// optional string release_date = 9;
inline bool has_release_date() const;
inline void clear_release_date();
static const int kReleaseDateFieldNumber = 8;
static const int kReleaseDateFieldNumber = 9;
inline const ::std::string& release_date() const;
inline void set_release_date(const ::std::string& value);
inline void set_release_date(const char* value);
@@ -1707,10 +1709,10 @@ class AudioCollectionResponse_Track : public ::google::protobuf::Message {
inline ::std::string* release_release_date();
inline void set_allocated_release_date(::std::string* release_date);
// optional string original_release_date = 9;
// optional string original_release_date = 10;
inline bool has_original_release_date() const;
inline void clear_original_release_date();
static const int kOriginalReleaseDateFieldNumber = 9;
static const int kOriginalReleaseDateFieldNumber = 10;
inline const ::std::string& original_release_date() const;
inline void set_original_release_date(const ::std::string& value);
inline void set_original_release_date(const char* value);
@@ -1719,22 +1721,6 @@ class AudioCollectionResponse_Track : public ::google::protobuf::Message {
inline ::std::string* release_original_release_date();
inline void set_allocated_original_release_date(::std::string* original_release_date);
// repeated string genres = 10;
inline int genres_size() const;
inline void clear_genres();
static const int kGenresFieldNumber = 10;
inline const ::std::string& genres(int index) const;
inline ::std::string* mutable_genres(int index);
inline void set_genres(int index, const ::std::string& value);
inline void set_genres(int index, const char* value);
inline void set_genres(int index, const char* value, size_t size);
inline ::std::string* add_genres();
inline void add_genres(const ::std::string& value);
inline void add_genres(const char* value);
inline void add_genres(const char* value, size_t size);
inline const ::google::protobuf::RepeatedPtrField< ::std::string>& genres() const;
inline ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_genres();
// optional bytes coverArt = 11;
inline bool has_coverart() const;
inline void clear_coverart();
@@ -1751,14 +1737,14 @@ class AudioCollectionResponse_Track : public ::google::protobuf::Message {
private:
inline void set_has_id();
inline void clear_has_id();
inline void set_has_artist_id();
inline void clear_has_artist_id();
inline void set_has_release_id();
inline void clear_has_release_id();
inline void set_has_disc_number();
inline void clear_has_disc_number();
inline void set_has_track_number();
inline void clear_has_track_number();
inline void set_has_artist();
inline void clear_has_artist();
inline void set_has_release();
inline void clear_has_release();
inline void set_has_name();
inline void clear_has_name();
inline void set_has_duration_secs();
@@ -1773,14 +1759,14 @@ class AudioCollectionResponse_Track : public ::google::protobuf::Message {
::google::protobuf::UnknownFieldSet _unknown_fields_;
::google::protobuf::uint64 id_;
::google::protobuf::uint64 artist_id_;
::google::protobuf::uint64 release_id_;
::google::protobuf::RepeatedField< ::google::protobuf::uint64 > genre_id_;
::google::protobuf::uint32 disc_number_;
::google::protobuf::uint32 track_number_;
::std::string* artist_;
::std::string* release_;
::std::string* name_;
::std::string* release_date_;
::std::string* original_release_date_;
::google::protobuf::RepeatedPtrField< ::std::string> genres_;
::std::string* coverart_;
::google::protobuf::uint32 duration_secs_;
@@ -3287,16 +3273,85 @@ inline void AudioCollectionResponse_Track::set_id(::google::protobuf::uint64 val
id_ = value;
}
// optional uint32 disc_number = 2;
inline bool AudioCollectionResponse_Track::has_disc_number() const {
// required uint64 artist_id = 2;
inline bool AudioCollectionResponse_Track::has_artist_id() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
inline void AudioCollectionResponse_Track::set_has_disc_number() {
inline void AudioCollectionResponse_Track::set_has_artist_id() {
_has_bits_[0] |= 0x00000002u;
}
inline void AudioCollectionResponse_Track::clear_has_disc_number() {
inline void AudioCollectionResponse_Track::clear_has_artist_id() {
_has_bits_[0] &= ~0x00000002u;
}
inline void AudioCollectionResponse_Track::clear_artist_id() {
artist_id_ = GOOGLE_ULONGLONG(0);
clear_has_artist_id();
}
inline ::google::protobuf::uint64 AudioCollectionResponse_Track::artist_id() const {
return artist_id_;
}
inline void AudioCollectionResponse_Track::set_artist_id(::google::protobuf::uint64 value) {
set_has_artist_id();
artist_id_ = value;
}
// required uint64 release_id = 3;
inline bool AudioCollectionResponse_Track::has_release_id() const {
return (_has_bits_[0] & 0x00000004u) != 0;
}
inline void AudioCollectionResponse_Track::set_has_release_id() {
_has_bits_[0] |= 0x00000004u;
}
inline void AudioCollectionResponse_Track::clear_has_release_id() {
_has_bits_[0] &= ~0x00000004u;
}
inline void AudioCollectionResponse_Track::clear_release_id() {
release_id_ = GOOGLE_ULONGLONG(0);
clear_has_release_id();
}
inline ::google::protobuf::uint64 AudioCollectionResponse_Track::release_id() const {
return release_id_;
}
inline void AudioCollectionResponse_Track::set_release_id(::google::protobuf::uint64 value) {
set_has_release_id();
release_id_ = value;
}
// repeated uint64 genre_id = 4;
inline int AudioCollectionResponse_Track::genre_id_size() const {
return genre_id_.size();
}
inline void AudioCollectionResponse_Track::clear_genre_id() {
genre_id_.Clear();
}
inline ::google::protobuf::uint64 AudioCollectionResponse_Track::genre_id(int index) const {
return genre_id_.Get(index);
}
inline void AudioCollectionResponse_Track::set_genre_id(int index, ::google::protobuf::uint64 value) {
genre_id_.Set(index, value);
}
inline void AudioCollectionResponse_Track::add_genre_id(::google::protobuf::uint64 value) {
genre_id_.Add(value);
}
inline const ::google::protobuf::RepeatedField< ::google::protobuf::uint64 >&
AudioCollectionResponse_Track::genre_id() const {
return genre_id_;
}
inline ::google::protobuf::RepeatedField< ::google::protobuf::uint64 >*
AudioCollectionResponse_Track::mutable_genre_id() {
return &genre_id_;
}
// optional uint32 disc_number = 5;
inline bool AudioCollectionResponse_Track::has_disc_number() const {
return (_has_bits_[0] & 0x00000010u) != 0;
}
inline void AudioCollectionResponse_Track::set_has_disc_number() {
_has_bits_[0] |= 0x00000010u;
}
inline void AudioCollectionResponse_Track::clear_has_disc_number() {
_has_bits_[0] &= ~0x00000010u;
}
inline void AudioCollectionResponse_Track::clear_disc_number() {
disc_number_ = 0u;
clear_has_disc_number();
@@ -3309,15 +3364,15 @@ inline void AudioCollectionResponse_Track::set_disc_number(::google::protobuf::u
disc_number_ = value;
}
// optional uint32 track_number = 3;
// optional uint32 track_number = 6;
inline bool AudioCollectionResponse_Track::has_track_number() const {
return (_has_bits_[0] & 0x00000004u) != 0;
return (_has_bits_[0] & 0x00000020u) != 0;
}
inline void AudioCollectionResponse_Track::set_has_track_number() {
_has_bits_[0] |= 0x00000004u;
_has_bits_[0] |= 0x00000020u;
}
inline void AudioCollectionResponse_Track::clear_has_track_number() {
_has_bits_[0] &= ~0x00000004u;
_has_bits_[0] &= ~0x00000020u;
}
inline void AudioCollectionResponse_Track::clear_track_number() {
track_number_ = 0u;
@@ -3331,155 +3386,15 @@ inline void AudioCollectionResponse_Track::set_track_number(::google::protobuf::
track_number_ = value;
}
// optional string artist = 4;
inline bool AudioCollectionResponse_Track::has_artist() const {
return (_has_bits_[0] & 0x00000008u) != 0;
}
inline void AudioCollectionResponse_Track::set_has_artist() {
_has_bits_[0] |= 0x00000008u;
}
inline void AudioCollectionResponse_Track::clear_has_artist() {
_has_bits_[0] &= ~0x00000008u;
}
inline void AudioCollectionResponse_Track::clear_artist() {
if (artist_ != &::google::protobuf::internal::kEmptyString) {
artist_->clear();
}
clear_has_artist();
}
inline const ::std::string& AudioCollectionResponse_Track::artist() const {
return *artist_;
}
inline void AudioCollectionResponse_Track::set_artist(const ::std::string& value) {
set_has_artist();
if (artist_ == &::google::protobuf::internal::kEmptyString) {
artist_ = new ::std::string;
}
artist_->assign(value);
}
inline void AudioCollectionResponse_Track::set_artist(const char* value) {
set_has_artist();
if (artist_ == &::google::protobuf::internal::kEmptyString) {
artist_ = new ::std::string;
}
artist_->assign(value);
}
inline void AudioCollectionResponse_Track::set_artist(const char* value, size_t size) {
set_has_artist();
if (artist_ == &::google::protobuf::internal::kEmptyString) {
artist_ = new ::std::string;
}
artist_->assign(reinterpret_cast<const char*>(value), size);
}
inline ::std::string* AudioCollectionResponse_Track::mutable_artist() {
set_has_artist();
if (artist_ == &::google::protobuf::internal::kEmptyString) {
artist_ = new ::std::string;
}
return artist_;
}
inline ::std::string* AudioCollectionResponse_Track::release_artist() {
clear_has_artist();
if (artist_ == &::google::protobuf::internal::kEmptyString) {
return NULL;
} else {
::std::string* temp = artist_;
artist_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
return temp;
}
}
inline void AudioCollectionResponse_Track::set_allocated_artist(::std::string* artist) {
if (artist_ != &::google::protobuf::internal::kEmptyString) {
delete artist_;
}
if (artist) {
set_has_artist();
artist_ = artist;
} else {
clear_has_artist();
artist_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
}
}
// optional string release = 5;
inline bool AudioCollectionResponse_Track::has_release() const {
return (_has_bits_[0] & 0x00000010u) != 0;
}
inline void AudioCollectionResponse_Track::set_has_release() {
_has_bits_[0] |= 0x00000010u;
}
inline void AudioCollectionResponse_Track::clear_has_release() {
_has_bits_[0] &= ~0x00000010u;
}
inline void AudioCollectionResponse_Track::clear_release() {
if (release_ != &::google::protobuf::internal::kEmptyString) {
release_->clear();
}
clear_has_release();
}
inline const ::std::string& AudioCollectionResponse_Track::release() const {
return *release_;
}
inline void AudioCollectionResponse_Track::set_release(const ::std::string& value) {
set_has_release();
if (release_ == &::google::protobuf::internal::kEmptyString) {
release_ = new ::std::string;
}
release_->assign(value);
}
inline void AudioCollectionResponse_Track::set_release(const char* value) {
set_has_release();
if (release_ == &::google::protobuf::internal::kEmptyString) {
release_ = new ::std::string;
}
release_->assign(value);
}
inline void AudioCollectionResponse_Track::set_release(const char* value, size_t size) {
set_has_release();
if (release_ == &::google::protobuf::internal::kEmptyString) {
release_ = new ::std::string;
}
release_->assign(reinterpret_cast<const char*>(value), size);
}
inline ::std::string* AudioCollectionResponse_Track::mutable_release() {
set_has_release();
if (release_ == &::google::protobuf::internal::kEmptyString) {
release_ = new ::std::string;
}
return release_;
}
inline ::std::string* AudioCollectionResponse_Track::release_release() {
clear_has_release();
if (release_ == &::google::protobuf::internal::kEmptyString) {
return NULL;
} else {
::std::string* temp = release_;
release_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
return temp;
}
}
inline void AudioCollectionResponse_Track::set_allocated_release(::std::string* release) {
if (release_ != &::google::protobuf::internal::kEmptyString) {
delete release_;
}
if (release) {
set_has_release();
release_ = release;
} else {
clear_has_release();
release_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
}
}
// required string name = 6;
// required string name = 7;
inline bool AudioCollectionResponse_Track::has_name() const {
return (_has_bits_[0] & 0x00000020u) != 0;
return (_has_bits_[0] & 0x00000040u) != 0;
}
inline void AudioCollectionResponse_Track::set_has_name() {
_has_bits_[0] |= 0x00000020u;
_has_bits_[0] |= 0x00000040u;
}
inline void AudioCollectionResponse_Track::clear_has_name() {
_has_bits_[0] &= ~0x00000020u;
_has_bits_[0] &= ~0x00000040u;
}
inline void AudioCollectionResponse_Track::clear_name() {
if (name_ != &::google::protobuf::internal::kEmptyString) {
@@ -3541,15 +3456,15 @@ inline void AudioCollectionResponse_Track::set_allocated_name(::std::string* nam
}
}
// required uint32 duration_secs = 7;
// required uint32 duration_secs = 8;
inline bool AudioCollectionResponse_Track::has_duration_secs() const {
return (_has_bits_[0] & 0x00000040u) != 0;
return (_has_bits_[0] & 0x00000080u) != 0;
}
inline void AudioCollectionResponse_Track::set_has_duration_secs() {
_has_bits_[0] |= 0x00000040u;
_has_bits_[0] |= 0x00000080u;
}
inline void AudioCollectionResponse_Track::clear_has_duration_secs() {
_has_bits_[0] &= ~0x00000040u;
_has_bits_[0] &= ~0x00000080u;
}
inline void AudioCollectionResponse_Track::clear_duration_secs() {
duration_secs_ = 0u;
@@ -3563,15 +3478,15 @@ inline void AudioCollectionResponse_Track::set_duration_secs(::google::protobuf:
duration_secs_ = value;
}
// optional string release_date = 8;
// optional string release_date = 9;
inline bool AudioCollectionResponse_Track::has_release_date() const {
return (_has_bits_[0] & 0x00000080u) != 0;
return (_has_bits_[0] & 0x00000100u) != 0;
}
inline void AudioCollectionResponse_Track::set_has_release_date() {
_has_bits_[0] |= 0x00000080u;
_has_bits_[0] |= 0x00000100u;
}
inline void AudioCollectionResponse_Track::clear_has_release_date() {
_has_bits_[0] &= ~0x00000080u;
_has_bits_[0] &= ~0x00000100u;
}
inline void AudioCollectionResponse_Track::clear_release_date() {
if (release_date_ != &::google::protobuf::internal::kEmptyString) {
@@ -3633,15 +3548,15 @@ inline void AudioCollectionResponse_Track::set_allocated_release_date(::std::str
}
}
// optional string original_release_date = 9;
// optional string original_release_date = 10;
inline bool AudioCollectionResponse_Track::has_original_release_date() const {
return (_has_bits_[0] & 0x00000100u) != 0;
return (_has_bits_[0] & 0x00000200u) != 0;
}
inline void AudioCollectionResponse_Track::set_has_original_release_date() {
_has_bits_[0] |= 0x00000100u;
_has_bits_[0] |= 0x00000200u;
}
inline void AudioCollectionResponse_Track::clear_has_original_release_date() {
_has_bits_[0] &= ~0x00000100u;
_has_bits_[0] &= ~0x00000200u;
}
inline void AudioCollectionResponse_Track::clear_original_release_date() {
if (original_release_date_ != &::google::protobuf::internal::kEmptyString) {
@@ -3703,50 +3618,6 @@ inline void AudioCollectionResponse_Track::set_allocated_original_release_date(:
}
}
// repeated string genres = 10;
inline int AudioCollectionResponse_Track::genres_size() const {
return genres_.size();
}
inline void AudioCollectionResponse_Track::clear_genres() {
genres_.Clear();
}
inline const ::std::string& AudioCollectionResponse_Track::genres(int index) const {
return genres_.Get(index);
}
inline ::std::string* AudioCollectionResponse_Track::mutable_genres(int index) {
return genres_.Mutable(index);
}
inline void AudioCollectionResponse_Track::set_genres(int index, const ::std::string& value) {
genres_.Mutable(index)->assign(value);
}
inline void AudioCollectionResponse_Track::set_genres(int index, const char* value) {
genres_.Mutable(index)->assign(value);
}
inline void AudioCollectionResponse_Track::set_genres(int index, const char* value, size_t size) {
genres_.Mutable(index)->assign(
reinterpret_cast<const char*>(value), size);
}
inline ::std::string* AudioCollectionResponse_Track::add_genres() {
return genres_.Add();
}
inline void AudioCollectionResponse_Track::add_genres(const ::std::string& value) {
genres_.Add()->assign(value);
}
inline void AudioCollectionResponse_Track::add_genres(const char* value) {
genres_.Add()->assign(value);
}
inline void AudioCollectionResponse_Track::add_genres(const char* value, size_t size) {
genres_.Add()->assign(reinterpret_cast<const char*>(value), size);
}
inline const ::google::protobuf::RepeatedPtrField< ::std::string>&
AudioCollectionResponse_Track::genres() const {
return genres_;
}
inline ::google::protobuf::RepeatedPtrField< ::std::string>*
AudioCollectionResponse_Track::mutable_genres() {
return &genres_;
}
// optional bytes coverArt = 11;
inline bool AudioCollectionResponse_Track::has_coverart() const {
return (_has_bits_[0] & 0x00000400u) != 0;
+9 -14
View File
@@ -126,21 +126,16 @@ message AudioCollectionResponse
{
required uint64 id = 1;
optional uint32 disc_number = 2;
optional uint32 track_number = 3;
optional string artist = 4;
optional string release = 5;
required string name = 6;
required uint32 duration_secs = 7;
optional string release_date = 8;
optional string original_release_date = 9;
repeated string genres = 10;
required uint64 artist_id = 2;
required uint64 release_id = 3;
repeated uint64 genre_id = 4;
optional uint32 disc_number = 5;
optional uint32 track_number = 6;
required string name = 7;
required uint32 duration_secs = 8;
optional string release_date = 9;
optional string original_release_date = 10;
optional bytes coverArt = 11;
}
+132 -24
View File
@@ -1,4 +1,6 @@
#include <algorithm> // std::max
#include <algorithm> // std::min
#include <boost/foreach.hpp>
#include "AudioCollectionRequestHandler.hpp"
@@ -44,9 +46,27 @@ AudioCollectionRequestHandler::process(const AudioCollectionRequest& request, Au
break;
case AudioCollectionRequest_Type_TypeGetReleaseList:
if (request.has_get_releases())
{
res = processGetReleases(request.get_releases(), *response.mutable_release_list());
if (res)
response.set_type(AudioCollectionResponse_Type_TypeReleaseList);
}
else
std::cerr << "Bad AudioCollectionRequest_Type_TypeGetReleaseList" << std::endl;
break;
case AudioCollectionRequest_Type_TypeGetTrackList:
if (request.has_get_tracks())
{
res = processGetTracks(request.get_tracks(), *response.mutable_track_list());
if (res)
response.set_type(AudioCollectionResponse_Type_TypeTrackList);
}
else
std::cerr << "Bad AudioCollectionRequest_Type_TypeGetTrackList" << std::endl;
break;
default:
@@ -67,16 +87,18 @@ AudioCollectionRequestHandler::processGetGenres(const AudioCollectionRequest::Ge
return false;
}
std::cout << "Offset = " << request.batch_parameter().offset() << std::endl;
std::cout << "Size = " << request.batch_parameter().size() << std::endl;
std::size_t size = request.batch_parameter().size();
if (!size)
size = _maxListArtists;
size = std::min(size, _maxListArtists);
Wt::Dbo::Transaction transaction( _db.getSession() );
Wt::Dbo::collection<Genre::pointer> genres = Genre::getAll( _db.getSession(), request.batch_parameter().offset(), std::max(static_cast<std::size_t>(request.batch_parameter().size()), _maxListGenres) );
Wt::Dbo::collection<Genre::pointer> genres = Genre::getAll( _db.getSession(), request.batch_parameter().offset(), static_cast<int>(size));
typedef Wt::Dbo::collection< Genre::pointer > Genres;
for (Genres::iterator it = genres.begin(); it != genres.end(); ++it)
for (Genres::const_iterator it = genres.begin(); it != genres.end(); ++it)
{
AudioCollectionResponse_Genre* genre = response.add_genres();
@@ -90,7 +112,6 @@ AudioCollectionRequestHandler::processGetGenres(const AudioCollectionRequest::Ge
bool
AudioCollectionRequestHandler::processGetArtists(const AudioCollectionRequest::GetArtistList& request, AudioCollectionResponse::ArtistList& response)
{
// sanity checks
if (!request.has_batch_parameter())
{
@@ -98,31 +119,20 @@ AudioCollectionRequestHandler::processGetArtists(const AudioCollectionRequest::G
return false;
}
std::cout << "Offset = " << request.batch_parameter().offset() << std::endl;
std::cout << "Size = " << request.batch_parameter().size() << std::endl;
if (request.batch_parameter().size() > _maxListArtists)
std::cerr << "Warning: batch parameter size too high (" << request.batch_parameter().size() << ")" << std::endl;
for (int id = 0; id < request.genre_id_size(); ++id)
{
std::cout << "Genre id " << id << " = '" << request.genre_id(id) << "'" << std::endl;
}
std::size_t size = request.batch_parameter().size();
if (!size)
size = _maxListArtists;
size = std::min(size, _maxListArtists);
// Now fetch requested data...
std::cout << "Getting artists..." << std::endl;
Wt::Dbo::Transaction transaction( _db.getSession() );
Wt::Dbo::collection<Artist::pointer> artists = Artist::getAll( _db.getSession(), request.batch_parameter().offset(), std::max(static_cast<std::size_t>(request.batch_parameter().size()), _maxListArtists) );
std::cout << "size = " << artists.size() << std::endl;
Wt::Dbo::collection<Artist::pointer> artists = Artist::getAll( _db.getSession(), request.batch_parameter().offset(), static_cast<int>(size) );
typedef Wt::Dbo::collection< Artist::pointer > Artists;
for (Artists::iterator it = artists.begin(); it != artists.end(); ++it)
for (Artists::const_iterator it = artists.begin(); it != artists.end(); ++it)
{
AudioCollectionResponse_Artist* artist = response.add_artists();
@@ -131,7 +141,105 @@ AudioCollectionRequestHandler::processGetArtists(const AudioCollectionRequest::G
artist->set_id(it->id());
}
std::cout << "Getting artists DONE" << std::endl;
return true;
}
bool
AudioCollectionRequestHandler::processGetReleases(const AudioCollectionRequest::GetReleaseList& request, AudioCollectionResponse::ReleaseList& response)
{
// sanity checks
if (!request.has_batch_parameter())
{
std::cerr << "No batch parameters found!" << std::endl;
return false;
}
std::size_t size = request.batch_parameter().size();
if (!size)
size = _maxListReleases;
size = std::min(size, _maxListReleases);
std::vector<Artist::id_type> artistIds;
for (int id = 0; id < request.artist_id_size(); ++id)
artistIds.push_back( request.artist_id(id) );
Wt::Dbo::Transaction transaction( _db.getSession() );
Wt::Dbo::collection<Release::pointer> releases = Release::getAll( _db.getSession(), artistIds, request.batch_parameter().offset(), static_cast<int>(size));
typedef Wt::Dbo::collection< Release::pointer > Releases;
for (Releases::const_iterator it = releases.begin(); it != releases.end(); ++it)
{
AudioCollectionResponse_Release* release = response.add_releases();
release->set_name((*it)->getName());
release->set_id(it->id());
// WARNING: next two lines are very time consuming!
release->set_nb_tracks( (*it)->getTracks().size() );
release->set_duration_secs( (*it)->getDuration().total_seconds() );
}
return true;
}
bool
AudioCollectionRequestHandler::processGetTracks(const AudioCollectionRequest::GetTrackList& request, AudioCollectionResponse::TrackList& response)
{
// sanity checks
if (!request.has_batch_parameter())
{
std::cerr << "No batch parameters found!" << std::endl;
return false;
}
std::size_t size = request.batch_parameter().size();
if (!size)
size = _maxListTracks;
size = std::min(size, _maxListTracks);
// Get filters
std::vector<Artist::id_type> artistIds;
for (int id = 0; id < request.artist_id_size(); ++id)
artistIds.push_back( request.artist_id(id) );
std::vector<Release::id_type> releaseIds;
for (int id = 0; id < request.release_id_size(); ++id)
releaseIds.push_back( request.release_id(id) );
std::vector<Release::id_type> genreIds;
for (int id = 0; id < request.genre_id_size(); ++id)
genreIds.push_back( request.genre_id(id) );
Wt::Dbo::Transaction transaction( _db.getSession() );
Wt::Dbo::collection<Track::pointer> tracks = Track::getAll( _db.getSession(),
artistIds, releaseIds, genreIds,
request.batch_parameter().offset(), static_cast<int>(size));
typedef Wt::Dbo::collection< Track::pointer > Tracks;
for (Tracks::const_iterator it = tracks.begin(); it != tracks.end(); ++it)
{
AudioCollectionResponse_Track* track = response.add_tracks();
track->set_id(it->id());
track->set_disc_number( (*it)->getDiscNumber() );
track->set_track_number( (*it)->getTrackNumber() );
track->set_artist_id( (*it)->getArtist().id() );
track->set_release_id( (*it)->getRelease().id() );
track->set_name( (*it)->getName() );
track->set_duration_secs( (*it)->getDuration().total_seconds() );
// if (!(*it)->getCreationTime().is_special())
// track->set_release_date( boost::posix_time::to_simple_string((*it)->getCreationTime()) );
BOOST_FOREACH(Genre::pointer genre, (*it)->getGenres())
track->add_genre_id( genre.id() );
// if (!(*it)->getCoverArt().empty)
// track->set_coverart( (*it)->getCoverArt() );
}
return true;
}
@@ -19,13 +19,15 @@ class AudioCollectionRequestHandler
bool processGetArtists(const AudioCollectionRequest::GetArtistList& request, AudioCollectionResponse::ArtistList& response);
bool processGetGenres(const AudioCollectionRequest::GetGenreList& request, AudioCollectionResponse::GenreList& response);
bool processGetReleases(const AudioCollectionRequest::GetReleaseList& request, AudioCollectionResponse::ReleaseList& response);
bool processGetTracks(const AudioCollectionRequest::GetTrackList& request, AudioCollectionResponse::TrackList& response);
DatabaseHandler& _db;
static const std::size_t _maxListArtists = 128;
static const std::size_t _maxListGenres = 128;
static const std::size_t _maxListReleases = 128;
static const std::size_t _maxListTracks = 32;
static const std::size_t _maxListArtists = 256;
static const std::size_t _maxListGenres = 256;
static const std::size_t _maxListReleases = 256;
static const std::size_t _maxListTracks = 256;
};
} // namespace Remote
-2
View File
@@ -75,8 +75,6 @@ Connection::handleReadHeader(const boost::system::error_code& error, std::size_t
return;
}
std::cout << "Header received. Size = " << header.getSize() << std::endl;
// Now read the real message
boost::asio::streambuf::mutable_buffers_type bufs = _inputStreamBuf.prepare(header.getSize());
+1 -1
View File
@@ -12,7 +12,7 @@ int main(void)
SqlQuery query;
query.select().And( SelectStatement("artist.name")).And( SelectStatement("track.name"));
query.select("artist.name").And("track.name");
query.from().And( FromClause("artist") ).And( FromClause("track"));
query.where().And( WhereClause("artist.id = track.artist_id") );
+3
View File
@@ -21,6 +21,7 @@ remote_SOURCES = \
$(top_srcdir)/database/Release.cpp \
$(top_srcdir)/database/Track.cpp \
$(top_srcdir)/database/DatabaseHandler.cpp \
$(top_srcdir)/database/SqlQuery.cpp \
$(top_srcdir)/database/Path.cpp \
$(top_srcdir)/database/Video.cpp \
$(top_srcdir)/database/Checksum.cpp
@@ -34,6 +35,7 @@ database_integrity_SOURCES = \
$(top_srcdir)/database/Release.cpp \
$(top_srcdir)/database/Track.cpp \
$(top_srcdir)/database/DatabaseHandler.cpp \
$(top_srcdir)/database/SqlQuery.cpp \
$(top_srcdir)/database/Path.cpp \
$(top_srcdir)/database/Video.cpp \
$(top_srcdir)/database/Checksum.cpp
@@ -47,6 +49,7 @@ database_basics_SOURCES = \
$(top_srcdir)/database/Release.cpp \
$(top_srcdir)/database/Track.cpp \
$(top_srcdir)/database/DatabaseHandler.cpp \
$(top_srcdir)/database/SqlQuery.cpp \
$(top_srcdir)/database/Path.cpp \
$(top_srcdir)/database/Video.cpp \
$(top_srcdir)/database/Checksum.cpp
+52 -2
View File
@@ -97,6 +97,7 @@ am_database_basics_OBJECTS = \
database_basics-Release.$(OBJEXT) \
database_basics-Track.$(OBJEXT) \
database_basics-DatabaseHandler.$(OBJEXT) \
database_basics-SqlQuery.$(OBJEXT) \
database_basics-Path.$(OBJEXT) database_basics-Video.$(OBJEXT) \
database_basics-Checksum.$(OBJEXT)
database_basics_OBJECTS = $(am_database_basics_OBJECTS)
@@ -110,6 +111,7 @@ am_database_integrity_OBJECTS = \
database_integrity-Release.$(OBJEXT) \
database_integrity-Track.$(OBJEXT) \
database_integrity-DatabaseHandler.$(OBJEXT) \
database_integrity-SqlQuery.$(OBJEXT) \
database_integrity-Path.$(OBJEXT) \
database_integrity-Video.$(OBJEXT) \
database_integrity-Checksum.$(OBJEXT)
@@ -127,8 +129,8 @@ am_remote_OBJECTS = remote-RemoteClientServer.$(OBJEXT) \
remote-messages.pb.$(OBJEXT) remote-Artist.$(OBJEXT) \
remote-Genre.$(OBJEXT) remote-Release.$(OBJEXT) \
remote-Track.$(OBJEXT) remote-DatabaseHandler.$(OBJEXT) \
remote-Path.$(OBJEXT) remote-Video.$(OBJEXT) \
remote-Checksum.$(OBJEXT)
remote-SqlQuery.$(OBJEXT) remote-Path.$(OBJEXT) \
remote-Video.$(OBJEXT) remote-Checksum.$(OBJEXT)
remote_OBJECTS = $(am_remote_OBJECTS)
remote_LDADD = $(LDADD)
remote_LINK = $(CXXLD) $(remote_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
@@ -511,6 +513,7 @@ remote_SOURCES = \
$(top_srcdir)/database/Release.cpp \
$(top_srcdir)/database/Track.cpp \
$(top_srcdir)/database/DatabaseHandler.cpp \
$(top_srcdir)/database/SqlQuery.cpp \
$(top_srcdir)/database/Path.cpp \
$(top_srcdir)/database/Video.cpp \
$(top_srcdir)/database/Checksum.cpp
@@ -523,6 +526,7 @@ database_integrity_SOURCES = \
$(top_srcdir)/database/Release.cpp \
$(top_srcdir)/database/Track.cpp \
$(top_srcdir)/database/DatabaseHandler.cpp \
$(top_srcdir)/database/SqlQuery.cpp \
$(top_srcdir)/database/Path.cpp \
$(top_srcdir)/database/Video.cpp \
$(top_srcdir)/database/Checksum.cpp
@@ -535,6 +539,7 @@ database_basics_SOURCES = \
$(top_srcdir)/database/Release.cpp \
$(top_srcdir)/database/Track.cpp \
$(top_srcdir)/database/DatabaseHandler.cpp \
$(top_srcdir)/database/SqlQuery.cpp \
$(top_srcdir)/database/Path.cpp \
$(top_srcdir)/database/Video.cpp \
$(top_srcdir)/database/Checksum.cpp
@@ -612,6 +617,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/database_basics-Genre.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/database_basics-Path.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/database_basics-Release.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/database_basics-SqlQuery.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/database_basics-Track.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/database_basics-Video.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/database_integrity-Artist.Po@am__quote@
@@ -621,6 +627,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/database_integrity-Genre.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/database_integrity-Path.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/database_integrity-Release.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/database_integrity-SqlQuery.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/database_integrity-Track.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/database_integrity-Video.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/remote-Artist.Po@am__quote@
@@ -635,6 +642,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/remote-RemoteClientServer.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/remote-RequestHandler.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/remote-Server.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/remote-SqlQuery.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/remote-TestDatabase.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/remote-Track.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/remote-Video.Po@am__quote@
@@ -744,6 +752,20 @@ database_basics-DatabaseHandler.obj: $(top_srcdir)/database/DatabaseHandler.cpp
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(database_basics_CXXFLAGS) $(CXXFLAGS) -c -o database_basics-DatabaseHandler.obj `if test -f '$(top_srcdir)/database/DatabaseHandler.cpp'; then $(CYGPATH_W) '$(top_srcdir)/database/DatabaseHandler.cpp'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/database/DatabaseHandler.cpp'; fi`
database_basics-SqlQuery.o: $(top_srcdir)/database/SqlQuery.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(database_basics_CXXFLAGS) $(CXXFLAGS) -MT database_basics-SqlQuery.o -MD -MP -MF $(DEPDIR)/database_basics-SqlQuery.Tpo -c -o database_basics-SqlQuery.o `test -f '$(top_srcdir)/database/SqlQuery.cpp' || echo '$(srcdir)/'`$(top_srcdir)/database/SqlQuery.cpp
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/database_basics-SqlQuery.Tpo $(DEPDIR)/database_basics-SqlQuery.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(top_srcdir)/database/SqlQuery.cpp' object='database_basics-SqlQuery.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(database_basics_CXXFLAGS) $(CXXFLAGS) -c -o database_basics-SqlQuery.o `test -f '$(top_srcdir)/database/SqlQuery.cpp' || echo '$(srcdir)/'`$(top_srcdir)/database/SqlQuery.cpp
database_basics-SqlQuery.obj: $(top_srcdir)/database/SqlQuery.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(database_basics_CXXFLAGS) $(CXXFLAGS) -MT database_basics-SqlQuery.obj -MD -MP -MF $(DEPDIR)/database_basics-SqlQuery.Tpo -c -o database_basics-SqlQuery.obj `if test -f '$(top_srcdir)/database/SqlQuery.cpp'; then $(CYGPATH_W) '$(top_srcdir)/database/SqlQuery.cpp'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/database/SqlQuery.cpp'; fi`
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/database_basics-SqlQuery.Tpo $(DEPDIR)/database_basics-SqlQuery.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(top_srcdir)/database/SqlQuery.cpp' object='database_basics-SqlQuery.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(database_basics_CXXFLAGS) $(CXXFLAGS) -c -o database_basics-SqlQuery.obj `if test -f '$(top_srcdir)/database/SqlQuery.cpp'; then $(CYGPATH_W) '$(top_srcdir)/database/SqlQuery.cpp'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/database/SqlQuery.cpp'; fi`
database_basics-Path.o: $(top_srcdir)/database/Path.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(database_basics_CXXFLAGS) $(CXXFLAGS) -MT database_basics-Path.o -MD -MP -MF $(DEPDIR)/database_basics-Path.Tpo -c -o database_basics-Path.o `test -f '$(top_srcdir)/database/Path.cpp' || echo '$(srcdir)/'`$(top_srcdir)/database/Path.cpp
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/database_basics-Path.Tpo $(DEPDIR)/database_basics-Path.Po
@@ -870,6 +892,20 @@ database_integrity-DatabaseHandler.obj: $(top_srcdir)/database/DatabaseHandler.c
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(database_integrity_CXXFLAGS) $(CXXFLAGS) -c -o database_integrity-DatabaseHandler.obj `if test -f '$(top_srcdir)/database/DatabaseHandler.cpp'; then $(CYGPATH_W) '$(top_srcdir)/database/DatabaseHandler.cpp'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/database/DatabaseHandler.cpp'; fi`
database_integrity-SqlQuery.o: $(top_srcdir)/database/SqlQuery.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(database_integrity_CXXFLAGS) $(CXXFLAGS) -MT database_integrity-SqlQuery.o -MD -MP -MF $(DEPDIR)/database_integrity-SqlQuery.Tpo -c -o database_integrity-SqlQuery.o `test -f '$(top_srcdir)/database/SqlQuery.cpp' || echo '$(srcdir)/'`$(top_srcdir)/database/SqlQuery.cpp
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/database_integrity-SqlQuery.Tpo $(DEPDIR)/database_integrity-SqlQuery.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(top_srcdir)/database/SqlQuery.cpp' object='database_integrity-SqlQuery.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(database_integrity_CXXFLAGS) $(CXXFLAGS) -c -o database_integrity-SqlQuery.o `test -f '$(top_srcdir)/database/SqlQuery.cpp' || echo '$(srcdir)/'`$(top_srcdir)/database/SqlQuery.cpp
database_integrity-SqlQuery.obj: $(top_srcdir)/database/SqlQuery.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(database_integrity_CXXFLAGS) $(CXXFLAGS) -MT database_integrity-SqlQuery.obj -MD -MP -MF $(DEPDIR)/database_integrity-SqlQuery.Tpo -c -o database_integrity-SqlQuery.obj `if test -f '$(top_srcdir)/database/SqlQuery.cpp'; then $(CYGPATH_W) '$(top_srcdir)/database/SqlQuery.cpp'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/database/SqlQuery.cpp'; fi`
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/database_integrity-SqlQuery.Tpo $(DEPDIR)/database_integrity-SqlQuery.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(top_srcdir)/database/SqlQuery.cpp' object='database_integrity-SqlQuery.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(database_integrity_CXXFLAGS) $(CXXFLAGS) -c -o database_integrity-SqlQuery.obj `if test -f '$(top_srcdir)/database/SqlQuery.cpp'; then $(CYGPATH_W) '$(top_srcdir)/database/SqlQuery.cpp'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/database/SqlQuery.cpp'; fi`
database_integrity-Path.o: $(top_srcdir)/database/Path.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(database_integrity_CXXFLAGS) $(CXXFLAGS) -MT database_integrity-Path.o -MD -MP -MF $(DEPDIR)/database_integrity-Path.Tpo -c -o database_integrity-Path.o `test -f '$(top_srcdir)/database/Path.cpp' || echo '$(srcdir)/'`$(top_srcdir)/database/Path.cpp
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/database_integrity-Path.Tpo $(DEPDIR)/database_integrity-Path.Po
@@ -1150,6 +1186,20 @@ remote-DatabaseHandler.obj: $(top_srcdir)/database/DatabaseHandler.cpp
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(remote_CXXFLAGS) $(CXXFLAGS) -c -o remote-DatabaseHandler.obj `if test -f '$(top_srcdir)/database/DatabaseHandler.cpp'; then $(CYGPATH_W) '$(top_srcdir)/database/DatabaseHandler.cpp'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/database/DatabaseHandler.cpp'; fi`
remote-SqlQuery.o: $(top_srcdir)/database/SqlQuery.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(remote_CXXFLAGS) $(CXXFLAGS) -MT remote-SqlQuery.o -MD -MP -MF $(DEPDIR)/remote-SqlQuery.Tpo -c -o remote-SqlQuery.o `test -f '$(top_srcdir)/database/SqlQuery.cpp' || echo '$(srcdir)/'`$(top_srcdir)/database/SqlQuery.cpp
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/remote-SqlQuery.Tpo $(DEPDIR)/remote-SqlQuery.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(top_srcdir)/database/SqlQuery.cpp' object='remote-SqlQuery.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(remote_CXXFLAGS) $(CXXFLAGS) -c -o remote-SqlQuery.o `test -f '$(top_srcdir)/database/SqlQuery.cpp' || echo '$(srcdir)/'`$(top_srcdir)/database/SqlQuery.cpp
remote-SqlQuery.obj: $(top_srcdir)/database/SqlQuery.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(remote_CXXFLAGS) $(CXXFLAGS) -MT remote-SqlQuery.obj -MD -MP -MF $(DEPDIR)/remote-SqlQuery.Tpo -c -o remote-SqlQuery.obj `if test -f '$(top_srcdir)/database/SqlQuery.cpp'; then $(CYGPATH_W) '$(top_srcdir)/database/SqlQuery.cpp'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/database/SqlQuery.cpp'; fi`
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/remote-SqlQuery.Tpo $(DEPDIR)/remote-SqlQuery.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(top_srcdir)/database/SqlQuery.cpp' object='remote-SqlQuery.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(remote_CXXFLAGS) $(CXXFLAGS) -c -o remote-SqlQuery.obj `if test -f '$(top_srcdir)/database/SqlQuery.cpp'; then $(CYGPATH_W) '$(top_srcdir)/database/SqlQuery.cpp'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/database/SqlQuery.cpp'; fi`
remote-Path.o: $(top_srcdir)/database/Path.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(remote_CXXFLAGS) $(CXXFLAGS) -MT remote-Path.o -MD -MP -MF $(DEPDIR)/remote-Path.Tpo -c -o remote-Path.o `test -f '$(top_srcdir)/database/Path.cpp' || echo '$(srcdir)/'`$(top_srcdir)/database/Path.cpp
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/remote-Path.Tpo $(DEPDIR)/remote-Path.Po
+185 -13
View File
@@ -20,7 +20,7 @@ struct GenreInfo
std::ostream& operator<<(std::ostream& os, const GenreInfo& info)
{
os << "id = " << info.id << ", name = '" << info.name << "'" << std::endl;
os << "id = " << info.id << ", name = '" << info.name << "'";
return os;
}
@@ -32,10 +32,47 @@ struct ArtistInfo
std::ostream& operator<<(std::ostream& os, const ArtistInfo& info)
{
os << "id = " << info.id << ", name = '" << info.name << "'" << std::endl;
os << "id = " << info.id << ", name = '" << info.name << "'";
return os;
}
struct ReleaseInfo
{
uint64_t id;
std::string name;
std::size_t nbTracks;
boost::posix_time::time_duration duration;
};
std::ostream& operator<<(std::ostream& os, const ReleaseInfo& info)
{
os << "id = " << info.id << ", name = '" << info.name << "', tracks = " << info.nbTracks << ", duration = " << info.duration;
return os;
}
struct TrackInfo
{
uint64_t id;
uint64_t release_id;
uint64_t artist_id;
std::vector<uint64_t> genre_id;
uint32_t disc_number;
uint32_t track_number;
std::string name;
boost::posix_time::time_duration duration;
};
std::ostream& operator<<(std::ostream& os, const TrackInfo& info)
{
os << "id = " << info.id << ", name = '" << info.name << "', track_number = " << info.track_number << ", duration = " << info.duration;
return os;
}
// Ugly class for testing purposes
class TestServer
{
@@ -80,7 +117,7 @@ class TestClient
void getArtists(std::vector<ArtistInfo>& artists)
{
const std::size_t requestedBatchSize = 32;
const std::size_t requestedBatchSize = 128;
std::size_t offset = 0;
std::size_t res = 0;
@@ -135,7 +172,7 @@ class TestClient
void getGenres(std::vector<GenreInfo>& genres)
{
const std::size_t requestedBatchSize = 8;
const std::size_t requestedBatchSize = 128;
std::size_t offset = 0;
std::size_t res = 0;
@@ -182,11 +219,128 @@ class TestClient
genres.push_back( genre );
nbAdded++;
}
return nbAdded;
}
void getReleases(std::vector<ReleaseInfo>& releases, const std::vector<uint64_t> artistIds)
{
const std::size_t requestedBatchSize = 128;
std::size_t offset = 0;
std::size_t res = 0;
while ((res = getReleases(releases, artistIds, offset, requestedBatchSize) ) > 0)
offset += res;
}
std::size_t getReleases(std::vector<ReleaseInfo>& releases, const std::vector<uint64_t> artistIds, std::size_t offset, std::size_t size)
{
std::size_t nbAdded = 0;
// Send request
Remote::ClientMessage request;
request.set_type( Remote::ClientMessage_Type_AudioCollectionRequest );
request.mutable_audio_collection_request()->set_type( Remote::AudioCollectionRequest_Type_TypeGetReleaseList);
request.mutable_audio_collection_request()->mutable_get_releases()->mutable_batch_parameter()->set_size(size);
request.mutable_audio_collection_request()->mutable_get_releases()->mutable_batch_parameter()->set_offset(offset);
BOOST_FOREACH(uint64_t artistId, artistIds)
request.mutable_audio_collection_request()->mutable_get_releases()->add_artist_id(artistId);
sendMsg(request);
// Receive responses
Remote::ServerMessage response;
recvMsg(response);
// Process message
if (!response.has_audio_collection_response())
throw std::runtime_error("not an audio_collection_response!");
if (!response.audio_collection_response().has_release_list())
throw std::runtime_error("not an release list!");
for (int i = 0; i < response.audio_collection_response().release_list().releases_size(); ++i)
{
if (!response.audio_collection_response().release_list().releases(i).has_name())
throw std::runtime_error("no release name!");
ReleaseInfo release;
release.id = response.audio_collection_response().release_list().releases(i).id();
release.name = response.audio_collection_response().release_list().releases(i).name();
release.duration = boost::posix_time::seconds(response.audio_collection_response().release_list().releases(i).duration_secs());
release.nbTracks = response.audio_collection_response().release_list().releases(i).nb_tracks();
releases.push_back( release );
nbAdded++;
}
return nbAdded;
}
void getTracks(std::vector<TrackInfo>& tracks, const std::vector<uint64_t> artistIds, const std::vector<uint64_t> releaseIds, const std::vector<uint64_t> genreIds)
{
const std::size_t requestedBatchSize = 256;
std::size_t offset = 0;
std::size_t res = 0;
while ((res = getTracks(tracks, artistIds, releaseIds, genreIds, offset, requestedBatchSize) ) > 0)
offset += res;
}
std::size_t getTracks(std::vector<TrackInfo>& tracks,
const std::vector<uint64_t> artistIds,
const std::vector<uint64_t> releaseIds,
const std::vector<uint64_t> genreIds,
std::size_t offset,
std::size_t size)
{
std::size_t nbAdded = 0;
// Send request
Remote::ClientMessage request;
request.set_type( Remote::ClientMessage_Type_AudioCollectionRequest );
request.mutable_audio_collection_request()->set_type( Remote::AudioCollectionRequest_Type_TypeGetTrackList);
request.mutable_audio_collection_request()->mutable_get_tracks()->mutable_batch_parameter()->set_size(size);
request.mutable_audio_collection_request()->mutable_get_tracks()->mutable_batch_parameter()->set_offset(offset);
BOOST_FOREACH(uint64_t artistId, artistIds)
request.mutable_audio_collection_request()->mutable_get_tracks()->add_artist_id(artistId);
BOOST_FOREACH(uint64_t releaseId, releaseIds)
request.mutable_audio_collection_request()->mutable_get_tracks()->add_release_id(releaseId);
BOOST_FOREACH(uint64_t genreId, genreIds)
request.mutable_audio_collection_request()->mutable_get_tracks()->add_genre_id(genreId);
sendMsg(request);
// Receive responses
Remote::ServerMessage response;
recvMsg(response);
// Process message
if (!response.has_audio_collection_response())
throw std::runtime_error("not an audio_collection_response!");
if (!response.audio_collection_response().has_track_list())
throw std::runtime_error("not an track list!");
for (int i = 0; i < response.audio_collection_response().track_list().tracks_size(); ++i)
{
TrackInfo track;
track.id = response.audio_collection_response().track_list().tracks(i).id();
track.name = response.audio_collection_response().track_list().tracks(i).name();
track.duration = boost::posix_time::seconds(response.audio_collection_response().track_list().tracks(i).duration_secs());
tracks.push_back( track );
nbAdded++;
}
return nbAdded;
}
private:
@@ -217,7 +371,6 @@ class TestClient
_outputStreamBuf.consume(n);
std::cout << "Client: Message sent!" << std::endl;
}
else
{
@@ -235,7 +388,6 @@ class TestClient
// reserve bytes in output sequence
boost::asio::streambuf::mutable_buffers_type bufs = _inputStreamBuf.prepare(Remote::Header::size);
std::cout << "Client: waiting for header message!" << std::endl;
std::size_t n = boost::asio::read(_socket,
bufs,
boost::asio::transfer_exactly(Remote::Header::size));
@@ -243,7 +395,6 @@ class TestClient
assert(n == Remote::Header::size);
_inputStreamBuf.commit(n);
std::cout << "Client: Header message received!" << std::endl;
}
Remote::Header header;
@@ -255,7 +406,6 @@ class TestClient
// reserve bytes in output sequence
boost::asio::streambuf::mutable_buffers_type bufs = _inputStreamBuf.prepare(header.getSize());
std::cout << "Client: waiting for message!" << std::endl;
std::size_t n = boost::asio::read(_socket,
bufs,
boost::asio::transfer_exactly(header.getSize()));
@@ -263,8 +413,6 @@ class TestClient
assert(n == header.getSize());
_inputStreamBuf.commit(n);
std::cout << "Client: message received!" << std::endl;
if (!message.ParseFromIstream(&is))
throw std::runtime_error("message.ParseFromIstream failed!");
@@ -310,8 +458,32 @@ int main()
BOOST_FOREACH(const GenreInfo& genre, genres)
std::cout << "Genre: '" << genre << "'" << std::endl;
testServer.stop();
// **** Releases ******
std::vector<ReleaseInfo> releases;
client.getReleases(releases, std::vector<uint64_t>(1, 1162));
BOOST_FOREACH(const ReleaseInfo& release, releases)
std::cout << "Release: '" << release << "'" << std::endl;
// **** Tracks ******
/* {
std::vector<TrackInfo> tracks;
client.getTracks(tracks, std::vector<uint64_t>(), std::vector<uint64_t>(), std::vector<uint64_t>());
BOOST_FOREACH(const TrackInfo& track, tracks)
std::cout << "Track: '" << track << "'" << std::endl;
}*/
BOOST_FOREACH(const ArtistInfo& artist, artists)
{
// Get the tracks for each artist
std::vector<TrackInfo> tracks;
client.getTracks(tracks, std::vector<uint64_t>(1, artist.id), std::vector<uint64_t>(), std::vector<uint64_t>());
std::cout << "Artist '" << artist.name << "', nb tracks = " << tracks.size() << std::endl;
BOOST_FOREACH(const TrackInfo& track, tracks)
std::cout << "Track: '" << track << "'" << std::endl;
}
testServer.stop();
}
catch(std::exception& e)
{
+2 -3
View File
@@ -22,7 +22,6 @@ _tableView(nullptr)
_tableView->setAlternatingRowColors(true);
_tableView->setModel(&_queryModel);
_tableView->selectionChanged().connect(this, &TableFilterWidget::emitUpdate);
_tableView->selectionChanged().connect(this, &TableFilterWidget::emitUpdate);
_queryModel.setBatchSize(100);
@@ -34,13 +33,13 @@ TableFilterWidget::refresh(const Constraint& constraint)
{
SqlQuery sqlQuery;
sqlQuery.select().And( _table + "." + _field + ",count(DISTINCT track.id),0 as ORDERBY");
sqlQuery.select(_table + "." + _field + ",count(DISTINCT track.id),0 as ORDERBY");
sqlQuery.from().And( FromClause("artist,release,track,genre,track_genre")) ;
sqlQuery.where().And(constraint.where); // Add constraint made by other filters
sqlQuery.groupBy().And( _table + "." + _field); // Add constraint made by other filters
SqlQuery AllSqlQuery;
AllSqlQuery.select().And( SelectStatement("'<All>',0,1 AS ORDERBY") );
AllSqlQuery.select("'<All>',0,1 AS ORDERBY");
std::cout << _table << ", generated query = '" << sqlQuery.get() + " UNION " + AllSqlQuery.get() << "'" << std::endl;
+1
View File
@@ -28,6 +28,7 @@ class TableFilterWidget : public FilterWidget
const std::string _table;
const std::string _field;
// Name, track count, special value that means 'all' if set to 1
typedef boost::tuple<std::string, int, int> ResultType;
Wt::Dbo::QueryModel< ResultType > _queryModel;
+1 -1
View File
@@ -72,7 +72,7 @@ TrackWidget::refresh(const Constraint& constraint)
SqlQuery sqlQuery;
sqlQuery.select().And( SelectStatement( "track,release,artist" ) );
sqlQuery.select( "track,release,artist" );
sqlQuery.from().And( FromClause("artist,release,track,genre,track_genre"));
sqlQuery.where().And(constraint.where);