1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-15 10:48:33 +01:00

Extract few other metadata info from GS results when initialising song.

However, currently these fields are filled only when calling getAlbumSongs(), unfortunately.
This commit is contained in:
Arnaud Bienner 2012-02-28 23:22:09 +01:00
parent 50c0cd78a3
commit 0c1eca5ac1

View File

@ -51,6 +51,7 @@
#include "core/scopedtransaction.h"
#include "core/song.h"
#include "core/taskmanager.h"
#include "core/timeconstants.h"
#include "core/utilities.h"
#include "globalsearch/globalsearch.h"
#include "globalsearch/groovesharksearchprovider.h"
@ -1437,8 +1438,17 @@ Song GroovesharkService::ExtractSong(const QVariantMap& result_song) {
int album_id = result_song["AlbumID"].toInt();
QString album_name = result_song["AlbumName"].toString();
QString cover = result_song["CoverArtFilename"].toString();
song.Init(song_name, artist_name, album_name, 0);
qint64 duration = result_song["EstimateDuration"].toInt() * kNsecPerSec;
song.Init(song_name, artist_name, album_name, duration);
song.set_art_automatic(QString(kUrlCover) + cover);
QVariant track_number = result_song["TrackNum"];
if (track_number.isValid()) {
song.set_track(track_number.toInt());
}
QVariant year = result_song["Year"];
if (year.isValid()) {
song.set_year(year.toInt());
}
// Special kind of URL: because we need to request a stream key for each
// play, we generate a fake URL for now, and we will create a real streaming
// URL when user will actually play the song (through url handler)