diff --git a/src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp b/src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp index 69595447d..c793fff88 100644 --- a/src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp +++ b/src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp @@ -123,13 +123,7 @@ EchonestGenerator::EchonestGenerator ( QObject* parent ) loadStylesAndMoods(); - // TODO Yes this is a race condition. If multiple threads initialize echonestgenerator at the exact same time we could run into some issues. - // not dealing with that right now. - if ( s_catalogs == 0 ) - s_catalogs = new CatalogManager( this ); - connect( s_catalogs, SIGNAL( catalogsUpdated() ), this, SLOT( knownCatalogsChanged() ) ); -// qDebug() << "ECHONEST:" << m_logo.size(); } @@ -138,6 +132,15 @@ EchonestGenerator::~EchonestGenerator() delete m_dynPlaylist; } +void +EchonestGenerator::setupCatalogs() +{ + // TODO Yes this is a race condition. If multiple threads initialize echonestgenerator at the exact same time we could run into some issues. + // not dealing with that right now. + if ( s_catalogs == 0 ) + s_catalogs = new CatalogManager( 0 ); +// qDebug() << "ECHONEST:" << m_logo.size(); +} dyncontrol_ptr EchonestGenerator::createControl( const QString& type ) diff --git a/src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.h b/src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.h index b4152b56d..e176ea258 100644 --- a/src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.h +++ b/src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.h @@ -84,6 +84,7 @@ public: static QStringList userCatalogs(); static QByteArray catalogId( const QString& collectionId ); + static void setupCatalogs(); signals: void paramsGenerated( const Echonest::DynamicPlaylist::PlaylistParams& ); diff --git a/src/tomahawkapp.cpp b/src/tomahawkapp.cpp index 060600466..8a510bb17 100644 --- a/src/tomahawkapp.cpp +++ b/src/tomahawkapp.cpp @@ -181,7 +181,7 @@ TomahawkApp::init() new Pipeline( this ); m_servent = QWeakPointer( new Servent( this ) ); - connect( m_servent.data(), SIGNAL( ready() ), SLOT( initSIP() ) ); + connect( m_servent.data(), SIGNAL( ready() ), SLOT( serventReady() ) ); tDebug() << "Init Database."; initDatabase(); @@ -500,6 +500,13 @@ TomahawkApp::initServent() } } +void +TomahawkApp::serventReady() +{ + EchonestGenerator::setupCatalogs(); + + initSIP(); +} void TomahawkApp::initSIP() diff --git a/src/tomahawkapp.h b/src/tomahawkapp.h index 00a7749ed..7a8a906cd 100644 --- a/src/tomahawkapp.h +++ b/src/tomahawkapp.h @@ -95,10 +95,12 @@ public slots: private slots: void initServent(); - void initSIP(); + void serventReady(); void spotifyApiCheckFinished(); + private: + void initSIP(); void registerMetaTypes(); void printHelp();