Beispiel #1
0
void
FdoNotifyPlugin::pushInfo( Tomahawk::InfoSystem::InfoPushData pushData )
{
    qDebug() << Q_FUNC_INFO;
    QVariant inputData = pushData.infoPair.second;

    switch ( pushData.type )
    {
        case Tomahawk::InfoSystem::InfoTrackUnresolved:
            notifyUser( "The current track could not be resolved. Tomahawk will pick back up with the next resolvable track from this source." );
            return;

        case Tomahawk::InfoSystem::InfoNotifyUser:
            notifyUser( pushData.infoPair.second.toString() );
            return;

        case Tomahawk::InfoSystem::InfoNowStopped:
            notifyUser( "Tomahawk is stopped." );
            return;

        case Tomahawk::InfoSystem::InfoNowPlaying:
            nowPlaying( pushData.infoPair.second );
            return;

        default:
            return;
    }

}
void
FdoNotifyPlugin::pushInfo( Tomahawk::InfoSystem::InfoPushData pushData )
{
    qDebug() << Q_FUNC_INFO << "showing notification: " << TomahawkSettings::instance()->songChangeNotificationEnabled();

    if ( !TomahawkSettings::instance()->songChangeNotificationEnabled() )
        return;

    QVariant inputData = pushData.infoPair.second;

    switch ( pushData.type )
    {
        case Tomahawk::InfoSystem::InfoTrackUnresolved:
            notifyUser( "The current track could not be resolved. Tomahawk will pick back up with the next resolvable track from this source." );
            return;

        case Tomahawk::InfoSystem::InfoNotifyUser:
            notifyUser( pushData.infoPair.second.toString() );
            return;

        case Tomahawk::InfoSystem::InfoNowStopped:
            notifyUser( "Tomahawk is stopped." );
            return;

        case Tomahawk::InfoSystem::InfoNowPlaying:
            nowPlaying( pushData.infoPair.second );
            return;

        default:
            return;
    }

}
Beispiel #3
0
void
SnoreNotifyPlugin::pushInfo( Tomahawk::InfoSystem::InfoPushData pushData )
{
    tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "showing notification:" << TomahawkSettings::instance()->songChangeNotificationEnabled();
    if ( !TomahawkSettings::instance()->songChangeNotificationEnabled() )
        return;


    switch ( pushData.type )
    {
        case Tomahawk::InfoSystem::InfoTrackUnresolved:
            notifyUser( Tomahawk::InfoSystem::InfoTrackUnresolved, tr( "The current track could not be resolved. %applicationName will pick back up with the next resolvable track from this source." ), m_defaultIcon );
            return;

        case Tomahawk::InfoSystem::InfoNotifyUser:
            notifyUser( Tomahawk::InfoSystem::InfoNotifyUser,pushData.infoPair.second.toString(), m_defaultIcon );
            return;

        case Tomahawk::InfoSystem::InfoNowStopped:
            notifyUser( Tomahawk::InfoSystem::InfoNowStopped, tr( "%applicationName stopped playback." ), m_defaultIcon );
            return;

        case Tomahawk::InfoSystem::InfoNowPlaying:
            nowPlaying( pushData.infoPair.second );
            return;

        case Tomahawk::InfoSystem::InfoInboxReceived:
            inboxReceived( pushData.infoPair.second );
            return;

        default:
            return;
    }

}
Beispiel #4
0
void LastFmService::slot_track_changed() 
{
    Debug::debug() << "  [LastFmService] slot_track_changed " << m_currentTrack;

    if (m_currentTrack)
      scrobble();
      
    m_currentTrack  = Engine::instance()->playingTrack();
    
    /* init time counter */
    m_playbackStart  = QDateTime::currentDateTime().toTime_t();
    m_playbackLength = 0;
    m_unpauseTime    = m_playbackStart;
 
    nowPlaying();
}
int Scrobbler::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: status((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< QVariant(*)>(_a[2]))); break;
        case 1: status((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 2: nowPlaying((*reinterpret_cast< const Track(*)>(_a[1]))); break;
        case 3: cache((*reinterpret_cast< const Track(*)>(_a[1]))); break;
        case 4: submit(); break;
        case 5: onHandshakeReturn((*reinterpret_cast< const QByteArray(*)>(_a[1]))); break;
        case 6: onNowPlayingReturn((*reinterpret_cast< const QByteArray(*)>(_a[1]))); break;
        case 7: onSubmissionReturn((*reinterpret_cast< const QByteArray(*)>(_a[1]))); break;
        case 8: onSubmissionStarted((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 9: onHandshakeHeaderReceived((*reinterpret_cast< const QHttpResponseHeader(*)>(_a[1]))); break;
        }
        _id -= 10;
    }
    return _id;
}
Beispiel #6
0
void AudioPlayer::play(const QString &file)/*{{{*/
{
	SNDFILE *sndfile ;
	SF_INFO sndfileinfo ;

	if (file.isEmpty())
	{	
		fprintf (stderr, "no soundfile given\n");
		//TODO: emit error signals
		emit playbackStopped(true);
		return;
	}

	// Open the soundfile.
	sndfileinfo.format = 0 ;
	sndfile = sf_open (file.toUtf8().constData(), SFM_READ, &sndfileinfo) ;
	if (sndfile == NULL)
	{	
		//TODO: emit error signals
		fprintf (stderr, "Could not open soundfile '%s'\n", file.toUtf8().constData()) ;
		emit playbackStopped(true);
		return;
	}

	// Init the thread info struct.
	info.can_process = 0 ;
	info.read_done = 0 ;
	info.play_done = 0 ;
	info.sndfile = sndfile ;
	info.channels = sndfileinfo.channels ;
	info.client = m_client ;
	info.pos = 0 ;
	
	if(info.seek && info.seek < sndfileinfo.frames)
	{
		//qDebug("Preseting seek point");
		sf_seek(sndfile, info.seek, SEEK_CUR);
		info.seek = 0;
	}

	if(!startClient())
		return;
		
	// Start the disk thread. 
	pthread_create (&info.thread_id, NULL, AudioPlayer::read_file, &info);
	info.can_read = 1 ;
	
	m_isPlaying = true;

	emit nowPlaying(QString(file).append("@--,--@").append(calcTimeString((int)sndfileinfo.frames)), sndfileinfo.frames);

	while (!info.play_done)
	{	
		printTime() ;
		usleep (50000) ;
	}
	printTime();
	//memset (ringbuf->buf, 0, ringbuf->size);

	m_isPlaying = false;

	info.can_process = 0;
	
	stopClient();
	sf_close (sndfile) ;
	info.sndfile = 0;
	emit playbackStopped(true);
}/*}}}*/