本文整理汇总了C++中meta::TrackPtr::artist方法的典型用法代码示例。如果您正苦于以下问题:C++ TrackPtr::artist方法的具体用法?C++ TrackPtr::artist怎么用?C++ TrackPtr::artist使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类meta::TrackPtr
的用法示例。
在下文中一共展示了TrackPtr::artist方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: foreach
bool
ProxyBase::rowMatch( int sourceModelRow, const QString &searchTerms, int searchFields ) const
{
if ( !m_belowModel )
return false;
Meta::TrackPtr track = m_belowModel->trackAt( sourceModelRow );
QStringList searchList = searchTerms.split(" ", QString::SkipEmptyParts);
foreach( const QString& searchTerm, searchList )
{
bool match = false;
if ( searchFields & MatchTrack &&
track->prettyName().contains( searchTerm, Qt::CaseInsensitive )
)
match = true;
if ( searchFields & MatchArtist &&
track->artist() &&
track->artist()->prettyName().contains( searchTerm, Qt::CaseInsensitive )
)
match = true;
if ( searchFields & MatchAlbum &&
track->album() &&
track->album()->prettyName().contains( searchTerm, Qt::CaseInsensitive )
)
match = true;
if ( searchFields & MatchGenre &&
track->genre() &&
track->genre()->prettyName().contains( searchTerm, Qt::CaseInsensitive )
)
match = true;
if ( searchFields & MatchComposer &&
track->composer() &&
track->composer()->prettyName().contains( searchTerm, Qt::CaseInsensitive )
)
match = true;
if ( searchFields & MatchYear &&
track->year() &&
track->year()->prettyName().contains( searchTerm, Qt::CaseInsensitive )
)
match = true;
if( searchFields & MatchRating )
{
bool ok;
int rating = QString( searchTerm ).remove( "rating:" ).toInt( &ok );
if( ok && ( track->statistics()->rating() == rating ) )
match = true;
}
if( !match )
return false;
}
示例2: update
void
PhotosEngine::metadataChanged( Meta::TrackPtr track )
{
const bool hasChanged = !track->artist() || track->artist()->name() != m_artist;
if ( hasChanged )
update();
}
示例3: onTrackMetadataChanged
void LyricsEngine::onTrackMetadataChanged( Meta::TrackPtr track )
{
DEBUG_BLOCK
// Only update if the lyrics have changed.
QString artist = track->artist() ? track->artist()->name() : QString();
if( m_prevLyrics.artist != artist ||
m_prevLyrics.title != track->name() ||
m_prevLyrics.text != track->cachedLyrics() )
update();
}
示例4: locker
bool
Dynamic::LastFmBias::trackMatches( int position,
const Meta::TrackList& playlist,
int contextCount ) const
{
Q_UNUSED( contextCount );
if( position <= 0 || position >= playlist.count())
return false;
// determine the last track and artist
Meta::TrackPtr lastTrack = playlist[position-1];
Meta::ArtistPtr lastArtist = lastTrack->artist();
QString lastTrackName = lastTrack->name();
QString lastArtistName = lastArtist ? lastArtist->name() : QString();
Meta::TrackPtr currentTrack = playlist[position];
Meta::ArtistPtr currentArtist = currentTrack->artist();
QString currentTrackName = currentTrack->name();
QString currentArtistName = currentArtist ? currentArtist->name() : QString();
{
QMutexLocker locker( &m_mutex );
if( m_match == SimilarArtist )
{
if( lastArtistName.isEmpty() )
return true;
if( currentArtistName.isEmpty() )
return false;
if( lastArtistName == currentArtistName )
return true;
if( m_similarArtistMap.contains( lastArtistName ) )
return m_similarArtistMap.value( lastArtistName ).contains( currentArtistName );
}
else if( m_match == SimilarTrack )
{
if( lastTrackName.isEmpty() )
return true;
if( currentTrackName.isEmpty() )
return false;
if( lastTrackName == currentTrackName )
return true;
TitleArtistPair lastKey( lastTrackName, lastArtistName );
TitleArtistPair currentKey( currentTrackName, currentArtistName );
if( m_similarTrackMap.contains( lastKey ) )
return m_similarTrackMap.value( lastKey ).contains( currentKey );
}
}
debug() << "didn't have a cached suggestions for track:" << lastTrackName;
return false;
}
示例5: getInfo
void LastfmInfoParser::getInfo(Meta::TrackPtr track)
{
DEBUG_BLOCK
QMap<QString, QString> query;
query[ "method" ] = "track.getInfo";
query[ "track" ] = track->name();
query[ "album" ] = track->album() ? track->album()->name() : QString();
query[ "artist" ] = track->artist() ? track->artist()->name() : QString();
query[ "apikey" ] = Amarok::lastfmApiKey();
m_jobs[ "getTrackInfo" ] = lastfm::ws::post( query );
connect( m_jobs[ "getTrackInfo" ], SIGNAL( finished() ), SLOT( onGetTrackInfo() ) );
}
示例6: removeAllData
bool
SimilarArtistsEngine::update( bool force )
{
QString newArtist;
Meta::TrackPtr track = The::engineController()->currentTrack();
if( track )
{
if( Meta::ArtistPtr artistPtr = track->artist() )
newArtist = artistPtr->name();
}
if( newArtist.isEmpty() )
{
m_artist.clear();
removeAllData( "similarArtists" );
return false;
}
else //valid artist
{
// wee make a request only if the artist is different
if( force || (newArtist != m_artist) )
{
// if the artist has changed
m_artist = newArtist;
similarArtistsRequest( m_artist );
return true;
}
}
return false;
}
示例7: locker
bool
Dynamic::EchoNestBias::trackMatches( int position,
const Meta::TrackList& playlist,
int contextCount ) const
{
Q_UNUSED( contextCount );
// collect the artist
QStringList artists = currentArtists( position, playlist );
if( artists.isEmpty() )
return true;
// the artist of this track
if( position < 0 || position >= playlist.count() )
return false;
Meta::TrackPtr track = playlist[position];
Meta::ArtistPtr artist = track->artist();
if( !artist || artist->name().isEmpty() )
return false;
{
QMutexLocker locker( &m_mutex );
QString key = artists.join("|");
if( m_similarArtistMap.contains( key ) )
return m_similarArtistMap.value( key ).contains( artist->name() );
}
warning() << "didn't have artist suggestions saved for this artist:" << artist->name();
return false;
}
示例8: connect
void
IpodCopyTracksJob::slotStartDuplicateTrackSearch( const Meta::TrackPtr &track )
{
Collections::QueryMaker *qm = m_coll.data()->queryMaker();
qm->setQueryType( Collections::QueryMaker::Track );
// we cannot qm->addMatch( track ) - it matches by uidUrl()
qm->addFilter( Meta::valTitle, track->name(), true, true );
qm->addMatch( track->album() );
qm->setArtistQueryMode( Collections::QueryMaker::TrackArtists );
qm->addMatch( track->artist() );
qm->addMatch( track->composer() );
qm->addMatch( track->genre() );
qm->addMatch( track->year() );
qm->addNumberFilter( Meta::valTrackNr, track->trackNumber(), Collections::QueryMaker::Equals );
qm->addNumberFilter( Meta::valDiscNr, track->discNumber(), Collections::QueryMaker::Equals );
// we don't want to match by filesize, track length, filetype etc - these change during
// transcoding. We don't match album artist because handling of it is inconsistent
connect( qm, SIGNAL(newResultReady(Meta::TrackList)),
SLOT(slotDuplicateTrackSearchNewResult(Meta::TrackList)) );
connect( qm, SIGNAL(queryDone()), SLOT(slotDuplicateTrackSearchQueryDone()) );
qm->setAutoDelete( true );
m_duplicateTrack = Meta::TrackPtr(); // reset duplicate track from previous query
qm->run();
}
示例9: if
bool
Dynamic::QuizPlayBias::trackMatches( int position,
const Meta::TrackList& playlist,
int contextCount ) const
{
Q_UNUSED( contextCount );
if( position <= 0 || position >= playlist.count())
return true;
// -- determine the last character we need to quiz
Meta::TrackPtr lastTrack = playlist[position-1];
Meta::DataPtr lastData;
if( m_follow == TitleToTitle )
lastData = Meta::DataPtr::staticCast<Meta::Track>(lastTrack);
else if( m_follow == ArtistToArtist )
lastData = Meta::DataPtr::staticCast<Meta::Artist>(lastTrack->artist());
else if( m_follow == AlbumToAlbum )
lastData = Meta::DataPtr::staticCast<Meta::Album>(lastTrack->album());
if( !lastData || lastData->name().isEmpty() )
return true;
// -- determine the first character
Meta::TrackPtr track = playlist[position];
Meta::DataPtr data;
if( m_follow == TitleToTitle )
data = Meta::DataPtr::staticCast<Meta::Track>(track);
else if( m_follow == ArtistToArtist )
data = Meta::DataPtr::staticCast<Meta::Artist>(track->artist());
else if( m_follow == AlbumToAlbum )
data = Meta::DataPtr::staticCast<Meta::Album>(track->album());
if( !data || data->name().isEmpty() )
return false;
// -- now compare
QString lastName = lastData->name();
QString name = data->name();
return lastChar( lastName ).toLower() == name[0].toLower();
}
示例10: setAlignment
void
Amarok::OSD::show( Meta::TrackPtr track ) //slot
{
setAlignment( static_cast<OSDWidget::Alignment>( AmarokConfig::osdAlignment() ) );
setOffset( AmarokConfig::osdYOffset() );
QString text;
if( !track || track->playableUrl().isEmpty() )
{
text = i18n( "No track playing" );
setRating( 0 ); // otherwise stars from last rating change are visible
}
else
{
setRating( track->rating() );
text = track->prettyName();
if( track->artist() && !track->artist()->prettyName().isEmpty() )
text = track->artist()->prettyName() + " - " + text;
if( track->album() && !track->album()->prettyName().isEmpty() )
text += "\n (" + track->album()->prettyName() + ") ";
else
text += '\n';
if( track->length() > 0 )
text += Meta::msToPrettyTime( track->length() );
}
if( text.isEmpty() )
text = track->playableUrl().fileName();
if( text.startsWith( "- " ) ) //When we only have a title tag, _something_ prepends a fucking hyphen. Remove that.
text = text.mid( 2 );
if( text.isEmpty() ) //still
text = i18n("No information available for this track");
QImage image;
if( track && track->album() )
image = The::svgHandler()->imageWithBorder( track->album(), 100, 5 ).toImage();
OSDWidget::show( text, image );
}
示例11: debug
/**
* called whenever metadata of the current track has changed
*/
void
TabsEngine::update()
{
DEBUG_BLOCK
// get the current track
Meta::TrackPtr track = The::engineController()->currentTrack();
if( !track )
{
debug() << "no track";
m_titleName.clear();
m_artistName.clear();
removeAllData( "tabs" );
setData( "tabs", "state", "Stopped" );
return;
}
m_currentTrack = track;
Meta::ArtistPtr artistPtr = track->artist();
QString newArtist;
if( artistPtr )
{
if( ( track->playableUrl().protocol() == "lastfm" ) ||
( track->playableUrl().protocol() == "daap" ) ||
!The::engineController()->isStream() )
newArtist = artistPtr->name();
else
newArtist = artistPtr->prettyName();
}
QString newTitle = track->name();
if( newTitle.isEmpty() )
newTitle = track->prettyName();
// check if something changed
if( newTitle == m_titleName && newArtist == m_artistName )
{
debug() << "nothing changed";
return;
}
// stop fetching for unknown artists or titles
if( newTitle.isEmpty() || newArtist.isEmpty() )
{
setData("tabs", "state", "noTabs" );
return;
}
requestTab( newArtist, newTitle );
}
示例12: qVariantFromValue
void
CurrentEngine::update( Meta::AlbumPtr album )
{
if( !m_requested.value( QLatin1String("albums") ) )
return;
DEBUG_BLOCK
m_lastQueryMaker = 0;
Meta::TrackPtr track = The::engineController()->currentTrack();
if( !album )
return;
Meta::ArtistPtr artist = track->artist();
// Prefer track artist to album artist BUG: 266682
if( !artist )
artist = album->albumArtist();
if( artist && !artist->name().isEmpty() )
{
m_albums.clear();
m_albumData.clear();
m_albumData[ QLatin1String("currentTrack") ] = qVariantFromValue( track );
m_albumData[ QLatin1String("headerText") ] = QVariant( i18n( "Albums by %1", artist->name() ) );
// -- search the collection for albums with the same artist
Collections::QueryMaker *qm = CollectionManager::instance()->queryMaker();
qm->setAutoDelete( true );
qm->addFilter( Meta::valArtist, artist->name(), true, true );
qm->setAlbumQueryMode( Collections::QueryMaker::AllAlbums );
qm->setQueryType( Collections::QueryMaker::Album );
connect( qm, SIGNAL(newResultReady( Meta::AlbumList)),
SLOT(resultReady( Meta::AlbumList)), Qt::QueuedConnection );
connect( qm, SIGNAL(queryDone()), SLOT(setupAlbumsData()) );
m_lastQueryMaker = qm;
qm->run();
}
else
{
removeAllData( QLatin1String("albums") );
setData( QLatin1String("albums"), QLatin1String("headerText"),
i18nc( "Header text for current album applet", "Albums" ) );
}
}
示例13: QString
bool
Dynamic::WeeklyTopBias::trackMatches( int position,
const Meta::TrackList& playlist,
int contextCount ) const
{
Q_UNUSED( contextCount );
if( position < 0 || position >= playlist.count())
return false;
// - determine the current artist
Meta::TrackPtr currentTrack = playlist[position-1];
Meta::ArtistPtr currentArtist = currentTrack->artist();
QString currentArtistName = currentArtist ? currentArtist->name() : QString();
// - collect all the artists
QStringList artists;
bool weeksMissing = false;
uint fromTime = m_range.from.toTime_t();
uint toTime = m_range.to.toTime_t();
uint lastWeekTime = 0;
foreach( uint weekTime, m_weeklyFromTimes )
{
if( weekTime > fromTime && weekTime < toTime && lastWeekTime )
{
if( m_weeklyArtistMap.contains( lastWeekTime ) )
{
artists.append( m_weeklyArtistMap.value( lastWeekTime ) );
// debug() << "found already-saved data for week:" << lastWeekTime << m_weeklyArtistMap.value( lastWeekTime );
}
else
{
weeksMissing = true;
}
}
lastWeekTime = weekTime;
}
if( weeksMissing )
warning() << "didn't have a cached suggestions for weeks:" << m_range.from << "to" << m_range.to;
return artists.contains( currentArtistName );
}
示例14: TrackSet
Dynamic::TrackSet
Dynamic::LastFmBias::matchingTracks( const Meta::TrackList& playlist,
int contextCount, int finalCount,
Dynamic::TrackCollectionPtr universe ) const
{
Q_UNUSED( contextCount );
Q_UNUSED( finalCount );
if( playlist.isEmpty() )
return Dynamic::TrackSet( universe, true );
// determine the last track and artist
Meta::TrackPtr lastTrack = playlist.last();
Meta::ArtistPtr lastArtist = lastTrack->artist();
m_currentTrack = lastTrack->name();
m_currentArtist = lastArtist ? lastArtist->name() : QString();
{
QMutexLocker locker( &m_mutex );
if( m_match == SimilarArtist )
{
if( m_currentArtist.isEmpty() )
return Dynamic::TrackSet( universe, true );
if( m_tracksMap.contains( m_currentArtist ) )
return m_tracksMap.value( m_currentArtist );
}
else if( m_match == SimilarTrack )
{
if( m_currentTrack.isEmpty() )
return Dynamic::TrackSet( universe, true );
QString key = m_currentTrack + '|' + m_currentArtist;
if( m_tracksMap.contains( key ) )
return m_tracksMap.value( key );
}
}
m_tracks = Dynamic::TrackSet( universe, false );
QTimer::singleShot(0,
const_cast<LastFmBias*>(this),
SLOT(newQuery())); // create the new query from my parent thread
return Dynamic::TrackSet();
}
示例15: TrackSet
Dynamic::TrackSet
Dynamic::QuizPlayBias::matchingTracks( int position,
const Meta::TrackList& playlist, int contextCount,
Dynamic::TrackCollectionPtr universe ) const
{
Q_UNUSED( contextCount );
if( position <= 0 || position > playlist.count())
return Dynamic::TrackSet( universe, true );
// determine the last character we need to quiz
Meta::TrackPtr lastTrack = playlist[position-1];
Meta::DataPtr lastData;
if( m_follow == TitleToTitle )
lastData = Meta::DataPtr::staticCast<Meta::Track>(lastTrack);
else if( m_follow == ArtistToArtist )
lastData = Meta::DataPtr::staticCast<Meta::Artist>(lastTrack->artist());
else if( m_follow == AlbumToAlbum )
lastData = Meta::DataPtr::staticCast<Meta::Album>(lastTrack->album());
if( !lastData || lastData->name().isEmpty() )
{
// debug() << "QuizPlay: no data for"<<lastTrack->name();
return Dynamic::TrackSet( universe, true );
}
m_currentCharacter = lastChar(lastData->name()).toLower();
// debug() << "QuizPlay: data for"<<lastTrack->name()<<"is"<<m_currentCharacter;
// -- look if we already buffered it
if( m_tracksValid && m_characterTrackMap.contains( m_currentCharacter ) )
return m_characterTrackMap.value( m_currentCharacter );
// -- start a new query
m_tracks = Dynamic::TrackSet( universe, false );
QTimer::singleShot(0,
const_cast<QuizPlayBias*>(this),
SLOT(newQuery())); // create the new query from my parent thread
return Dynamic::TrackSet();
}