1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-06 00:52:34 +02:00

Really don't go overboard asking for moods/styles

This commit is contained in:
Leo Franchi 2011-06-05 16:47:32 -04:00
parent aa076684dc
commit 7cac0ed9bc
3 changed files with 14 additions and 7 deletions

View File

@ -724,7 +724,6 @@ Tomahawk::EchonestControl::insertMoodsAndStyles()
if( !combo )
return false;
qDebug() << "Inserting moods and or styles, here's the list" << src;
foreach( const QString& item, src ) {
combo->addItem( item, item );
}

View File

@ -26,6 +26,8 @@ using namespace Tomahawk;
QVector< QString > EchonestGenerator::s_moods = QVector< QString >();
QVector< QString > EchonestGenerator::s_styles = QVector< QString >();
QNetworkReply* EchonestGenerator::s_moodsJob = 0;
QNetworkReply* EchonestGenerator::s_stylesJob = 0;
EchonestFactory::EchonestFactory()
{}
@ -59,12 +61,14 @@ EchonestGenerator::EchonestGenerator ( QObject* parent )
m_mode = OnDemand;
m_logo.load( RESPATH "/images/echonest_logo.png" );
// fetch style and moods
QNetworkReply* style = Echonest::Artist::listTerms( "style" );
connect( style, SIGNAL( finished() ), this, SLOT( stylesReceived() ) );
QNetworkReply* moods = Echonest::Artist::listTerms( "mood" );
connect( moods, SIGNAL( finished() ), this, SLOT( moodsReceived() ) );
if( !s_stylesJob && s_styles.isEmpty() ) {
// fetch style and moods
s_stylesJob = Echonest::Artist::listTerms( "style" );
connect( s_stylesJob, SIGNAL( finished() ), this, SLOT( stylesReceived() ) );
} else if( !s_moodsJob && s_moods.isEmpty() ) {
s_moodsJob = Echonest::Artist::listTerms( "mood" );
connect( s_moodsJob, SIGNAL( finished() ), this, SLOT( moodsReceived() ) );
}
// qDebug() << "ECHONEST:" << m_logo.size();
}
@ -530,6 +534,7 @@ EchonestGenerator::moodsReceived()
} catch( Echonest::ParseError& e ) {
qWarning() << "Echonest failed to parse moods list";
}
s_moodsJob = 0;
}
QVector< QString >
@ -549,4 +554,5 @@ EchonestGenerator::stylesReceived()
} catch( Echonest::ParseError& e ) {
qWarning() << "Echonest failed to parse styles list";
}
s_stylesJob = 0;
}

View File

@ -95,6 +95,8 @@ private:
static QVector< QString > s_styles;
static QVector< QString > s_moods;
static QNetworkReply* s_stylesJob;
static QNetworkReply* s_moodsJob;
// used for the intermediary song id lookup
QSet< QNetworkReply* > m_waiting;