void
Tomahawk::InfoSystem::XmppInfoPlugin::pushInfo(QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input)
{
    tDebug() << Q_FUNC_INFO << m_sipPlugin->m_client->jid().full();

    if( m_sipPlugin->m_account->configuration().value("publishtracks").toBool() == false )
    {
        tDebug() << Q_FUNC_INFO <<  m_sipPlugin->m_client->jid().full() << "Not publishing now playing info (disabled in account config)";
        return;
    }

    switch ( type )
    {
        case InfoNowPlaying:
        case InfoNowResumed:
            m_pauseTimer.stop();
            if ( input.canConvert< Tomahawk::InfoSystem::InfoStringHash >() )
                audioStarted( input.value< Tomahawk::InfoSystem::InfoStringHash >() );
            break;
        case InfoNowPaused:
            m_pauseTimer.start( PAUSE_TIMEOUT * 1000 );
            audioPaused();
            break;
        case InfoNowStopped:
            m_pauseTimer.stop();
            audioStopped();
            break;

        default:
            return;
    }
}
Exemple #2
0
// InfoPlugin Methods
void
MprisPlugin::pushInfo( Tomahawk::InfoSystem::InfoPushData pushData )
{
    bool isPlayingInfo = false;

    switch ( pushData.type )
    {
        case InfoNowPlaying:
          isPlayingInfo = true;
          audioStarted( pushData.infoPair.second );
          break;
        case InfoNowPaused:
          isPlayingInfo = true;
          audioPaused();
          break;
        case InfoNowResumed:
          isPlayingInfo = true;
          audioResumed( pushData.infoPair.second );
          break;
        case InfoNowStopped:
          isPlayingInfo = true;
          audioStopped();
          break;

        default:
          break;
    }

    if ( isPlayingInfo )
        notifyPropertyChanged( "org.mpris.MediaPlayer2.Player", "PlaybackStatus" );
}