Change artist and song ID to strings
This commit is contained in:
@@ -324,7 +324,7 @@ void SubsonicRequest::AlbumsFinishCheck(const int offset, const int albums_recei
|
||||
|
||||
}
|
||||
|
||||
void SubsonicRequest::AddAlbumSongsRequest(const qint64 artist_id, const QString &album_id, const QString &album_artist, const int offset) {
|
||||
void SubsonicRequest::AddAlbumSongsRequest(const QString &artist_id, const QString &album_id, const QString &album_artist, const int offset) {
|
||||
|
||||
Request request;
|
||||
request.artist_id = artist_id;
|
||||
@@ -346,13 +346,13 @@ void SubsonicRequest::FlushAlbumSongsRequests() {
|
||||
ParamList params = ParamList() << Param("id", request.album_id);
|
||||
QNetworkReply *reply = CreateGetRequest(QString("getAlbum"), params);
|
||||
replies_ << reply;
|
||||
NewClosure(reply, SIGNAL(finished()), this, SLOT(AlbumSongsReplyReceived(QNetworkReply*, const qint64, const qint64, const QString&)), reply, request.artist_id, request.album_id, request.album_artist);
|
||||
NewClosure(reply, SIGNAL(finished()), this, SLOT(AlbumSongsReplyReceived(QNetworkReply*, QString, QString, QString)), reply, request.artist_id, request.album_id, request.album_artist);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void SubsonicRequest::AlbumSongsReplyReceived(QNetworkReply *reply, const qint64 artist_id, const qint64 album_id, const QString &album_artist) {
|
||||
void SubsonicRequest::AlbumSongsReplyReceived(QNetworkReply *reply, const QString &artist_id, const QString &album_id, const QString &album_artist) {
|
||||
|
||||
if (!replies_.contains(reply)) return;
|
||||
replies_.removeAll(reply);
|
||||
@@ -482,7 +482,7 @@ void SubsonicRequest::SongsFinishCheck() {
|
||||
|
||||
}
|
||||
|
||||
int SubsonicRequest::ParseSong(Song &song, const QJsonObject &json_obj, const qint64 artist_id_requested, const qint64 album_id_requested, const QString &album_artist) {
|
||||
QString SubsonicRequest::ParseSong(Song &song, const QJsonObject &json_obj, const QString &artist_id_requested, const QString &album_id_requested, const QString &album_artist) {
|
||||
|
||||
Q_UNUSED(artist_id_requested);
|
||||
Q_UNUSED(album_id_requested);
|
||||
@@ -496,18 +496,15 @@ int SubsonicRequest::ParseSong(Song &song, const QJsonObject &json_obj, const qi
|
||||
!json_obj.contains("type")
|
||||
) {
|
||||
Error("Invalid Json reply, song is missing one or more values.", json_obj);
|
||||
return -1;
|
||||
return QString();
|
||||
}
|
||||
|
||||
qint64 song_id = 0;
|
||||
QString song_id_str;
|
||||
QString song_id;
|
||||
if (json_obj["id"].type() == QJsonValue::String) {
|
||||
song_id_str = json_obj["id"].toString();
|
||||
song_id = QString(song_id_str).remove(QRegExp("[^0-9]+")).toLongLong();
|
||||
song_id = json_obj["id"].toString();
|
||||
}
|
||||
else {
|
||||
song_id = json_obj["id"].toInt();
|
||||
song_id_str = QString::number(song_id);
|
||||
song_id = QString::number(json_obj["id"].toInt());
|
||||
}
|
||||
|
||||
QString album_id;
|
||||
@@ -520,14 +517,13 @@ int SubsonicRequest::ParseSong(Song &song, const QJsonObject &json_obj, const qi
|
||||
}
|
||||
}
|
||||
|
||||
qint64 artist_id = -1;
|
||||
QString artist_id;
|
||||
if (json_obj.contains("artistId")) {
|
||||
if (json_obj["artistId"].type() == QJsonValue::String) {
|
||||
QString artist_id_str = json_obj["artistId"].toString();
|
||||
artist_id = QString(artist_id_str).remove(QRegExp("[^0-9]+")).toLongLong();
|
||||
artist_id = json_obj["artistId"].toString();
|
||||
}
|
||||
else {
|
||||
artist_id = json_obj["artistId"].toInt();
|
||||
artist_id = QString::number(json_obj["artistId"].toInt());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -619,7 +615,7 @@ int SubsonicRequest::ParseSong(Song &song, const QJsonObject &json_obj, const qi
|
||||
|
||||
QUrl url;
|
||||
url.setScheme(url_handler_->scheme());
|
||||
url.setPath(song_id_str);
|
||||
url.setPath(song_id);
|
||||
|
||||
QUrl cover_url;
|
||||
if (!cover_art_id.isEmpty()) {
|
||||
@@ -641,9 +637,9 @@ int SubsonicRequest::ParseSong(Song &song, const QJsonObject &json_obj, const qi
|
||||
|
||||
song.set_source(Song::Source_Subsonic);
|
||||
song.set_song_id(song_id);
|
||||
if (album_id > 0) song.set_album_id(album_id);
|
||||
if (artist_id > 0) song.set_artist_id(artist_id);
|
||||
if (album_artist != artist) song.set_albumartist(album_artist);
|
||||
if (!album_id.isEmpty()) song.set_album_id(album_id);
|
||||
if (!artist_id.isEmpty()) song.set_artist_id(artist_id);
|
||||
if (!album_artist.isEmpty()) song.set_albumartist(album_artist);
|
||||
song.set_album(album);
|
||||
song.set_artist(artist);
|
||||
song.set_title(title);
|
||||
@@ -721,7 +717,7 @@ void SubsonicRequest::FlushAlbumCoverRequests() {
|
||||
|
||||
QNetworkReply *reply = network_->get(req);
|
||||
album_cover_replies_ << reply;
|
||||
NewClosure(reply, SIGNAL(finished()), this, SLOT(AlbumCoverReceived(QNetworkReply*, const QString&, const QUrl&, const QString&)), reply, request.album_id, request.url, request.filename);
|
||||
NewClosure(reply, SIGNAL(finished()), this, SLOT(AlbumCoverReceived(QNetworkReply*, QString, QUrl, QString)), reply, request.album_id, request.url, request.filename);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user