1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-05-05 07:38:04 +02:00

Add in the hooks to control when listening information is sent. Now just need a UI for it...

This commit is contained in:
Jeff Mitchell 2011-11-05 20:31:10 -04:00
parent edd69b30e0
commit 1a541c43ad

View File

@ -471,6 +471,11 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
m_mediaObject->play();
emit started( m_currentTrack );
if ( TomahawkSettings::instance()->verboseNotifications() )
sendNowPlayingNotification();
if ( TomahawkUtils::privateListeningMode() != TomahawkUtils::FullyPrivate )
{
DatabaseCommand_LogPlayback* cmd = new DatabaseCommand_LogPlayback( m_currentTrack, DatabaseCommand_LogPlayback::Started );
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd) );
@ -479,15 +484,13 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
trackInfo["artist"] = m_currentTrack->artist()->name();
trackInfo["album"] = m_currentTrack->album()->name();
if ( TomahawkSettings::instance()->verboseNotifications() )
sendNowPlayingNotification();
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo(
s_aeInfoIdentifier,
Tomahawk::InfoSystem::InfoNowPlaying,
QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( trackInfo ) );
}
}
}
if ( err )
{
@ -714,9 +717,12 @@ AudioEngine::setCurrentTrack( const Tomahawk::result_ptr& result )
{
m_lastTrack = m_currentTrack;
if ( !m_lastTrack.isNull() )
{
if ( TomahawkUtils::privateListeningMode() == TomahawkUtils::PublicListening )
{
DatabaseCommand_LogPlayback* cmd = new DatabaseCommand_LogPlayback( m_lastTrack, DatabaseCommand_LogPlayback::Finished, m_timeElapsed );
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd) );
}
emit finished( m_lastTrack );
}