Пример #1
0
void TagReaderClient::ReadFileBlocking(const QString& filename, Song* song) {
  Q_ASSERT(QThread::currentThread() != thread());

  TagReaderReply* reply = ReadFile(filename);
  if (reply->WaitForFinished()) {
    song->InitFromProtobuf(reply->message().read_file_response().metadata());
  }
  reply->deleteLater();
}
Пример #2
0
bool TagReaderClient::IsMediaFileBlocking(const QString& filename) {
  Q_ASSERT(QThread::currentThread() != thread());

  bool ret = false;

  TagReaderReply* reply = IsMediaFile(filename);
  if (reply->WaitForFinished()) {
    ret = reply->message().is_media_file_response().success();
  }
  reply->deleteLater();

  return ret;
}
Пример #3
0
bool TagReaderClient::UpdateSongRatingBlocking(const Song& metadata) {
  Q_ASSERT(QThread::currentThread() != thread());

  bool ret = false;

  TagReaderReply* reply = UpdateSongRating(metadata);
  if (reply->WaitForFinished()) {
    ret = reply->message().save_song_rating_to_file_response().success();
  }
  reply->deleteLater();

  return ret;
}
bool TagReaderClient::SaveFileBlocking(const QString& filename, const Song& metadata) {
    Q_ASSERT(QThread::currentThread() != thread());

    bool ret = false;

    TagReaderReply* reply = SaveFile(filename, metadata);
    if (reply->WaitForFinished()) {
        ret = reply->message().save_file_response().success();
    }
    reply->deleteLater();

    return ret;
}
Пример #5
0
QImage TagReaderClient::LoadEmbeddedArtBlocking(const QString& filename) {
  Q_ASSERT(QThread::currentThread() != thread());

  QImage ret;

  TagReaderReply* reply = LoadEmbeddedArt(filename);
  if (reply->WaitForFinished()) {
    const std::string& data_str =
        reply->message().load_embedded_art_response().data();
    ret.loadFromData(QByteArray(data_str.data(), data_str.size()));
  }
  reply->deleteLater();

  return ret;
}