本文整理汇总了C++中tomahawk::result_ptr::artist方法的典型用法代码示例。如果您正苦于以下问题:C++ result_ptr::artist方法的具体用法?C++ result_ptr::artist怎么用?C++ result_ptr::artist使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tomahawk::result_ptr
的用法示例。
在下文中一共展示了result_ptr::artist方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: thread
void
Scrobbler::trackStarted( const Tomahawk::result_ptr& track )
{
Q_ASSERT( QThread::currentThread() == thread() );
if ( m_reachedScrobblePoint )
{
m_reachedScrobblePoint = false;
scrobble();
}
Tomahawk::InfoSystem::InfoStringHash trackInfo;
trackInfo["title"] = track->track();
trackInfo["artist"] = track->artist()->name();
trackInfo["album"] = track->album()->name();
trackInfo["duration"] = QString::number( track->duration() );
trackInfo["albumpos"] = QString::number( track->albumpos() );
QVariantMap playInfo;
playInfo["trackinfo"] = QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( trackInfo );
playInfo["private"] = TomahawkSettings::instance()->privateListeningMode();
Tomahawk::InfoSystem::InfoPushData pushData (
s_scInfoIdentifier, Tomahawk::InfoSystem::InfoSubmitNowPlaying,
playInfo,
Tomahawk::InfoSystem::PushNoFlag );
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo( pushData );
// liblastfm forces 0-length tracks to scrobble after 4 minutes, stupid.
if ( track->duration() == 0 )
m_scrobblePoint = ScrobblePoint( 30 );
else
m_scrobblePoint = ScrobblePoint( track->duration() / 2 );
}
示例2: thread
void
Scrobbler::trackStarted( const Tomahawk::result_ptr& track )
{
Q_ASSERT( QThread::currentThread() == thread() );
// qDebug() << Q_FUNC_INFO;
if( m_reachedScrobblePoint )
{
m_reachedScrobblePoint = false;
scrobble();
}
Tomahawk::InfoSystem::InfoCriteriaHash trackInfo;
trackInfo["title"] = track->track();
trackInfo["artist"] = track->artist()->name();
trackInfo["album"] = track->album()->name();
trackInfo["duration"] = QString::number( track->duration() );
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo(
s_scInfoIdentifier, Tomahawk::InfoSystem::InfoSubmitNowPlaying,
QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( trackInfo ) );
m_scrobblePoint = ScrobblePoint( track->duration() / 2 );
}
示例3: qDebug
void
AudioControls::onPlaybackStarted( const Tomahawk::result_ptr& result )
{
qDebug() << Q_FUNC_INFO;
onPlaybackLoading( result );
QString artistName = result->artist()->name();
QString albumName = result->album()->name();
Tomahawk::InfoSystem::InfoCustomDataHash trackInfo;
trackInfo["artist"] = QVariant::fromValue< QString >( result->artist()->name() );
trackInfo["album"] = QVariant::fromValue< QString >( result->album()->name() );
TomahawkApp::instance()->infoSystem()->getInfo(
s_infoIdentifier, Tomahawk::InfoSystem::InfoAlbumCoverArt,
QVariant::fromValue< Tomahawk::InfoSystem::InfoCustomDataHash >( trackInfo ), Tomahawk::InfoSystem::InfoCustomDataHash() );
}
示例4: coverFile
QVariantMap
MprisPlugin::metadata() const
{
QVariantMap metadataMap;
Tomahawk::result_ptr track = AudioEngine::instance()->currentTrack();
if ( track )
{
metadataMap.insert( "mpris:trackid", QVariant::fromValue(QDBusObjectPath(QString( "/track/" ) + track->id().replace( "-", "" ))) );
metadataMap.insert( "mpris:length", static_cast<qlonglong>(track->duration()) * 1000000 );
metadataMap.insert( "xesam:album", track->album()->name() );
metadataMap.insert( "xesam:artist", QStringList( track->artist()->name() ) );
metadataMap.insert( "xesam:title", track->track() );
// Only return art if tempfile exists, and if its name contains the same "artist_album_tomahawk_cover.png"
if ( !m_coverTempFile.isEmpty() )
{
QFile coverFile( m_coverTempFile );
if ( coverFile.exists() && coverFile.fileName().contains( track->artist()->name() + "_" + track->album()->name() + "_tomahawk_cover.png" ) )
metadataMap.insert( "mpris:artUrl", QString( QUrl::fromLocalFile( m_coverTempFile ).toEncoded() ) );
}
}
return metadataMap;
}
示例5: QString
QVariantMap
MprisPlugin::metadata() const
{
QVariantMap metadataMap;
Tomahawk::result_ptr track = AudioEngine::instance()->currentTrack();
if( track )
{
metadataMap.insert( "mpris:trackid", QString( "/track/" ) + track->id().replace( "-", "" ) );
metadataMap.insert( "mpris:length", track->duration() );
metadataMap.insert( "xesam:album", track->album()->name() );
metadataMap.insert( "xesam:artist", track->artist()->name() );
metadataMap.insert( "xesam:title", track->track() );
}
return metadataMap;
}
示例6: itemFromIndex
bool
TrackProxyModel::filterAcceptsRow( int sourceRow, const QModelIndex& sourceParent ) const
{
TrackModelItem* pi = itemFromIndex( sourceModel()->index( sourceRow, 0, sourceParent ) );
if ( !pi )
return false;
const Tomahawk::query_ptr& q = pi->query();
if( q.isNull() ) // uh oh? filter out invalid queries i guess
return false;
Tomahawk::result_ptr r;
if ( q->numResults() )
r = q->results().first();
if ( !m_showOfflineResults && !r.isNull() && !r->collection()->source()->isOnline() )
return false;
if ( filterRegExp().isEmpty() )
return true;
QStringList sl = filterRegExp().pattern().split( " ", QString::SkipEmptyParts );
foreach( QString s, sl )
{
s = s.toLower();
if ( !r.isNull() )
{
if ( !r->artist()->name().toLower().contains( s ) &&
!r->album()->name().toLower().contains( s ) &&
!r->track().toLower().contains( s ) )
{
return false;
}
}
else
{
if ( !q->artist().toLower().contains( s ) &&
!q->album().toLower().contains( s ) &&
!q->track().toLower().contains( s ) )
{
return false;
}
}
}
示例7: tDebug
void
AudioControls::onPlaybackStarted( const Tomahawk::result_ptr& result )
{
tDebug( LOGEXTRA ) << Q_FUNC_INFO;
if ( result.isNull() )
return;
if ( m_currentTrack.isNull() || ( !m_currentTrack.isNull() && m_currentTrack.data()->id() != result.data()->id() ) )
onPlaybackLoading( result );
qint64 duration = AudioEngine::instance()->currentTrackTotalTime();
if ( duration == -1 )
duration = result.data()->duration() * 1000;
ui->seekSlider->setRange( 0, duration );
ui->seekSlider->setValue( 0 );
m_phononTickCheckTimer.stop();
m_sliderTimeLine.stop();
m_sliderTimeLine.setDuration( duration );
m_sliderTimeLine.setFrameRange( 0, duration );
m_sliderTimeLine.setCurrentTime( 0 );
m_seekMsecs = -1;
ui->seekSlider->setVisible( true );
m_noTimeChange = false;
m_lastSliderCheck = 0;
Tomahawk::InfoSystem::InfoStringHash trackInfo;
trackInfo["artist"] = result->artist()->name();
trackInfo["album"] = result->album()->name();
Tomahawk::InfoSystem::InfoRequestData requestData;
requestData.caller = s_acInfoIdentifier;
requestData.type = Tomahawk::InfoSystem::InfoAlbumCoverArt;
requestData.input = QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( trackInfo );
requestData.customData = QVariantMap();
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( requestData );
}
示例8: levenshtein
// TODO make clever (ft. featuring live (stuff) etc)
float
DatabaseCommand_Resolve::how_similar( const Tomahawk::query_ptr& q, const Tomahawk::result_ptr& r )
{
// query values
const QString qArtistname = DatabaseImpl::sortname( q->artist() );
const QString qAlbumname = DatabaseImpl::sortname( q->album() );
const QString qTrackname = DatabaseImpl::sortname( q->track() );
// result values
const QString rArtistname = DatabaseImpl::sortname( r->artist()->name() );
const QString rAlbumname = DatabaseImpl::sortname( r->album()->name() );
const QString rTrackname = DatabaseImpl::sortname( r->track() );
// normal edit distance
int artdist = levenshtein( qArtistname, rArtistname );
int albdist = levenshtein( qAlbumname, rAlbumname );
int trkdist = levenshtein( qTrackname, rTrackname );
// max length of name
int mlart = qMax( qArtistname.length(), rArtistname.length() );
int mlalb = qMax( qAlbumname.length(), rAlbumname.length() );
int mltrk = qMax( qTrackname.length(), rTrackname.length() );
// distance scores
float dcart = (float)( mlart - artdist ) / mlart;
float dcalb = (float)( mlalb - albdist ) / mlalb;
float dctrk = (float)( mltrk - trkdist ) / mltrk;
// don't penalize for missing album name
if( qAlbumname.length() == 0 )
dcalb = 1.0;
// weighted, so album match is worth less than track title
float combined = ( dcart*4 + dcalb + dctrk*5 ) / 10;
return combined;
}