From c1d0702b4d68c30eca2473606b17cbdc2ccfe600 Mon Sep 17 00:00:00 2001 From: Gaganpreet Arora Date: Tue, 28 Mar 2023 21:18:09 +0200 Subject: [PATCH] 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. --- src/qobuz/qobuzrequest.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/qobuz/qobuzrequest.cpp b/src/qobuz/qobuzrequest.cpp index fac06cd07..84654c0cb 100644 --- a/src/qobuz/qobuzrequest.cpp +++ b/src/qobuz/qobuzrequest.cpp @@ -1079,12 +1079,17 @@ void QobuzRequest::ParseSong(Song &song, const QJsonObject &json_obj, const Arti QString title = json_obj["title"].toString(); int track = json_obj["track_number"].toInt(); + int disc = 0; QString copyright = json_obj["copyright"].toString(); qint64 duration = json_obj["duration"].toInt() * kNsecPerSec; //bool streamable = json_obj["streamable"].toBool(); QString composer; QString performer; + if (json_obj.contains("media_number")) { + disc = json_obj["media_number"].toInt(); + } + Artist song_artist = album_artist; Album song_album = 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_album(song_album.album); song.set_artist(song_artist.artist); + song.set_disc(disc); if (!album_artist.artist.isEmpty() && album_artist.artist != song_artist.artist) { song.set_albumartist(album_artist.artist); }