QobuzRequest: Handle multiple discs in integration
Albums with multiple discs are not being handled which results in tracks being listed out of order. If the disc (media_number) is present in JSON, we use it to set the disc in the Song object.
This commit is contained in:
committed by
Jonas Kvinge
parent
af1c46543b
commit
c1d0702b4d
@@ -1079,12 +1079,17 @@ void QobuzRequest::ParseSong(Song &song, const QJsonObject &json_obj, const Arti
|
|||||||
|
|
||||||
QString title = json_obj["title"].toString();
|
QString title = json_obj["title"].toString();
|
||||||
int track = json_obj["track_number"].toInt();
|
int track = json_obj["track_number"].toInt();
|
||||||
|
int disc = 0;
|
||||||
QString copyright = json_obj["copyright"].toString();
|
QString copyright = json_obj["copyright"].toString();
|
||||||
qint64 duration = json_obj["duration"].toInt() * kNsecPerSec;
|
qint64 duration = json_obj["duration"].toInt() * kNsecPerSec;
|
||||||
//bool streamable = json_obj["streamable"].toBool();
|
//bool streamable = json_obj["streamable"].toBool();
|
||||||
QString composer;
|
QString composer;
|
||||||
QString performer;
|
QString performer;
|
||||||
|
|
||||||
|
if (json_obj.contains("media_number")) {
|
||||||
|
disc = json_obj["media_number"].toInt();
|
||||||
|
}
|
||||||
|
|
||||||
Artist song_artist = album_artist;
|
Artist song_artist = album_artist;
|
||||||
Album song_album = album;
|
Album song_album = album;
|
||||||
if (json_obj.contains("album")) {
|
if (json_obj.contains("album")) {
|
||||||
@@ -1193,6 +1198,7 @@ void QobuzRequest::ParseSong(Song &song, const QJsonObject &json_obj, const Arti
|
|||||||
song.set_artist_id(song_artist.artist_id);
|
song.set_artist_id(song_artist.artist_id);
|
||||||
song.set_album(song_album.album);
|
song.set_album(song_album.album);
|
||||||
song.set_artist(song_artist.artist);
|
song.set_artist(song_artist.artist);
|
||||||
|
song.set_disc(disc);
|
||||||
if (!album_artist.artist.isEmpty() && album_artist.artist != song_artist.artist) {
|
if (!album_artist.artist.isEmpty() && album_artist.artist != song_artist.artist) {
|
||||||
song.set_albumartist(album_artist.artist);
|
song.set_albumartist(album_artist.artist);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user