mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-17 03:45:56 +01:00
Add API key for Songkick and make artist calendar request.
This commit is contained in:
parent
32a2cbe6df
commit
1453086a80
@ -22,7 +22,9 @@
|
|||||||
|
|
||||||
const char* SongkickConcerts::kSongkickArtistBucket = "id:songkick";
|
const char* SongkickConcerts::kSongkickArtistBucket = "id:songkick";
|
||||||
const char* SongkickConcerts::kSongkickArtistCalendarUrl =
|
const char* SongkickConcerts::kSongkickArtistCalendarUrl =
|
||||||
"http://api.songkick.com/api/3.0/artists/%1/calendar.json?apikey=";
|
"http://api.songkick.com/api/3.0/artists/%1/calendar.json?"
|
||||||
|
"per_page=5&"
|
||||||
|
"apikey=8rgKfy1WU6IlJFfN";
|
||||||
|
|
||||||
SongkickConcerts::SongkickConcerts() {
|
SongkickConcerts::SongkickConcerts() {
|
||||||
|
|
||||||
@ -62,7 +64,13 @@ void SongkickConcerts::ArtistSearchFinished(QNetworkReply* reply, int id) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FetchSongkickCalendar(songkick_id, id);
|
QStringList split = songkick_id.split(':');
|
||||||
|
if (split.count() != 3) {
|
||||||
|
qLog(Error) << "Weird songkick id";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
}
|
}
|
||||||
@ -70,9 +78,11 @@ void SongkickConcerts::ArtistSearchFinished(QNetworkReply* reply, int id) {
|
|||||||
|
|
||||||
void SongkickConcerts::FetchSongkickCalendar(const QString& artist_id, int id) {
|
void SongkickConcerts::FetchSongkickCalendar(const QString& artist_id, int id) {
|
||||||
QUrl url(QString(kSongkickArtistCalendarUrl).arg(artist_id));
|
QUrl url(QString(kSongkickArtistCalendarUrl).arg(artist_id));
|
||||||
qLog(Debug) << "Would send request to:" << url;
|
qLog(Debug) << url;
|
||||||
|
QNetworkReply* reply = network_.get(QNetworkRequest(url));
|
||||||
|
NewClosure(reply, SIGNAL(finished()), this, SLOT(CalendarRequestFinished(QNetworkReply*, int)), reply, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SongkickConcerts::CalendarRequestFinished() {
|
void SongkickConcerts::CalendarRequestFinished(QNetworkReply* reply, int id) {
|
||||||
|
qLog(Debug) << reply->readAll();
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
|
|
||||||
#include "songinfoprovider.h"
|
#include "songinfoprovider.h"
|
||||||
|
|
||||||
|
#include "core/network.h"
|
||||||
|
|
||||||
class QNetworkReply;
|
class QNetworkReply;
|
||||||
|
|
||||||
class SongkickConcerts : public SongInfoProvider {
|
class SongkickConcerts : public SongInfoProvider {
|
||||||
@ -31,11 +33,13 @@ class SongkickConcerts : public SongInfoProvider {
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void ArtistSearchFinished(QNetworkReply* reply, int id);
|
void ArtistSearchFinished(QNetworkReply* reply, int id);
|
||||||
void CalendarRequestFinished();
|
void CalendarRequestFinished(QNetworkReply* reply, int id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void FetchSongkickCalendar(const QString& artist_id, int id);
|
void FetchSongkickCalendar(const QString& artist_id, int id);
|
||||||
|
|
||||||
|
NetworkAccessManager network_;
|
||||||
|
|
||||||
static const char* kSongkickArtistBucket;
|
static const char* kSongkickArtistBucket;
|
||||||
static const char* kSongkickArtistCalendarUrl;
|
static const char* kSongkickArtistCalendarUrl;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user