QList<Tomahawk::query_ptr> PlaylistInterface::filterTracks( const QList<Tomahawk::query_ptr>& queries ) { QList<Tomahawk::query_ptr> result; for ( int i = 0; i < queries.count(); i++ ) { bool picked = true; const query_ptr q1 = queries.at( i ); for ( int j = 0; j < result.count(); j++ ) { if ( !picked ) break; const query_ptr& q2 = result.at( j ); if ( q1->track() == q2->track() ) { picked = false; } } if ( picked ) { query_ptr q = Query::get( q1->artist(), q1->track(), q1->album(), uuid(), false ); q->setAlbumPos( q1->results().first()->albumpos() ); q->setDiscNumber( q1->discnumber() ); result << q; } } Pipeline::instance()->resolve( result ); return result; }
QUrl GlobalActionManager::openLinkFromQuery( const query_ptr& query ) const { QString title, artist, album; if( !query->results().isEmpty() && !query->results().first().isNull() ) { title = query->results().first()->track(); artist = query->results().first()->artist().isNull() ? QString() : query->results().first()->artist()->name(); album = query->results().first()->album().isNull() ? QString() : query->results().first()->album()->name(); } else { title = query->track(); artist = query->artist(); album = query->album(); } return openLink( title, artist, album ); }