void LastFmPlugin::nowPlaying( const QString &caller, const InfoType type, const QVariant& data, Tomahawk::InfoSystem::InfoCustomData &customData ) { if ( !data.canConvert< Tomahawk::InfoSystem::InfoCriteriaHash >() || !m_scrobbler ) { dataError( caller, type, data, customData ); return; } InfoCriteriaHash hash = data.value< Tomahawk::InfoSystem::InfoCriteriaHash >(); if ( !hash.contains( "title" ) || !hash.contains( "artist" ) || !hash.contains( "album" ) || !hash.contains( "duration" ) ) { dataError( caller, type, data, customData ); return; } m_track = lastfm::MutableTrack(); m_track.stamp(); m_track.setTitle( hash["title"] ); m_track.setArtist( hash["artist"] ); m_track.setAlbum( hash["album"] ); bool ok; m_track.setDuration( hash["duration"].toUInt( &ok ) ); m_track.setSource( lastfm::Track::Player ); m_scrobbler->nowPlaying( m_track ); emit info( caller, type, data, QVariant(), customData ); }
/** Audio state slots */ void MprisPlugin::audioStarted( const QVariant &input ) { qDebug() << Q_FUNC_INFO; if ( !input.canConvert< Tomahawk::InfoSystem::InfoCriteriaHash >() ) return; InfoCriteriaHash hash = input.value< Tomahawk::InfoSystem::InfoCriteriaHash >(); if ( !hash.contains( "title" ) || !hash.contains( "artist" ) ) return; m_playbackStatus = "Playing"; notifyPropertyChanged( "org.mpris.MediaPlayer2.Player", "Metadata"); //hash["artist"]; //hash["title"]; //QString nowPlaying = ""; //qDebug() << "nowPlaying: " << nowPlaying; }
void LastFmPlugin::fetchArtistImages( const QString &caller, const InfoType type, const QVariant& data, Tomahawk::InfoSystem::InfoCustomData &customData ) { qDebug() << Q_FUNC_INFO; if ( !data.canConvert< Tomahawk::InfoSystem::InfoCriteriaHash >() ) { dataError( caller, type, data, customData ); return; } InfoCriteriaHash hash = data.value< Tomahawk::InfoSystem::InfoCriteriaHash >(); if ( !hash.contains( "artist" ) ) { dataError( caller, type, data, customData ); return; } Tomahawk::InfoSystem::InfoCriteriaHash criteria; criteria["artist"] = hash["artist"]; emit getCachedInfo( criteria, 2419200000, caller, type, data, customData ); }