diff --git a/src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp b/src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp index c9154aa21..3f299524d 100644 --- a/src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp +++ b/src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp @@ -1038,7 +1038,10 @@ Tomahawk::EchonestControl::insertMoodsStylesAndGenres() } else { - src = EchonestGenerator::genres(); + foreach( const Echonest::Genre& genre, EchonestGenerator::genres() ) + { + src.append( genre.name() ); + } } QComboBox* combo = qobject_cast< QComboBox* >( m_input.data() ); diff --git a/src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp b/src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp index e2b7ab039..e2b40e6c6 100644 --- a/src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp +++ b/src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp @@ -33,14 +33,13 @@ #include #include #include -#include using namespace Tomahawk; QStringList EchonestGenerator::s_moods = QStringList(); QStringList EchonestGenerator::s_styles = QStringList(); -QStringList EchonestGenerator::s_genres = QStringList(); +Echonest::Genres EchonestGenerator::s_genres = Echonest::Genres(); QNetworkReply* EchonestGenerator::s_moodsJob = 0; QNetworkReply* EchonestGenerator::s_stylesJob = 0; QNetworkReply* EchonestGenerator::s_genresJob = 0; @@ -707,9 +706,9 @@ EchonestGenerator::loadGenres() { QVariant genres = TomahawkUtils::Cache::instance()->getData( "EchonestGenerator", "genres" ); s_genres_lock.unlock(); - if ( genres.isValid() && genres.canConvert< QStringList >() ) + if ( genres.isValid() && genres.canConvert< Echonest::Genres >() ) { - s_genres = genres.toStringList(); + s_genres = genres.value< Echonest::Genres >(); } else { @@ -785,7 +784,7 @@ EchonestGenerator::stylesReceived() emit stylesSaved(); } -QStringList +Echonest::Genres EchonestGenerator::genres() { return s_genres; @@ -800,7 +799,7 @@ EchonestGenerator::genresReceived() try { - s_genres = Echonest::Artist::parseGenreList( r ).toList(); + s_genres = Echonest::Genre::parseList( r ); } catch( Echonest::ParseError& e ) { @@ -808,7 +807,7 @@ EchonestGenerator::genresReceived() } s_genresJob = 0; - TomahawkUtils::Cache::instance()->putData( "EchonestGenerator", 1209600000 /* 2 weeks */, "genres", QVariant::fromValue< QStringList >( s_genres ) ); + TomahawkUtils::Cache::instance()->putData( "EchonestGenerator", 1209600000 /* 2 weeks */, "genres", QVariant::fromValue< Echonest::Genres >( s_genres ) ); s_genres_lock.unlock(); emit genresSaved(); } diff --git a/src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.h b/src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.h index adb6e6c3b..dd75dd6ea 100644 --- a/src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.h +++ b/src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.h @@ -31,8 +31,10 @@ #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) #include +#include #else #include +#include #endif namespace Tomahawk @@ -88,7 +90,7 @@ public: static QStringList styles(); static QStringList moods(); - static QStringList genres(); + static Echonest::Genres genres(); static QStringList userCatalogs(); static QByteArray catalogId( const QString& collectionId ); @@ -133,7 +135,7 @@ private: static QStringList s_styles; static QStringList s_moods; - static QStringList s_genres; + static Echonest::Genres s_genres; static QNetworkReply* s_stylesJob; static QNetworkReply* s_moodsJob; static QNetworkReply* s_genresJob;