Fix songkick concert fetching

This commit is contained in:
John Maguire 2016-02-11 16:59:11 +00:00
parent d06f337ade
commit ce3ba02749
1 changed files with 7 additions and 6 deletions

View File

@ -22,6 +22,7 @@
#include <QXmlStreamWriter> #include <QXmlStreamWriter>
#include <echonest/Artist.h> #include <echonest/Artist.h>
#include <echonest/TypeInformation.h>
#include <qjson/parser.h> #include <qjson/parser.h>
@ -30,7 +31,7 @@
#include "songkickconcertwidget.h" #include "songkickconcertwidget.h"
#include "ui/iconloader.h" #include "ui/iconloader.h"
const char* SongkickConcerts::kSongkickArtistBucket = "id:songkick"; const char* SongkickConcerts::kSongkickArtistBucket = "songkick";
const char* SongkickConcerts::kSongkickArtistCalendarUrl = const char* SongkickConcerts::kSongkickArtistCalendarUrl =
"https://api.songkick.com/api/3.0/artists/%1/calendar.json?" "https://api.songkick.com/api/3.0/artists/%1/calendar.json?"
"per_page=5&" "per_page=5&"
@ -49,10 +50,11 @@ void SongkickConcerts::FetchInfo(int id, const Song& metadata) {
Echonest::Artist::SearchParams params; Echonest::Artist::SearchParams params;
params.push_back( params.push_back(
qMakePair(Echonest::Artist::Name, QVariant(metadata.artist()))); qMakePair(Echonest::Artist::Name, QVariant(metadata.artist())));
params.push_back(
qMakePair(Echonest::Artist::IdSpace, QVariant(kSongkickArtistBucket)));
qLog(Debug) << "Params:" << params; qLog(Debug) << "Params:" << params;
QNetworkReply* reply = Echonest::Artist::search(params); QNetworkReply* reply = Echonest::Artist::search(
params,
Echonest::ArtistInformation(Echonest::ArtistInformation::NoInformation,
QStringList() << kSongkickArtistBucket));
qLog(Debug) << reply->request().url(); qLog(Debug) << reply->request().url();
NewClosure(reply, SIGNAL(finished()), this, NewClosure(reply, SIGNAL(finished()), this,
SLOT(ArtistSearchFinished(QNetworkReply*, int)), reply, id); SLOT(ArtistSearchFinished(QNetworkReply*, int)), reply, id);
@ -92,8 +94,7 @@ void SongkickConcerts::ArtistSearchFinished(QNetworkReply* reply, int id) {
} }
FetchSongkickCalendar(split[2], id); FetchSongkickCalendar(split[2], id);
} } catch (Echonest::ParseError& e) {
catch (Echonest::ParseError& e) {
qLog(Error) << "Error parsing echonest reply:" << e.errorType() << e.what(); qLog(Error) << "Error parsing echonest reply:" << e.errorType() << e.what();
emit Finished(id); emit Finished(id);
} }