Beispiel #1
0
void SubsonicService::ReadTrack(QXmlStreamReader *reader, QStandardItem *parent)
{
  Q_ASSERT(reader->name() == "child");

  Song song;
  QString id = reader->attributes().value("id").toString();
  song.set_title(reader->attributes().value("title").toString());
  song.set_album(reader->attributes().value("album").toString());
  song.set_track(reader->attributes().value("track").toString().toInt());
  song.set_artist(reader->attributes().value("artist").toString());
  song.set_bitrate(reader->attributes().value("bitRate").toString().toInt());
  song.set_year(reader->attributes().value("year").toString().toInt());
  song.set_genre(reader->attributes().value("genre").toString());
  qint64 length = reader->attributes().value("duration").toString().toInt();
  length *= 1000000000;
  song.set_length_nanosec(length);
  QUrl url = BuildRequestUrl("stream");
  url.setScheme(url.scheme() == "https" ? "subsonics" : "subsonic");
  url.addQueryItem("id", id);
  song.set_url(url);
  song.set_filesize(reader->attributes().value("size").toString().toInt());

  QStandardItem *item = new QStandardItem(reader->attributes().value("title").toString());
  item->setData(Type_Track, InternetModel::Role_Type);
  item->setData(id, Role_Id);
  item->setData(QVariant::fromValue(song), InternetModel::Role_SongMetadata);
  item->setData(InternetModel::PlayBehaviour_SingleItem, InternetModel::Role_PlayBehaviour);
  item->setData(song.url(), InternetModel::Role_Url);
  parent->appendRow(item);
  item_lookup_.insert(id, item);
  reader->skipCurrentElement();
}
Beispiel #2
0
void SubsonicService::Ping() {
  QNetworkReply* reply = Send(BuildRequestUrl("ping"));
  NewClosure(reply, SIGNAL(finished()),
             this, SLOT(OnPingFinished(QNetworkReply*)),
             reply);
}
Beispiel #3
0
void SubsonicService::Ping()
{
  Send(BuildRequestUrl("ping"), SLOT(onPingFinished()));
}
Beispiel #4
0
void SubsonicService::GetMusicDirectory(const QString &id)
{
  QUrl url = BuildRequestUrl("getMusicDirectory");
  url.addQueryItem("id", id);
  Send(url, SLOT(onGetMusicDirectoryFinished()));
}
Beispiel #5
0
void SubsonicService::GetIndexes()
{
  Send(BuildRequestUrl("getIndexes"), SLOT(onGetIndexesFinished()));
}