1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-23 17:29:42 +01:00

fix debug/poll and give new stations a better name from a seed

This commit is contained in:
Leo Franchi 2011-05-25 21:37:20 -04:00
parent 5f2791f2b3
commit f27d3b9fe9
3 changed files with 9 additions and 3 deletions

View File

@ -33,6 +33,7 @@ QHash< QString, QStringList > Tomahawk::EchonestControl::s_suggestCache = QHash<
Tomahawk::EchonestControl::EchonestControl( const QString& selectedType, const QStringList& typeSelectors, QObject* parent )
: DynamicControl ( selectedType.isEmpty() ? "Artist" : selectedType, typeSelectors, parent )
, m_stylePollCount( 0 )
{
setType( "echonest" );
m_editingTimer.setInterval( 500 ); //timeout to edits
@ -721,8 +722,11 @@ Tomahawk::EchonestControl::insertMoodsAndStyles()
combo->addItem( item, item );
}
if( src.isEmpty() ) {
QTimer::singleShot( 400, this, SLOT( checkForMoodsOrStylesFetched() ) );
if( src.isEmpty() && !combo->count() ) {
if( m_stylePollCount <= 20 ) { // try for 20s to get the styles...
QTimer::singleShot( 1000, this, SLOT( checkForMoodsOrStylesFetched() ) );
}
m_stylePollCount++;
return false;
}

View File

@ -91,6 +91,7 @@ private:
Echonest::DynamicPlaylist::PlaylistParamData m_data;
QVariant m_cacheData;
int m_stylePollCount;
QSet< QNetworkReply* > m_suggestWorkers;
static QHash< QString, QStringList > s_suggestCache;

View File

@ -133,7 +133,8 @@ CategoryAddItem::dropMimeData( const QMimeData* data, Qt::DropAction )
QTimer::singleShot( 300, APP->mainWindow()->sourceTreeView(), SLOT( renamePlaylist() ) );
} else if( m_categoryType == SourcesModel::StationsCategory ) {
// seed the playlist with these song filters
dynplaylist_ptr newpl = DynamicPlaylist::create( SourceList::instance()->getLocal(), uuid(), "New Station", "", SourceList::instance()->getLocal()->friendlyName(), OnDemand, false );
QString name = queries.isEmpty() ? tr( "New Station" ) : tr( "%1 Station" ).arg( queries.first()->track() );
dynplaylist_ptr newpl = DynamicPlaylist::create( SourceList::instance()->getLocal(), uuid(), name, "", SourceList::instance()->getLocal()->friendlyName(), OnDemand, false );
newpl->setMode( OnDemand );
// now we want to add each query as a song filter...