[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [libechonest] /: rename catalog endpoint to tasteprofile, fix Catalog tests
From: Leo Franchi <lfranchi () kde ! org>
Date: 2014-09-13 2:21:21
Message-ID: E1XScxl-00062T-Mq () scm ! kde ! org
[Download RAW message or body]
Git commit b768ca62412ad45a8df7cb4d68c2b508bc1df8cf by Leo Franchi, on behalf of \
Stefan Derkits. Committed on 08/09/2014 at 13:56.
Pushed by lfranchi into branch 'master'.
rename catalog endpoint to tasteprofile, fix Catalog tests
M +9 -9 src/Catalog.cpp
M +15 -12 tests/CatalogTest.cpp
M +2 -1 tests/CatalogTest.h
http://commits.kde.org/libechonest/b768ca62412ad45a8df7cb4d68c2b508bc1df8cf
diff --git a/src/Catalog.cpp b/src/Catalog.cpp
index cb66604..c839bc2 100644
--- a/src/Catalog.cpp
+++ b/src/Catalog.cpp
@@ -132,7 +132,7 @@ void Echonest::Catalog::setType(Echonest::CatalogTypes::Type \
type)
QNetworkReply* Echonest::Catalog::create(const QString& name, \
Echonest::CatalogTypes::Type type) {
- QUrl url = Echonest::baseGetQuery( "catalog", "create" );
+ QUrl url = Echonest::baseGetQuery( "tasteprofile", "create" );
urlAddQueryItem( url, QLatin1String( "name" ), name );
urlAddQueryItem( url, QLatin1String( "type" ), QString::fromLatin1( \
Echonest::catalogTypeToLiteral( type ) ) ); @@ -145,7 +145,7 @@ QNetworkReply* \
Echonest::Catalog::create(const QString& name, Echonest::CatalogT
QNetworkReply* Echonest::Catalog::deleteCatalog() const
{
- QUrl url = Echonest::baseGetQuery( "catalog", "delete" );
+ QUrl url = Echonest::baseGetQuery( "tasteprofile", "delete" );
Q_ASSERT( !d->id.isEmpty() );
urlAddQueryItem( url, QLatin1String( "id" ), QString::fromLatin1( d->id ) );
@@ -155,7 +155,7 @@ QNetworkReply* Echonest::Catalog::deleteCatalog() const
QNetworkReply* Echonest::Catalog::list(int results, int start)
{
- QUrl url = Echonest::baseGetQuery( "catalog", "list" );
+ QUrl url = Echonest::baseGetQuery( "tasteprofile", "list" );
addLimits( url, results, start );
return Echonest::Config::instance()->nam()->get( QNetworkRequest( url ) );
@@ -163,7 +163,7 @@ QNetworkReply* Echonest::Catalog::list(int results, int start)
QNetworkReply* Echonest::Catalog::profile() const
{
- QUrl url = Echonest::baseGetQuery( "catalog", "profile" );
+ QUrl url = Echonest::baseGetQuery( "tasteprofile", "profile" );
if( !d->id.isEmpty() )
urlAddQueryItem( url, QLatin1String( "id" ), QString::fromLatin1( d->id ) );
@@ -177,7 +177,7 @@ QNetworkReply* Echonest::Catalog::profile() const
QNetworkReply* Echonest::Catalog::status(const QByteArray& ticket)
{
- QUrl url = Echonest::baseGetQuery( "catalog", "status" );
+ QUrl url = Echonest::baseGetQuery( "tasteprofile", "status" );
urlAddQueryItem( url, QLatin1String( "ticket" ), QString::fromLatin1( ticket ) \
);
@@ -186,7 +186,7 @@ QNetworkReply* Echonest::Catalog::status(const QByteArray& \
ticket)
QNetworkReply* Echonest::Catalog::update(const Echonest::CatalogUpdateEntries& \
entries) const {
- QUrl url = Echonest::baseGetQuery( "catalog", "update" );
+ QUrl url = Echonest::baseGetQuery( "tasteprofile", "update" );
Q_ASSERT( !d->id.isEmpty() );
urlAddQueryItem( url, QLatin1String( "id" ), QString::fromLatin1( d->id ) );
@@ -196,13 +196,13 @@ QNetworkReply* Echonest::Catalog::update(const \
Echonest::CatalogUpdateEntries& e
QNetworkReply* Echonest::Catalog::updateAndCreate(const \
Echonest::CatalogUpdateEntries& entries) {
- QUrl url = Echonest::baseGetQuery( "catalog", "update" );
+ QUrl url = Echonest::baseGetQuery( "tasteprofile", "update" );
return Echonest::Catalog::updatePrivate( url, entries );
}
QNetworkReply* Echonest::Catalog::readArtistCatalog(Echonest::ArtistInformation \
info, int results, int start) const {
- QUrl url = Echonest::baseGetQuery( "catalog", "read" );
+ QUrl url = Echonest::baseGetQuery( "tasteprofile", "read" );
Artist::addQueryInformation( url, info );
return readPrivate( url, results, start );
@@ -210,7 +210,7 @@ QNetworkReply* \
Echonest::Catalog::readArtistCatalog(Echonest::ArtistInformation
QNetworkReply* Echonest::Catalog::readSongCatalog(Echonest::SongInformation info, \
int results, int start) const {
- QUrl url = Echonest::baseGetQuery( "catalog", "read" );
+ QUrl url = Echonest::baseGetQuery( "tasteprofile", "read" );
Song::addQueryInformation( url, info );
return readPrivate( url, results, start );
diff --git a/tests/CatalogTest.cpp b/tests/CatalogTest.cpp
index d790d31..368125e 100644
--- a/tests/CatalogTest.cpp
+++ b/tests/CatalogTest.cpp
@@ -25,7 +25,7 @@
void CatalogTest::initTestCase()
{
- Echonest::Config::instance()->setAPIKey( "JRIHWEP6GPOER2QQ6" );
+ Echonest::Config::instance()->setAPIKey( "JGJCRKWLXLBZIFAZB" );
}
void CatalogTest::testList()
@@ -33,7 +33,7 @@ void CatalogTest::testList()
QNetworkReply* reply = Echonest::Catalog::list();
qDebug() << reply->url().toString();
- QCOMPARE( reply->url().toString(), QLatin1String( \
"http://developer.echonest.com/api/v4/catalog/list?api_key=JGJCRKWLXLBZIFAZB&format=xml" \
) ); + QCOMPARE( reply->url().toString(), QLatin1String( \
"http://developer.echonest.com/api/v4/tasteprofile/list?api_key=JGJCRKWLXLBZIFAZB&format=xml" \
) );
QEventLoop loop;
loop.connect( reply, SIGNAL(finished()), SLOT(quit()) );
@@ -48,7 +48,7 @@ void CatalogTest::testList()
reply = Echonest::Catalog::list( 1, 1 );
qDebug() << reply->url().toString();
- QCOMPARE( reply->url().toString(), QLatin1String( \
"http://developer.echonest.com/api/v4/catalog/list?api_key=JGJCRKWLXLBZIFAZB&format=xml&results=1&start=1" \
) ); + QCOMPARE( reply->url().toString(), QLatin1String( \
"http://developer.echonest.com/api/v4/tasteprofile/list?api_key=JGJCRKWLXLBZIFAZB&format=xml&results=1&start=1" \
) );
loop.connect( reply, SIGNAL(finished()), SLOT(quit()) );
loop.exec();
@@ -64,7 +64,7 @@ void CatalogTest::testProfile()
QNetworkReply* reply = c.profile();
qDebug() << reply->url().toString();
- QCOMPARE( reply->url().toString(), QLatin1String( \
"http://developer.echonest.com/api/v4/catalog/profile?api_key=JGJCRKWLXLBZIFAZB&format=xml&id=CAWRKLJ12BF92BC7C3" \
) ); + QCOMPARE( reply->url().toString(), QLatin1String( \
"http://developer.echonest.com/api/v4/tasteprofile/profile?api_key=JGJCRKWLXLBZIFAZB&format=xml&id=CAWRKLJ12BF92BC7C3" \
) );
QEventLoop loop;
loop.connect( reply, SIGNAL(finished()), SLOT(quit()) );
@@ -81,7 +81,7 @@ void CatalogTest::testRead()
QNetworkReply* reply = c.readSongCatalog( Echonest::SongInformation( \
Echonest::SongInformation::AudioSummaryInformation | \
Echonest::SongInformation::Hotttnesss | Echonest::SongInformation::ArtistHotttnesss | \
Echonest::SongInformation::ArtistFamiliarity | \
Echonest::SongInformation::ArtistLocation ) );
qDebug() << reply->url().toString();
- QCOMPARE( reply->url(), QUrl( QLatin1String( \
"http://developer.echonest.com/api/v4/catalog/read?api_key=JGJCRKWLXLBZIFAZB&format=xm \
l&bucket=audio_summary&bucket=song_hotttnesss&bucket=artist_hotttnesss&bucket=artist_familiarity&bucket=artist_location&id=CAWRKLJ12BF92BC7C3" \
) ) ); + QCOMPARE( reply->url(), QUrl( QLatin1String( \
"http://developer.echonest.com/api/v4/tasteprofile/read?api_key=JGJCRKWLXLBZIFAZB&form \
at=xml&bucket=audio_summary&bucket=song_hotttnesss&bucket=artist_hotttnesss&bucket=artist_familiarity&bucket=artist_location&id=CAWRKLJ12BF92BC7C3" \
) ) );
QEventLoop loop;
loop.connect( reply, SIGNAL(finished()), SLOT(quit()) );
@@ -127,7 +127,7 @@ void CatalogTest::testRead()
Echonest::ArtistInformation::Terms | \
Echonest::ArtistInformation::Urls | Echonest::ArtistInformation::Videos ) );
qDebug() << reply->url().toString();
- QCOMPARE( reply->url(), QUrl( QLatin1String( \
"http://developer.echonest.com/api/v4/catalog/read?api_key=JGJCRKWLXLBZIFAZB&format=xm \
l&bucket=audio&bucket=biographies&bucket=blogs&bucket=familiarity&bucket=hotttnesss&bu \
cket=images&bucket=news&bucket=reviews&bucket=terms&bucket=urls&bucket=video&id=CAXBXBZ12BF92A9AC2" \
) ) ); + QCOMPARE( reply->url(), QUrl( QLatin1String( \
"http://developer.echonest.com/api/v4/tasteprofile/read?api_key=JGJCRKWLXLBZIFAZB&form \
at=xml&bucket=audio&bucket=biographies&bucket=blogs&bucket=familiarity&bucket=hotttnes \
ss&bucket=images&bucket=news&bucket=reviews&bucket=terms&bucket=urls&bucket=video&id=CAXBXBZ12BF92A9AC2" \
) ) );
loop.connect( reply, SIGNAL(finished()), SLOT(quit()) );
loop.exec();
@@ -165,15 +165,15 @@ void CatalogTest::testStatus()
void CatalogTest::testCreateUpdateDeleteSong()
{
- {
- Echonest::Catalog c( "CAQBYCW132B7313E1A" );
+ /*{
+ Echonest::Catalog c( "CALARIS148554DBBF3" );
QNetworkReply* reply = c.deleteCatalog();
QEventLoop loop;
loop.connect( reply, SIGNAL(finished()), SLOT(quit()) );
- loop.exec(); exit(1);}
+ loop.exec(); exit(1);}*/
try {
- QNetworkReply* reply = Echonest::Catalog::create( QLatin1String( \
"unittest_catalog_song_X" ), Echonest::CatalogTypes::Song ); + QNetworkReply* \
reply = Echonest::Catalog::create( QLatin1String( "unittest_catalog_song_Y" ), \
Echonest::CatalogTypes::Song ); //
QEventLoop loop;
loop.connect( reply, SIGNAL(finished()), SLOT(quit()) );
@@ -197,6 +197,7 @@ void CatalogTest::testCreateUpdateDeleteSong()
// entry.setUrl( QLatin1String( "myurl" ) );
entry.setFavorite( true );
entry.setAction( Echonest::CatalogTypes::Update );
+ entry.setPlayCount(10000);
Echonest::CatalogUpdateEntries entries;
entries << entry;
@@ -219,6 +220,7 @@ void CatalogTest::testCreateUpdateDeleteSong()
// now read the catalog
reply = m_songC.readSongCatalog();
+ qDebug() << reply->url();
loop.connect( reply, SIGNAL(finished()), SLOT(quit()) );
loop.exec();
m_songC.parseRead( reply );
@@ -234,7 +236,7 @@ void CatalogTest::testCreateUpdateDeleteSong()
void CatalogTest::testCreateUpdateDeleteArtist()
{
try {
- QNetworkReply* reply = Echonest::Catalog::create( QLatin1String( \
"unittest_catalog_artist_X" ), Echonest::CatalogTypes::Artist ); + \
QNetworkReply* reply = Echonest::Catalog::create( QLatin1String( \
"unittest_catalog_artist_Y" ), Echonest::CatalogTypes::Artist ); //
QEventLoop loop;
loop.connect( reply, SIGNAL(finished()), SLOT(quit()) );
@@ -290,12 +292,13 @@ void CatalogTest::testCreateUpdateDeleteArtist()
void CatalogTest::cleanupTestCase()
{
// delete the two test catalogs we created
- qDebug() << "Deleting catalogs!";
+ qDebug() << "Deleting song catalog!";
QNetworkReply* reply = m_songC.deleteCatalog();
QEventLoop loop;
loop.connect( reply, SIGNAL(finished()), SLOT(quit()) );
loop.exec();
+ qDebug() << "Deleting artist catalog!";
reply = m_artistC.deleteCatalog();
loop.connect( reply, SIGNAL(finished()), SLOT(quit()) );
loop.exec();
diff --git a/tests/CatalogTest.h b/tests/CatalogTest.h
index 7b7728f..694c6a5 100644
--- a/tests/CatalogTest.h
+++ b/tests/CatalogTest.h
@@ -29,6 +29,7 @@ private slots:
void testCreateUpdateDeleteSong();
+ void testCreateUpdateDeleteArtist();
void testList();
private:
@@ -36,7 +37,7 @@ private:
void testRead();
void testStatus();
- void testCreateUpdateDeleteArtist();
+
Echonest::Catalog m_songC;
Echonest::Catalog m_artistC;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic