Revert "Use constructor for QString and make format"
This reverts commit 5a2348fae6ea545d793e612414571caafbd5ad6f.
This commit is contained in:
parent
5a2348fae6
commit
2e64b24290
@ -502,9 +502,10 @@ void TagReader::ParseOggTag(const TagLib::Ogg::FieldListMap& map,
|
|||||||
100);
|
100);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TagReader::SetVorbisComments(
|
void TagReader::SetVorbisComments(TagLib::Ogg::XiphComment* vorbis_comments,
|
||||||
TagLib::Ogg::XiphComment* vorbis_comments,
|
const pb::tagreader::SongMetadata& song)
|
||||||
const pb::tagreader::SongMetadata& song) const {
|
const {
|
||||||
|
|
||||||
vorbis_comments->addField("COMPOSER",
|
vorbis_comments->addField("COMPOSER",
|
||||||
StdStringToTaglibString(song.composer()), true);
|
StdStringToTaglibString(song.composer()), true);
|
||||||
vorbis_comments->addField("PERFORMER",
|
vorbis_comments->addField("PERFORMER",
|
||||||
@ -539,6 +540,7 @@ void TagReader::SetFMPSStatisticsVorbisComments(
|
|||||||
void TagReader::SetFMPSRatingVorbisComments(
|
void TagReader::SetFMPSRatingVorbisComments(
|
||||||
TagLib::Ogg::XiphComment* vorbis_comments,
|
TagLib::Ogg::XiphComment* vorbis_comments,
|
||||||
const pb::tagreader::SongMetadata& song) const {
|
const pb::tagreader::SongMetadata& song) const {
|
||||||
|
|
||||||
vorbis_comments->addField(
|
vorbis_comments->addField(
|
||||||
"FMPS_RATING", QStringToTaglibString(QString::number(song.rating())));
|
"FMPS_RATING", QStringToTaglibString(QString::number(song.rating())));
|
||||||
}
|
}
|
||||||
@ -951,8 +953,8 @@ bool TagReader::ReadCloudFile(const QUrl& download_url, const QString& title,
|
|||||||
pb::tagreader::SongMetadata* song) const {
|
pb::tagreader::SongMetadata* song) const {
|
||||||
qLog(Debug) << "Loading tags from" << title;
|
qLog(Debug) << "Loading tags from" << title;
|
||||||
|
|
||||||
std::unique_ptr<CloudStream> stream(new CloudStream(
|
std::unique_ptr<CloudStream> stream(
|
||||||
download_url, title, size, authorisation_header, network_));
|
new CloudStream(download_url, title, size, authorisation_header, network_));
|
||||||
stream->Precache();
|
stream->Precache();
|
||||||
std::unique_ptr<TagLib::File> tag;
|
std::unique_ptr<TagLib::File> tag;
|
||||||
if (mime_type == "audio/mpeg" && title.endsWith(".mp3")) {
|
if (mime_type == "audio/mpeg" && title.endsWith(".mp3")) {
|
||||||
@ -961,8 +963,8 @@ bool TagReader::ReadCloudFile(const QUrl& download_url, const QString& title,
|
|||||||
TagLib::AudioProperties::Accurate));
|
TagLib::AudioProperties::Accurate));
|
||||||
} else if (mime_type == "audio/mp4" ||
|
} else if (mime_type == "audio/mp4" ||
|
||||||
(mime_type == "audio/mpeg" && title.endsWith(".m4a"))) {
|
(mime_type == "audio/mpeg" && title.endsWith(".m4a"))) {
|
||||||
tag.reset(new TagLib::MP4::File(stream.get(), true,
|
tag.reset(
|
||||||
TagLib::AudioProperties::Accurate));
|
new TagLib::MP4::File(stream.get(), true, TagLib::AudioProperties::Accurate));
|
||||||
}
|
}
|
||||||
#ifdef TAGLIB_HAS_OPUS
|
#ifdef TAGLIB_HAS_OPUS
|
||||||
else if ((mime_type == "application/opus" || mime_type == "audio/opus" ||
|
else if ((mime_type == "application/opus" || mime_type == "audio/opus" ||
|
||||||
@ -981,8 +983,8 @@ bool TagReader::ReadCloudFile(const QUrl& download_url, const QString& title,
|
|||||||
TagLib::ID3v2::FrameFactory::instance(),
|
TagLib::ID3v2::FrameFactory::instance(),
|
||||||
true, TagLib::AudioProperties::Accurate));
|
true, TagLib::AudioProperties::Accurate));
|
||||||
} else if (mime_type == "audio/x-ms-wma") {
|
} else if (mime_type == "audio/x-ms-wma") {
|
||||||
tag.reset(new TagLib::ASF::File(stream.get(), true,
|
tag.reset(
|
||||||
TagLib::AudioProperties::Accurate));
|
new TagLib::ASF::File(stream.get(), true, TagLib::AudioProperties::Accurate));
|
||||||
} else {
|
} else {
|
||||||
qLog(Debug) << "Unknown mime type for tagging:" << mime_type;
|
qLog(Debug) << "Unknown mime type for tagging:" << mime_type;
|
||||||
return false;
|
return false;
|
||||||
|
@ -534,7 +534,7 @@ void Song::ToProtobuf(pb::tagreader::SongMetadata* pb) const {
|
|||||||
pb->set_filesize(d->filesize_);
|
pb->set_filesize(d->filesize_);
|
||||||
pb->set_suspicious_tags(d->suspicious_tags_);
|
pb->set_suspicious_tags(d->suspicious_tags_);
|
||||||
pb->set_art_automatic(DataCommaSizeFromQString(d->art_automatic_));
|
pb->set_art_automatic(DataCommaSizeFromQString(d->art_automatic_));
|
||||||
pb->set_type(static_cast<::pb::tagreader::SongMetadata_Type>(d->filetype_));
|
pb->set_type(static_cast< ::pb::tagreader::SongMetadata_Type>(d->filetype_));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Song::InitFromQuery(const SqlRow& q, bool reliable_metadata, int col) {
|
void Song::InitFromQuery(const SqlRow& q, bool reliable_metadata, int col) {
|
||||||
@ -887,8 +887,8 @@ void Song::BindToQuery(QSqlQuery* query) const {
|
|||||||
|
|
||||||
if (Application::kIsPortable &&
|
if (Application::kIsPortable &&
|
||||||
Utilities::UrlOnSameDriveAsClementine(d->url_)) {
|
Utilities::UrlOnSameDriveAsClementine(d->url_)) {
|
||||||
query->bindValue(":filename", Utilities::GetRelativePathToClementineBin(
|
query->bindValue(":filename",
|
||||||
d->url_).toEncoded());
|
Utilities::GetRelativePathToClementineBin(d->url_).toEncoded());
|
||||||
} else {
|
} else {
|
||||||
query->bindValue(":filename", d->url_.toEncoded());
|
query->bindValue(":filename", d->url_.toEncoded());
|
||||||
}
|
}
|
||||||
|
@ -139,10 +139,10 @@ SongLoader::Result SongLoader::LoadLocalPartial(const QString& filename) {
|
|||||||
SongLoader::Result SongLoader::LoadAudioCD() {
|
SongLoader::Result SongLoader::LoadAudioCD() {
|
||||||
#ifdef HAVE_AUDIOCD
|
#ifdef HAVE_AUDIOCD
|
||||||
CddaSongLoader* cdda_song_loader = new CddaSongLoader;
|
CddaSongLoader* cdda_song_loader = new CddaSongLoader;
|
||||||
connect(cdda_song_loader, SIGNAL(SongsDurationLoaded(SongList)), this,
|
connect(cdda_song_loader, SIGNAL(SongsDurationLoaded(SongList)),
|
||||||
SLOT(AudioCDTracksLoadedSlot(SongList)));
|
this, SLOT(AudioCDTracksLoadedSlot(SongList)));
|
||||||
connect(cdda_song_loader, SIGNAL(SongsMetadataLoaded(SongList)), this,
|
connect(cdda_song_loader, SIGNAL(SongsMetadataLoaded(SongList)),
|
||||||
SLOT(AudioCDTracksTagsLoaded(SongList)));
|
this, SLOT(AudioCDTracksTagsLoaded(SongList)));
|
||||||
cdda_song_loader->LoadSongs();
|
cdda_song_loader->LoadSongs();
|
||||||
return Success;
|
return Success;
|
||||||
#else // HAVE_AUDIOCD
|
#else // HAVE_AUDIOCD
|
||||||
@ -162,7 +162,7 @@ void SongLoader::AudioCDTracksTagsLoaded(const SongList& songs) {
|
|||||||
songs_ = songs;
|
songs_ = songs;
|
||||||
emit LoadAudioCDFinished(true);
|
emit LoadAudioCDFinished(true);
|
||||||
}
|
}
|
||||||
#endif // HAVE_AUDIOCD
|
#endif // HAVE_AUDIOCD
|
||||||
|
|
||||||
SongLoader::Result SongLoader::LoadLocal(const QString& filename) {
|
SongLoader::Result SongLoader::LoadLocal(const QString& filename) {
|
||||||
qLog(Debug) << "Loading local file" << filename;
|
qLog(Debug) << "Loading local file" << filename;
|
||||||
@ -189,11 +189,13 @@ SongLoader::Result SongLoader::LoadLocal(const QString& filename) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// It's not in the database, load it asynchronously.
|
// It's not in the database, load it asynchronously.
|
||||||
preload_func_ = std::bind(&SongLoader::LoadLocalAsync, this, filename);
|
preload_func_ =
|
||||||
|
std::bind(&SongLoader::LoadLocalAsync, this, filename);
|
||||||
return BlockingLoadRequired;
|
return BlockingLoadRequired;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SongLoader::LoadLocalAsync(const QString& filename) {
|
void SongLoader::LoadLocalAsync(const QString& filename) {
|
||||||
|
|
||||||
// First check to see if it's a directory - if so we will load all the songs
|
// First check to see if it's a directory - if so we will load all the songs
|
||||||
// inside right away.
|
// inside right away.
|
||||||
if (QFileInfo(filename).isDir()) {
|
if (QFileInfo(filename).isDir()) {
|
||||||
@ -211,8 +213,7 @@ void SongLoader::LoadLocalAsync(const QString& filename) {
|
|||||||
if (!parser) {
|
if (!parser) {
|
||||||
// Check the file extension as well, maybe the magic failed, or it was a
|
// Check the file extension as well, maybe the magic failed, or it was a
|
||||||
// basic M3U file which is just a plain list of filenames.
|
// basic M3U file which is just a plain list of filenames.
|
||||||
parser = playlist_parser_->ParserForExtension(
|
parser = playlist_parser_->ParserForExtension(QFileInfo(filename).suffix().toLower());
|
||||||
QFileInfo(filename).suffix().toLower());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parser) {
|
if (parser) {
|
||||||
@ -232,7 +233,7 @@ void SongLoader::LoadLocalAsync(const QString& filename) {
|
|||||||
|
|
||||||
SongList song_list = cue_parser_->Load(&cue, matching_cue,
|
SongList song_list = cue_parser_->Load(&cue, matching_cue,
|
||||||
QDir(filename.section('/', 0, -2)));
|
QDir(filename.section('/', 0, -2)));
|
||||||
for (Song song : song_list) {
|
for (Song song: song_list){
|
||||||
if (song.is_valid()) songs_ << song;
|
if (song.is_valid()) songs_ << song;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -402,7 +403,8 @@ void SongLoader::LoadRemote() {
|
|||||||
|
|
||||||
// Add a probe to the sink so we can capture the data if it's a playlist
|
// Add a probe to the sink so we can capture the data if it's a playlist
|
||||||
GstPad* pad = gst_element_get_static_pad(fakesink, "sink");
|
GstPad* pad = gst_element_get_static_pad(fakesink, "sink");
|
||||||
gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_BUFFER, &DataReady, this, NULL);
|
gst_pad_add_probe(
|
||||||
|
pad, GST_PAD_PROBE_TYPE_BUFFER, &DataReady, this, NULL);
|
||||||
gst_object_unref(pad);
|
gst_object_unref(pad);
|
||||||
|
|
||||||
QEventLoop loop;
|
QEventLoop loop;
|
||||||
@ -438,11 +440,12 @@ void SongLoader::TypeFound(GstElement*, uint, GstCaps* caps, void* self) {
|
|||||||
instance->StopTypefindAsync(true);
|
instance->StopTypefindAsync(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
GstPadProbeReturn SongLoader::DataReady(GstPad*, GstPadProbeInfo* info,
|
GstPadProbeReturn SongLoader::DataReady(
|
||||||
gpointer self) {
|
GstPad*, GstPadProbeInfo* info, gpointer self) {
|
||||||
SongLoader* instance = reinterpret_cast<SongLoader*>(self);
|
SongLoader* instance = reinterpret_cast<SongLoader*>(self);
|
||||||
|
|
||||||
if (instance->state_ == Finished) return GST_PAD_PROBE_OK;
|
if (instance->state_ == Finished)
|
||||||
|
return GST_PAD_PROBE_OK;
|
||||||
|
|
||||||
GstBuffer* buffer = gst_pad_probe_info_get_buffer(info);
|
GstBuffer* buffer = gst_pad_probe_info_get_buffer(info);
|
||||||
GstMapInfo map;
|
GstMapInfo map;
|
||||||
|
@ -84,15 +84,10 @@ signals:
|
|||||||
#ifdef HAVE_AUDIOCD
|
#ifdef HAVE_AUDIOCD
|
||||||
void AudioCDTracksLoadedSlot(const SongList& songs);
|
void AudioCDTracksLoadedSlot(const SongList& songs);
|
||||||
void AudioCDTracksTagsLoaded(const SongList& songs);
|
void AudioCDTracksTagsLoaded(const SongList& songs);
|
||||||
#endif // HAVE_AUDIOCD
|
#endif // HAVE_AUDIOCD
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum State {
|
enum State { WaitingForType, WaitingForMagic, WaitingForData, Finished, };
|
||||||
WaitingForType,
|
|
||||||
WaitingForMagic,
|
|
||||||
WaitingForData,
|
|
||||||
Finished,
|
|
||||||
};
|
|
||||||
|
|
||||||
Result LoadLocal(const QString& filename);
|
Result LoadLocal(const QString& filename);
|
||||||
void LoadLocalAsync(const QString& filename);
|
void LoadLocalAsync(const QString& filename);
|
||||||
|
@ -28,14 +28,14 @@ CddaDevice::CddaDevice(const QUrl& url, DeviceLister* lister,
|
|||||||
: ConnectedDevice(url, lister, unique_id, manager, app, database_id,
|
: ConnectedDevice(url, lister, unique_id, manager, app, database_id,
|
||||||
first_time),
|
first_time),
|
||||||
cdda_song_loader_(url) {
|
cdda_song_loader_(url) {
|
||||||
connect(&cdda_song_loader_, SIGNAL(SongsLoaded(SongList)), this,
|
connect(&cdda_song_loader_, SIGNAL(SongsLoaded(SongList)),
|
||||||
SLOT(SongsLoaded(SongList)));
|
this, SLOT(SongsLoaded(SongList)));
|
||||||
connect(&cdda_song_loader_, SIGNAL(SongsDurationLoaded(SongList)), this,
|
connect(&cdda_song_loader_, SIGNAL(SongsDurationLoaded(SongList)),
|
||||||
SLOT(SongsLoaded(SongList)));
|
this, SLOT(SongsLoaded(SongList)));
|
||||||
connect(&cdda_song_loader_, SIGNAL(SongsMetadataLoaded(SongList)), this,
|
connect(&cdda_song_loader_, SIGNAL(SongsMetadataLoaded(SongList)),
|
||||||
SLOT(SongsLoaded(SongList)));
|
this, SLOT(SongsLoaded(SongList)));
|
||||||
connect(this, SIGNAL(SongsDiscovered(SongList)), model_,
|
connect(this, SIGNAL(SongsDiscovered(SongList)),
|
||||||
SLOT(SongsDiscovered(SongList)));
|
model_, SLOT(SongsDiscovered(SongList)));
|
||||||
}
|
}
|
||||||
|
|
||||||
CddaDevice::~CddaDevice() {}
|
CddaDevice::~CddaDevice() {}
|
||||||
|
@ -24,7 +24,10 @@
|
|||||||
#include "cddasongloader.h"
|
#include "cddasongloader.h"
|
||||||
|
|
||||||
CddaSongLoader::CddaSongLoader(const QUrl& url, QObject* parent)
|
CddaSongLoader::CddaSongLoader(const QUrl& url, QObject* parent)
|
||||||
: QObject(parent), url_(url), cdda_(nullptr), cdio_(nullptr) {}
|
: QObject(parent),
|
||||||
|
url_(url),
|
||||||
|
cdda_(nullptr),
|
||||||
|
cdio_(nullptr) {}
|
||||||
|
|
||||||
CddaSongLoader::~CddaSongLoader() {
|
CddaSongLoader::~CddaSongLoader() {
|
||||||
if (cdio_) cdio_destroy(cdio_);
|
if (cdio_) cdio_destroy(cdio_);
|
||||||
@ -55,12 +58,11 @@ void CddaSongLoader::LoadSongs() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!url_.isEmpty()) {
|
if (!url_.isEmpty()) {
|
||||||
g_object_set(cdda_, "device",
|
g_object_set(cdda_, "device", g_strdup(url_.path().toLocal8Bit().constData()),
|
||||||
g_strdup(url_.path().toLocal8Bit().constData()), nullptr);
|
nullptr);
|
||||||
}
|
}
|
||||||
if (g_object_class_find_property(G_OBJECT_GET_CLASS(cdda_),
|
if (g_object_class_find_property (G_OBJECT_GET_CLASS (cdda_), "paranoia-mode")) {
|
||||||
"paranoia-mode")) {
|
g_object_set (cdda_, "paranoia-mode", 0, NULL);
|
||||||
g_object_set(cdda_, "paranoia-mode", 0, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change the element's state to ready and paused, to be able to query it
|
// Change the element's state to ready and paused, to be able to query it
|
||||||
@ -91,19 +93,21 @@ void CddaSongLoader::LoadSongs() {
|
|||||||
song.set_id(track_number);
|
song.set_id(track_number);
|
||||||
song.set_valid(true);
|
song.set_valid(true);
|
||||||
song.set_filetype(Song::Type_Cdda);
|
song.set_filetype(Song::Type_Cdda);
|
||||||
song.set_url(GetUrlFromTrack(track_number));
|
song.set_url(
|
||||||
|
GetUrlFromTrack(track_number));
|
||||||
song.set_title(QString("Track %1").arg(track_number));
|
song.set_title(QString("Track %1").arg(track_number));
|
||||||
song.set_track(track_number);
|
song.set_track(track_number);
|
||||||
songs << song;
|
songs << song;
|
||||||
}
|
}
|
||||||
emit SongsLoaded(songs);
|
emit SongsLoaded(songs);
|
||||||
|
|
||||||
|
|
||||||
gst_tag_register_musicbrainz_tags();
|
gst_tag_register_musicbrainz_tags();
|
||||||
|
|
||||||
GstElement* pipeline = gst_pipeline_new("pipeline");
|
GstElement* pipeline = gst_pipeline_new("pipeline");
|
||||||
GstElement* sink = gst_element_factory_make("fakesink", NULL);
|
GstElement* sink = gst_element_factory_make ("fakesink", NULL);
|
||||||
gst_bin_add_many(GST_BIN(pipeline), cdda_, sink, NULL);
|
gst_bin_add_many (GST_BIN (pipeline), cdda_, sink, NULL);
|
||||||
gst_element_link(cdda_, sink);
|
gst_element_link (cdda_, sink);
|
||||||
gst_element_set_state(pipeline, GST_STATE_READY);
|
gst_element_set_state(pipeline, GST_STATE_READY);
|
||||||
gst_element_set_state(pipeline, GST_STATE_PAUSED);
|
gst_element_set_state(pipeline, GST_STATE_PAUSED);
|
||||||
|
|
||||||
@ -111,12 +115,10 @@ void CddaSongLoader::LoadSongs() {
|
|||||||
GstMessage* msg = nullptr;
|
GstMessage* msg = nullptr;
|
||||||
GstMessage* msg_toc = nullptr;
|
GstMessage* msg_toc = nullptr;
|
||||||
GstMessage* msg_tag = nullptr;
|
GstMessage* msg_tag = nullptr;
|
||||||
while ((msg = gst_bus_timed_pop_filtered(
|
while ((msg = gst_bus_timed_pop_filtered(GST_ELEMENT_BUS(pipeline),
|
||||||
GST_ELEMENT_BUS(pipeline), GST_SECOND,
|
GST_SECOND, (GstMessageType)(GST_MESSAGE_TOC | GST_MESSAGE_TAG)))) {
|
||||||
(GstMessageType)(GST_MESSAGE_TOC | GST_MESSAGE_TAG)))) {
|
|
||||||
if (GST_MESSAGE_TYPE(msg) == GST_MESSAGE_TOC) {
|
if (GST_MESSAGE_TYPE(msg) == GST_MESSAGE_TOC) {
|
||||||
if (msg_toc)
|
if (msg_toc) gst_message_unref(msg_toc); // Shouldn't happen, but just in case
|
||||||
gst_message_unref(msg_toc); // Shouldn't happen, but just in case
|
|
||||||
msg_toc = msg;
|
msg_toc = msg;
|
||||||
} else if (GST_MESSAGE_TYPE(msg) == GST_MESSAGE_TAG) {
|
} else if (GST_MESSAGE_TYPE(msg) == GST_MESSAGE_TAG) {
|
||||||
if (msg_tag) gst_message_unref(msg_tag);
|
if (msg_tag) gst_message_unref(msg_tag);
|
||||||
@ -127,16 +129,16 @@ void CddaSongLoader::LoadSongs() {
|
|||||||
// Handle TOC message: get tracks duration
|
// Handle TOC message: get tracks duration
|
||||||
if (msg_toc) {
|
if (msg_toc) {
|
||||||
GstToc* toc;
|
GstToc* toc;
|
||||||
gst_message_parse_toc(msg_toc, &toc, nullptr);
|
gst_message_parse_toc (msg_toc, &toc, nullptr);
|
||||||
if (toc) {
|
if (toc) {
|
||||||
GList* entries = gst_toc_get_entries(toc);
|
GList* entries = gst_toc_get_entries(toc);
|
||||||
if (entries && songs.size() <= g_list_length(entries)) {
|
if (entries && songs.size() <= g_list_length (entries)) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (GList* node = entries; node != nullptr; node = node->next) {
|
for (GList* node = entries; node != nullptr; node = node->next) {
|
||||||
GstTocEntry* entry = static_cast<GstTocEntry*>(node->data);
|
GstTocEntry *entry = static_cast<GstTocEntry*>(node->data);
|
||||||
quint64 duration = 0;
|
quint64 duration = 0;
|
||||||
gint64 start, stop;
|
gint64 start, stop;
|
||||||
if (gst_toc_entry_get_start_stop_times(entry, &start, &stop))
|
if (gst_toc_entry_get_start_stop_times (entry, &start, &stop))
|
||||||
duration = stop - start;
|
duration = stop - start;
|
||||||
songs[i++].set_length_nanosec(duration);
|
songs[i++].set_length_nanosec(duration);
|
||||||
}
|
}
|
||||||
@ -157,9 +159,8 @@ void CddaSongLoader::LoadSongs() {
|
|||||||
qLog(Info) << "MusicBrainz discid: " << musicbrainz_discid;
|
qLog(Info) << "MusicBrainz discid: " << musicbrainz_discid;
|
||||||
|
|
||||||
MusicBrainzClient* musicbrainz_client = new MusicBrainzClient;
|
MusicBrainzClient* musicbrainz_client = new MusicBrainzClient;
|
||||||
connect(musicbrainz_client,
|
connect(musicbrainz_client, SIGNAL(Finished(const QString&, const QString&,
|
||||||
SIGNAL(Finished(const QString&, const QString&,
|
MusicBrainzClient::ResultList)),
|
||||||
MusicBrainzClient::ResultList)),
|
|
||||||
SLOT(AudioCDTagsLoaded(const QString&, const QString&,
|
SLOT(AudioCDTagsLoaded(const QString&, const QString&,
|
||||||
MusicBrainzClient::ResultList)));
|
MusicBrainzClient::ResultList)));
|
||||||
musicbrainz_client->StartDiscIdRequest(musicbrainz_discid);
|
musicbrainz_client->StartDiscIdRequest(musicbrainz_discid);
|
||||||
|
@ -37,23 +37,23 @@ class CddaSongLoader : public QObject {
|
|||||||
public:
|
public:
|
||||||
CddaSongLoader(
|
CddaSongLoader(
|
||||||
// Url of the CD device. Will use the default device if empty
|
// Url of the CD device. Will use the default device if empty
|
||||||
const QUrl& url = QUrl(), QObject* parent = nullptr);
|
const QUrl& url = QUrl(),
|
||||||
|
QObject* parent = nullptr);
|
||||||
~CddaSongLoader();
|
~CddaSongLoader();
|
||||||
|
|
||||||
// Load songs.
|
// Load songs.
|
||||||
// Signals declared below will be emitted anytime new information will be
|
// Signals declared below will be emitted anytime new information will be available.
|
||||||
// available.
|
|
||||||
void LoadSongs();
|
void LoadSongs();
|
||||||
bool HasChanged();
|
bool HasChanged();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void SongsLoaded(const SongList& songs);
|
void SongsLoaded(const SongList& songs);
|
||||||
void SongsDurationLoaded(const SongList& songs);
|
void SongsDurationLoaded(const SongList& songs);
|
||||||
void SongsMetadataLoaded(const SongList& songs);
|
void SongsMetadataLoaded(const SongList& songs);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void AudioCDTagsLoaded(const QString& artist, const QString& album,
|
void AudioCDTagsLoaded(const QString& artist, const QString& album,
|
||||||
const MusicBrainzClient::ResultList& results);
|
const MusicBrainzClient::ResultList& results);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QUrl GetUrlFromTrack(int track_number) const;
|
QUrl GetUrlFromTrack(int track_number) const;
|
||||||
@ -64,4 +64,4 @@ signals:
|
|||||||
QMutex mutex_load_;
|
QMutex mutex_load_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CDDASONGLOADER_H
|
#endif // CDDASONGLOADER_H
|
||||||
|
@ -253,13 +253,13 @@ void DeviceProperties::accept() {
|
|||||||
.toInt());
|
.toInt());
|
||||||
|
|
||||||
// By default no icon is selected and thus no current item is selected
|
// By default no icon is selected and thus no current item is selected
|
||||||
QString icon_name;
|
QString icon_name = "";
|
||||||
if (ui_->icon->currentItem() != nullptr) {
|
if(ui_->icon->currentItem() != nullptr) {
|
||||||
icon_name = ui_->icon->currentItem()->data(Qt::UserRole).toString();
|
icon_name = ui_->icon->currentItem()->data(Qt::UserRole).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
manager_->SetDeviceOptions(index_.row(), ui_->name->text(), icon_name, mode,
|
manager_->SetDeviceOptions(
|
||||||
format);
|
index_.row(), ui_->name->text(), icon_name, mode,format);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceProperties::OpenDevice() { manager_->Connect(index_.row()); }
|
void DeviceProperties::OpenDevice() { manager_->Connect(index_.row()); }
|
||||||
|
@ -285,8 +285,8 @@ void GstEngine::UpdateScope(int chunk_length) {
|
|||||||
gst_buffer_map(latest_buffer_, &map, GST_MAP_READ);
|
gst_buffer_map(latest_buffer_, &map, GST_MAP_READ);
|
||||||
|
|
||||||
// determine where to split the buffer
|
// determine where to split the buffer
|
||||||
int chunk_density =
|
int chunk_density = (map.size * kNsecPerMsec) /
|
||||||
(map.size * kNsecPerMsec) / GST_BUFFER_DURATION(latest_buffer_);
|
GST_BUFFER_DURATION(latest_buffer_);
|
||||||
|
|
||||||
int chunk_size = chunk_length * chunk_density;
|
int chunk_size = chunk_length * chunk_density;
|
||||||
|
|
||||||
@ -304,9 +304,10 @@ void GstEngine::UpdateScope(int chunk_length) {
|
|||||||
|
|
||||||
// make sure we don't go beyond the end of the buffer
|
// make sure we don't go beyond the end of the buffer
|
||||||
if (scope_chunk_ == scope_chunks_ - 1) {
|
if (scope_chunk_ == scope_chunks_ - 1) {
|
||||||
bytes = qMin(static_cast<Engine::Scope::size_type>(
|
bytes =
|
||||||
map.size - (chunk_size * scope_chunk_)),
|
qMin(static_cast<Engine::Scope::size_type>(
|
||||||
scope_.size() * sizeof(sample_type));
|
map.size - (chunk_size * scope_chunk_)),
|
||||||
|
scope_.size() * sizeof(sample_type));
|
||||||
} else {
|
} else {
|
||||||
bytes = qMin(static_cast<Engine::Scope::size_type>(chunk_size),
|
bytes = qMin(static_cast<Engine::Scope::size_type>(chunk_size),
|
||||||
scope_.size() * sizeof(sample_type));
|
scope_.size() * sizeof(sample_type));
|
||||||
@ -738,8 +739,9 @@ GstEngine::PluginDetailsList GstEngine::GetPluginList(
|
|||||||
if (QString(gst_element_factory_get_klass(factory)).contains(classname)) {
|
if (QString(gst_element_factory_get_klass(factory)).contains(classname)) {
|
||||||
PluginDetails details;
|
PluginDetails details;
|
||||||
details.name = QString::fromUtf8(gst_plugin_feature_get_name(p->data));
|
details.name = QString::fromUtf8(gst_plugin_feature_get_name(p->data));
|
||||||
details.description = QString::fromUtf8(gst_element_factory_get_metadata(
|
details.description = QString::fromUtf8(
|
||||||
factory, GST_ELEMENT_METADATA_DESCRIPTION));
|
gst_element_factory_get_metadata(factory,
|
||||||
|
GST_ELEMENT_METADATA_DESCRIPTION));
|
||||||
ret << details;
|
ret << details;
|
||||||
}
|
}
|
||||||
p = g_list_next(p);
|
p = g_list_next(p);
|
||||||
|
@ -249,8 +249,7 @@ void GlobalSearchModel::GetChildResults(
|
|||||||
if (is_provider) {
|
if (is_provider) {
|
||||||
// Go through all the items (through the proxy to keep them ordered) and
|
// Go through all the items (through the proxy to keep them ordered) and
|
||||||
// add the ones belonging to this provider to our list
|
// add the ones belonging to this provider to our list
|
||||||
for (int i = 0; i < proxy_->rowCount(invisibleRootItem()->index());
|
for (int i = 0; i < proxy_->rowCount(invisibleRootItem()->index()); ++i) {
|
||||||
++i) {
|
|
||||||
QModelIndex child_index =
|
QModelIndex child_index =
|
||||||
proxy_->index(i, 0, invisibleRootItem()->index());
|
proxy_->index(i, 0, invisibleRootItem()->index());
|
||||||
const QStandardItem* child_item =
|
const QStandardItem* child_item =
|
||||||
|
@ -249,14 +249,16 @@ SkyFmService::SkyFmService(Application* app, InternetModel* model,
|
|||||||
|
|
||||||
JazzRadioService::JazzRadioService(Application* app, InternetModel* model,
|
JazzRadioService::JazzRadioService(Application* app, InternetModel* model,
|
||||||
QObject* parent)
|
QObject* parent)
|
||||||
: DigitallyImportedServiceBase("JazzRadio", "JAZZRADIO.com",
|
: DigitallyImportedServiceBase(
|
||||||
QUrl("http://www.jazzradio.com"),
|
"JazzRadio", "JAZZRADIO.com", QUrl("http://www.jazzradio.com"),
|
||||||
QIcon(":/providers/jazzradio.png"),
|
QIcon(":/providers/jazzradio.png"), "jazzradio", app, model, true,
|
||||||
"jazzradio", app, model, true, parent) {}
|
parent) {
|
||||||
|
}
|
||||||
|
|
||||||
RockRadioService::RockRadioService(Application* app, InternetModel* model,
|
RockRadioService::RockRadioService(Application* app, InternetModel* model,
|
||||||
QObject* parent)
|
QObject* parent)
|
||||||
: DigitallyImportedServiceBase("RockRadio", "ROCKRADIO.com",
|
: DigitallyImportedServiceBase(
|
||||||
QUrl("http://www.rockradio.com"),
|
"RockRadio", "ROCKRADIO.com", QUrl("http://www.rockradio.com"),
|
||||||
QIcon(":/providers/rockradio.png"),
|
QIcon(":/providers/rockradio.png"), "rockradio", app, model, false,
|
||||||
"rockradio", app, model, false, parent) {}
|
parent) {
|
||||||
|
}
|
||||||
|
@ -38,7 +38,8 @@ class DigitallyImportedServiceBase : public InternetService {
|
|||||||
const QUrl& homepage_url, const QIcon& icon,
|
const QUrl& homepage_url, const QIcon& icon,
|
||||||
const QString& api_service_name,
|
const QString& api_service_name,
|
||||||
Application* app, InternetModel* model,
|
Application* app, InternetModel* model,
|
||||||
bool has_premium, QObject* parent = nullptr);
|
bool has_premium,
|
||||||
|
QObject* parent = nullptr);
|
||||||
~DigitallyImportedServiceBase();
|
~DigitallyImportedServiceBase();
|
||||||
|
|
||||||
static const char* kSettingsGroup;
|
static const char* kSettingsGroup;
|
||||||
@ -97,7 +98,7 @@ signals:
|
|||||||
int premium_audio_type_;
|
int premium_audio_type_;
|
||||||
QString username_;
|
QString username_;
|
||||||
QString listen_hash_;
|
QString listen_hash_;
|
||||||
bool has_premium_; // Does the service has premium features?
|
bool has_premium_; // Does the service has premium features?
|
||||||
|
|
||||||
QStandardItem* root_;
|
QStandardItem* root_;
|
||||||
|
|
||||||
@ -117,8 +118,7 @@ class DigitallyImportedService : public DigitallyImportedServiceBase {
|
|||||||
|
|
||||||
class SkyFmService : public DigitallyImportedServiceBase {
|
class SkyFmService : public DigitallyImportedServiceBase {
|
||||||
public:
|
public:
|
||||||
SkyFmService(Application* app, InternetModel* model,
|
SkyFmService(Application* app, InternetModel* model, QObject* parent = nullptr);
|
||||||
QObject* parent = nullptr);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class JazzRadioService : public DigitallyImportedServiceBase {
|
class JazzRadioService : public DigitallyImportedServiceBase {
|
||||||
|
@ -54,10 +54,10 @@ class GroupByDialogPrivate {
|
|||||||
Mapping,
|
Mapping,
|
||||||
indexed_by<
|
indexed_by<
|
||||||
ordered_unique<tag<tag_index>,
|
ordered_unique<tag<tag_index>,
|
||||||
member<Mapping, int, &Mapping::combo_box_index>>,
|
member<Mapping, int, &Mapping::combo_box_index> >,
|
||||||
ordered_unique<tag<tag_group_by>,
|
ordered_unique<tag<tag_group_by>,
|
||||||
member<Mapping, LibraryModel::GroupBy,
|
member<Mapping, LibraryModel::GroupBy,
|
||||||
&Mapping::group_by>>>> MappingContainer;
|
&Mapping::group_by> > > > MappingContainer;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MappingContainer mapping_;
|
MappingContainer mapping_;
|
||||||
|
@ -918,8 +918,7 @@ LibraryItem* LibraryModel::ItemFromQuery(GroupBy type, bool signal,
|
|||||||
item->metadata.set_album(row.value(1).toString());
|
item->metadata.set_album(row.value(1).toString());
|
||||||
item->metadata.set_grouping(row.value(2).toString());
|
item->metadata.set_grouping(row.value(2).toString());
|
||||||
item->key = PrettyYearAlbum(year, item->metadata.album());
|
item->key = PrettyYearAlbum(year, item->metadata.album());
|
||||||
item->sort_text = SortTextForYear(year) + item->metadata.grouping() +
|
item->sort_text = SortTextForYear(year) + item->metadata.grouping() + item->metadata.album();
|
||||||
item->metadata.album();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GroupBy_Year:
|
case GroupBy_Year:
|
||||||
|
@ -55,8 +55,8 @@ void MusicBrainzClient::Start(int id, const QStringList& mbid_list) {
|
|||||||
|
|
||||||
QNetworkReply* reply = network_->get(req);
|
QNetworkReply* reply = network_->get(req);
|
||||||
NewClosure(reply, SIGNAL(finished()), this,
|
NewClosure(reply, SIGNAL(finished()), this,
|
||||||
SLOT(RequestFinished(QNetworkReply*, int, int)), reply, id,
|
SLOT(RequestFinished(QNetworkReply*, int, int)),
|
||||||
request_number++);
|
reply, id, request_number++);
|
||||||
requests_.insert(id, reply);
|
requests_.insert(id, reply);
|
||||||
|
|
||||||
timeouts_->AddReply(reply);
|
timeouts_->AddReply(reply);
|
||||||
@ -102,9 +102,9 @@ void MusicBrainzClient::DiscIdRequestFinished(const QString& discid,
|
|||||||
|
|
||||||
if (reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() !=
|
if (reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() !=
|
||||||
200) {
|
200) {
|
||||||
qLog(Error) << "Error:"
|
qLog(Error) << "Error:" <<
|
||||||
<< reply->attribute(QNetworkRequest::HttpStatusCodeAttribute)
|
reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() <<
|
||||||
.toInt() << "http status code received";
|
"http status code received";
|
||||||
qLog(Error) << reply->readAll();
|
qLog(Error) << reply->readAll();
|
||||||
emit Finished(artist, album, ret);
|
emit Finished(artist, album, ret);
|
||||||
return;
|
return;
|
||||||
@ -154,15 +154,13 @@ void MusicBrainzClient::DiscIdRequestFinished(const QString& discid,
|
|||||||
emit Finished(artist, album, UniqueResults(ret, SortResults));
|
emit Finished(artist, album, UniqueResults(ret, SortResults));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MusicBrainzClient::RequestFinished(QNetworkReply* reply, int id,
|
void MusicBrainzClient::RequestFinished(QNetworkReply* reply, int id, int request_number) {
|
||||||
int request_number) {
|
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
|
|
||||||
const int nb_removed = requests_.remove(id, reply);
|
const int nb_removed = requests_.remove(id, reply);
|
||||||
if (nb_removed != 1) {
|
if (nb_removed != 1) {
|
||||||
qLog(Error)
|
qLog(Error) << "Error: unknown reply received:" << nb_removed <<
|
||||||
<< "Error: unknown reply received:" << nb_removed
|
"requests removed, while only one was supposed to be removed";
|
||||||
<< "requests removed, while only one was supposed to be removed";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() ==
|
if (reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() ==
|
||||||
@ -182,9 +180,8 @@ void MusicBrainzClient::RequestFinished(QNetworkReply* reply, int id,
|
|||||||
}
|
}
|
||||||
pending_results_[id] << PendingResults(request_number, res);
|
pending_results_[id] << PendingResults(request_number, res);
|
||||||
} else {
|
} else {
|
||||||
qLog(Error) << "Error:"
|
qLog(Error) << "Error:" << reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() <<
|
||||||
<< reply->attribute(QNetworkRequest::HttpStatusCodeAttribute)
|
"http status code received";
|
||||||
.toInt() << "http status code received";
|
|
||||||
qLog(Error) << reply->readAll();
|
qLog(Error) << reply->readAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -361,6 +358,7 @@ MusicBrainzClient::Release MusicBrainzClient::ParseRelease(
|
|||||||
|
|
||||||
MusicBrainzClient::ResultList MusicBrainzClient::UniqueResults(
|
MusicBrainzClient::ResultList MusicBrainzClient::UniqueResults(
|
||||||
const ResultList& results, UniqueResultsSortOption opt) {
|
const ResultList& results, UniqueResultsSortOption opt) {
|
||||||
|
|
||||||
ResultList ret;
|
ResultList ret;
|
||||||
if (opt == SortResults) {
|
if (opt == SortResults) {
|
||||||
ret = QSet<Result>::fromList(results).toList();
|
ret = QSet<Result>::fromList(results).toList();
|
||||||
|
@ -295,8 +295,7 @@ void IncomingDataParser::RateSong(const pb::remote::Message& msg) {
|
|||||||
emit RateCurrentSong(rating);
|
emit RateCurrentSong(rating);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IncomingDataParser::GlobalSearch(RemoteClient* client,
|
void IncomingDataParser::GlobalSearch(RemoteClient *client, const pb::remote::Message &msg) {
|
||||||
const pb::remote::Message& msg) {
|
|
||||||
emit DoGlobalSearch(QStringFromStdString(msg.request_global_search().query()),
|
emit DoGlobalSearch(QStringFromStdString(msg.request_global_search().query()),
|
||||||
client);
|
client);
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,8 @@ void OutgoingDataCreator::SetClients(QList<RemoteClient*>* clients) {
|
|||||||
SLOT(ResultsAvailable(int, SearchProvider::ResultList)),
|
SLOT(ResultsAvailable(int, SearchProvider::ResultList)),
|
||||||
Qt::QueuedConnection);
|
Qt::QueuedConnection);
|
||||||
|
|
||||||
connect(app_->global_search(), SIGNAL(SearchFinished(int)),
|
connect(app_->global_search(),
|
||||||
|
SIGNAL(SearchFinished(int)),
|
||||||
SLOT(SearchFinished(int)));
|
SLOT(SearchFinished(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,8 +130,8 @@ void OutgoingDataCreator::CheckEnabledProviders() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SongInfoProvider* OutgoingDataCreator::ProviderByName(
|
SongInfoProvider* OutgoingDataCreator::ProviderByName(const QString& name)
|
||||||
const QString& name) const {
|
const {
|
||||||
for (SongInfoProvider* provider : fetcher_->providers()) {
|
for (SongInfoProvider* provider : fetcher_->providers()) {
|
||||||
if (UltimateLyricsProvider* lyrics =
|
if (UltimateLyricsProvider* lyrics =
|
||||||
qobject_cast<UltimateLyricsProvider*>(provider)) {
|
qobject_cast<UltimateLyricsProvider*>(provider)) {
|
||||||
@ -580,6 +581,7 @@ void OutgoingDataCreator::SendLyrics(int id,
|
|||||||
|
|
||||||
void OutgoingDataCreator::SendSongs(
|
void OutgoingDataCreator::SendSongs(
|
||||||
const pb::remote::RequestDownloadSongs& request, RemoteClient* client) {
|
const pb::remote::RequestDownloadSongs& request, RemoteClient* client) {
|
||||||
|
|
||||||
if (!download_queue_.contains(client)) {
|
if (!download_queue_.contains(client)) {
|
||||||
download_queue_.insert(client, QQueue<DownloadItem>());
|
download_queue_.insert(client, QQueue<DownloadItem>());
|
||||||
}
|
}
|
||||||
@ -610,7 +612,7 @@ void OutgoingDataCreator::SendSongs(
|
|||||||
OfferNextSong(client);
|
OfferNextSong(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutgoingDataCreator::SendTotalFileSize(RemoteClient* client) {
|
void OutgoingDataCreator::SendTotalFileSize(RemoteClient *client) {
|
||||||
if (!download_queue_.contains(client)) return;
|
if (!download_queue_.contains(client)) return;
|
||||||
|
|
||||||
pb::remote::Message msg;
|
pb::remote::Message msg;
|
||||||
@ -772,8 +774,8 @@ void OutgoingDataCreator::SendPlaylist(RemoteClient* client, int playlist_id) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutgoingDataCreator::SendUrls(
|
void OutgoingDataCreator::SendUrls(RemoteClient *client,
|
||||||
RemoteClient* client, const pb::remote::RequestDownloadSongs& request) {
|
const pb::remote::RequestDownloadSongs &request) {
|
||||||
SongList song_list;
|
SongList song_list;
|
||||||
|
|
||||||
// First gather all valid songs
|
// First gather all valid songs
|
||||||
@ -869,16 +871,14 @@ void OutgoingDataCreator::SendKitten(const QImage& kitten) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutgoingDataCreator::DoGlobalSearch(const QString& query,
|
void OutgoingDataCreator::DoGlobalSearch(const QString &query, RemoteClient *client) {
|
||||||
RemoteClient* client) {
|
|
||||||
int id = app_->global_search()->SearchAsync(query);
|
int id = app_->global_search()->SearchAsync(query);
|
||||||
|
|
||||||
GlobalSearchRequest request(id, query, client);
|
GlobalSearchRequest request(id, query, client);
|
||||||
global_search_result_map_.insert(id, request);
|
global_search_result_map_.insert(id, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutgoingDataCreator::ResultsAvailable(
|
void OutgoingDataCreator::ResultsAvailable(int id, const SearchProvider::ResultList& results) {
|
||||||
int id, const SearchProvider::ResultList& results) {
|
|
||||||
if (!global_search_result_map_.contains(id)) return;
|
if (!global_search_result_map_.contains(id)) return;
|
||||||
|
|
||||||
GlobalSearchRequest search_request = global_search_result_map_.value(id);
|
GlobalSearchRequest search_request = global_search_result_map_.value(id);
|
||||||
@ -886,14 +886,12 @@ void OutgoingDataCreator::ResultsAvailable(
|
|||||||
QImage null_img;
|
QImage null_img;
|
||||||
|
|
||||||
pb::remote::Message msg;
|
pb::remote::Message msg;
|
||||||
pb::remote::ResponseGlobalSearch* response =
|
pb::remote::ResponseGlobalSearch* response = msg.mutable_response_global_search();
|
||||||
msg.mutable_response_global_search();
|
|
||||||
|
|
||||||
msg.set_type(pb::remote::GLOBAL_SEARCH_RESULT);
|
msg.set_type(pb::remote::GLOBAL_SEARCH_RESULT);
|
||||||
response->set_id(search_request.id_);
|
response->set_id(search_request.id_);
|
||||||
response->set_query(DataCommaSizeFromQString(search_request.query_));
|
response->set_query(DataCommaSizeFromQString(search_request.query_));
|
||||||
response->set_search_provider(
|
response->set_search_provider(DataCommaSizeFromQString(results.first().provider_->name()));
|
||||||
DataCommaSizeFromQString(results.first().provider_->name()));
|
|
||||||
|
|
||||||
for (const SearchProvider::Result& result : results) {
|
for (const SearchProvider::Result& result : results) {
|
||||||
pb::remote::SongMetadata* pb_song = response->add_song_metadata();
|
pb::remote::SongMetadata* pb_song = response->add_song_metadata();
|
||||||
|
@ -42,9 +42,10 @@ struct GlobalSearchRequest {
|
|||||||
int id_;
|
int id_;
|
||||||
QString query_;
|
QString query_;
|
||||||
RemoteClient* client_;
|
RemoteClient* client_;
|
||||||
GlobalSearchRequest() : id_(-1), client_(nullptr) {}
|
GlobalSearchRequest()
|
||||||
|
: id_(-1), client_(nullptr) {}
|
||||||
GlobalSearchRequest(int i, const QString& q, RemoteClient* c)
|
GlobalSearchRequest(int i, const QString& q, RemoteClient* c)
|
||||||
: id_(i), query_(q), client_(c) {}
|
: id_(i), query_(q), client_(c) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class OutgoingDataCreator : public QObject {
|
class OutgoingDataCreator : public QObject {
|
||||||
@ -102,7 +103,7 @@ class OutgoingDataCreator : public QObject {
|
|||||||
QTimer* keep_alive_timer_;
|
QTimer* keep_alive_timer_;
|
||||||
QTimer* track_position_timer_;
|
QTimer* track_position_timer_;
|
||||||
int keep_alive_timeout_;
|
int keep_alive_timeout_;
|
||||||
QMap<RemoteClient*, QQueue<DownloadItem>> download_queue_;
|
QMap<RemoteClient*, QQueue<DownloadItem> > download_queue_;
|
||||||
int last_track_position_;
|
int last_track_position_;
|
||||||
bool aww_;
|
bool aww_;
|
||||||
|
|
||||||
@ -123,8 +124,7 @@ class OutgoingDataCreator : public QObject {
|
|||||||
int song_count);
|
int song_count);
|
||||||
void SendAlbum(RemoteClient* client, const Song& song);
|
void SendAlbum(RemoteClient* client, const Song& song);
|
||||||
void SendPlaylist(RemoteClient* client, int playlist_id);
|
void SendPlaylist(RemoteClient* client, int playlist_id);
|
||||||
void SendUrls(RemoteClient* client,
|
void SendUrls(RemoteClient* client, const pb::remote::RequestDownloadSongs& request);
|
||||||
const pb::remote::RequestDownloadSongs& request);
|
|
||||||
void OfferNextSong(RemoteClient* client);
|
void OfferNextSong(RemoteClient* client);
|
||||||
void SendTotalFileSize(RemoteClient* client);
|
void SendTotalFileSize(RemoteClient* client);
|
||||||
};
|
};
|
||||||
|
@ -421,6 +421,7 @@ void TagCompleter::ModelReady() {
|
|||||||
QWidget* TagCompletionItemDelegate::createEditor(QWidget* parent,
|
QWidget* TagCompletionItemDelegate::createEditor(QWidget* parent,
|
||||||
const QStyleOptionViewItem&,
|
const QStyleOptionViewItem&,
|
||||||
const QModelIndex&) const {
|
const QModelIndex&) const {
|
||||||
|
|
||||||
QLineEdit* editor = new QLineEdit(parent);
|
QLineEdit* editor = new QLineEdit(parent);
|
||||||
new TagCompleter(backend_, column_, editor);
|
new TagCompleter(backend_, column_, editor);
|
||||||
|
|
||||||
|
@ -85,18 +85,16 @@ void SongLoaderInserter::LoadAudioCD(Playlist* destination, int row,
|
|||||||
enqueue_ = enqueue;
|
enqueue_ = enqueue;
|
||||||
|
|
||||||
SongLoader* loader = new SongLoader(library_, player_, this);
|
SongLoader* loader = new SongLoader(library_, player_, this);
|
||||||
NewClosure(loader, SIGNAL(AudioCDTracksLoaded()), this,
|
NewClosure(loader, SIGNAL(AudioCDTracksLoaded()),
|
||||||
SLOT(AudioCDTracksLoaded(SongLoader*)), loader);
|
this, SLOT(AudioCDTracksLoaded(SongLoader*)), loader);
|
||||||
connect(loader, SIGNAL(LoadAudioCDFinished(bool)),
|
connect(loader, SIGNAL(LoadAudioCDFinished(bool)), SLOT(AudioCDTagsLoaded(bool)));
|
||||||
SLOT(AudioCDTagsLoaded(bool)));
|
|
||||||
qLog(Info) << "Loading audio CD...";
|
qLog(Info) << "Loading audio CD...";
|
||||||
SongLoader::Result ret = loader->LoadAudioCD();
|
SongLoader::Result ret = loader->LoadAudioCD();
|
||||||
if (ret == SongLoader::Error) {
|
if (ret == SongLoader::Error) {
|
||||||
emit Error(tr("Error while loading audio CD"));
|
emit Error(tr("Error while loading audio CD"));
|
||||||
delete loader;
|
delete loader;
|
||||||
}
|
}
|
||||||
// Songs will be loaded later: see AudioCDTracksLoaded and AudioCDTagsLoaded
|
// Songs will be loaded later: see AudioCDTracksLoaded and AudioCDTagsLoaded slots
|
||||||
// slots
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SongLoaderInserter::DestinationDestroyed() { destination_ = nullptr; }
|
void SongLoaderInserter::DestinationDestroyed() { destination_ = nullptr; }
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#include "tagreader.h"
|
#include "tagreader.h"
|
||||||
#include "core/song.h"
|
#include "core/song.h"
|
||||||
#ifdef HAVE_LIBLASTFM
|
#ifdef HAVE_LIBLASTFM
|
||||||
#include "internet/lastfmcompat.h"
|
#include "internet/lastfmcompat.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
@ -64,8 +64,7 @@ class SongTest : public ::testing::Test {
|
|||||||
tag_reader.SaveFile(filename, pb_song);
|
tag_reader.SaveFile(filename, pb_song);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WriteSongStatisticsToFile(const Song& song,
|
static void WriteSongStatisticsToFile(const Song& song, const QString& filename) {
|
||||||
const QString& filename) {
|
|
||||||
TagReader tag_reader;
|
TagReader tag_reader;
|
||||||
::pb::tagreader::SongMetadata pb_song;
|
::pb::tagreader::SongMetadata pb_song;
|
||||||
song.ToProtobuf(&pb_song);
|
song.ToProtobuf(&pb_song);
|
||||||
@ -80,6 +79,7 @@ class SongTest : public ::testing::Test {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_LIBLASTFM
|
#ifdef HAVE_LIBLASTFM
|
||||||
TEST_F(SongTest, InitsFromLastFM) {
|
TEST_F(SongTest, InitsFromLastFM) {
|
||||||
Song song;
|
Song song;
|
||||||
@ -95,7 +95,7 @@ TEST_F(SongTest, InitsFromLastFM) {
|
|||||||
EXPECT_EQ("Baz", song.album());
|
EXPECT_EQ("Baz", song.album());
|
||||||
EXPECT_EQ("Bar", song.artist());
|
EXPECT_EQ("Bar", song.artist());
|
||||||
}
|
}
|
||||||
#endif // HAVE_LIBLASTFM
|
#endif // HAVE_LIBLASTFM
|
||||||
|
|
||||||
/*TEST_F(SongTest, InitsFromFile) {
|
/*TEST_F(SongTest, InitsFromFile) {
|
||||||
QTemporaryFile temp;
|
QTemporaryFile temp;
|
||||||
@ -156,13 +156,14 @@ TEST_F(SongTest, FMPSPlayCountBoth) {
|
|||||||
|
|
||||||
TEST_F(SongTest, FMPSUnrated) {
|
TEST_F(SongTest, FMPSUnrated) {
|
||||||
QStringList files_to_test;
|
QStringList files_to_test;
|
||||||
files_to_test << ":/testdata/beep.m4a"
|
files_to_test <<
|
||||||
<< ":/testdata/beep.mp3"
|
":/testdata/beep.m4a" <<
|
||||||
<< ":/testdata/beep.flac"
|
":/testdata/beep.mp3" <<
|
||||||
<< ":/testdata/beep.ogg"
|
":/testdata/beep.flac" <<
|
||||||
<< ":/testdata/beep.spx"
|
":/testdata/beep.ogg" <<
|
||||||
<< ":/testdata/beep.wav"
|
":/testdata/beep.spx" <<
|
||||||
<< ":/testdata/beep.wma";
|
":/testdata/beep.wav" <<
|
||||||
|
":/testdata/beep.wma";
|
||||||
for (const QString& test_filename : files_to_test) {
|
for (const QString& test_filename : files_to_test) {
|
||||||
TemporaryResource r(test_filename);
|
TemporaryResource r(test_filename);
|
||||||
Song song = ReadSongFromFile(r.fileName());
|
Song song = ReadSongFromFile(r.fileName());
|
||||||
@ -294,7 +295,7 @@ TEST_F(SongTest, StatisticsASF) {
|
|||||||
EXPECT_EQ(1337, new_song.playcount());
|
EXPECT_EQ(1337, new_song.playcount());
|
||||||
EXPECT_EQ(87, new_song.score());
|
EXPECT_EQ(87, new_song.score());
|
||||||
}
|
}
|
||||||
#endif // TAGLIB_WITH_ASF
|
#endif // TAGLIB_WITH_ASF
|
||||||
|
|
||||||
TEST_F(SongTest, RatingMP4) {
|
TEST_F(SongTest, RatingMP4) {
|
||||||
TemporaryResource r(":/testdata/beep.m4a");
|
TemporaryResource r(":/testdata/beep.m4a");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user