1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-05 13:47:26 +02:00

Add pushInfo API to InfoSystem, and switch the LastFM Plugin over to

using it
This commit is contained in:
Jeff Mitchell
2011-04-30 17:10:36 -04:00
parent eec9283aff
commit 2a39355fb6
11 changed files with 173 additions and 115 deletions

View File

@@ -32,7 +32,7 @@ EchoNestPlugin::EchoNestPlugin(InfoSystemWorker *parent)
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
QSet< InfoType > supportedTypes; QSet< InfoType > supportedTypes;
supportedTypes << Tomahawk::InfoSystem::InfoArtistBiography << Tomahawk::InfoSystem::InfoArtistFamiliarity << Tomahawk::InfoSystem::InfoArtistHotttness << Tomahawk::InfoSystem::InfoArtistTerms << Tomahawk::InfoSystem::InfoMiscTopTerms; supportedTypes << Tomahawk::InfoSystem::InfoArtistBiography << Tomahawk::InfoSystem::InfoArtistFamiliarity << Tomahawk::InfoSystem::InfoArtistHotttness << Tomahawk::InfoSystem::InfoArtistTerms << Tomahawk::InfoSystem::InfoMiscTopTerms;
parent->registerInfoTypes(this, supportedTypes); parent->registerInfoTypes( this, supportedTypes, QSet< InfoType>() );
} }
EchoNestPlugin::~EchoNestPlugin() EchoNestPlugin::~EchoNestPlugin()

View File

@@ -46,6 +46,22 @@ public:
protected slots: protected slots:
virtual void getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData ); virtual void getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData );
virtual void pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant data )
{
Q_UNUSED( caller );
Q_UNUSED( type );
Q_UNUSED( data );
}
virtual void notInCacheSlot( const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData )
{
Q_UNUSED( criteria );
Q_UNUSED( caller );
Q_UNUSED( type );
Q_UNUSED( input );
Q_UNUSED( customData );
}
private: private:
void getSongProfile( const QString &caller, const QVariant &input, const InfoCustomData &customData, const QString &item = QString() ); void getSongProfile( const QString &caller, const QVariant &input, const InfoCustomData &customData, const QString &item = QString() );
void getArtistBiography ( const QString &caller, const QVariant &input, const InfoCustomData &customData ); void getArtistBiography ( const QString &caller, const QVariant &input, const InfoCustomData &customData );

View File

@@ -47,9 +47,10 @@ LastFmPlugin::LastFmPlugin( InfoSystemWorker* parent )
, m_authJob( 0 ) , m_authJob( 0 )
, m_infoSystemWorker( parent ) , m_infoSystemWorker( parent )
{ {
QSet< InfoType > supportedTypes; QSet< InfoType > supportedGetTypes, supportedPushTypes;
supportedTypes << InfoMiscSubmitScrobble << InfoMiscSubmitNowPlaying << InfoAlbumCoverArt << InfoArtistImages; supportedGetTypes << InfoAlbumCoverArt << InfoArtistImages;
parent->registerInfoTypes(this, supportedTypes); supportedPushTypes << InfoSubmitScrobble << InfoSubmitNowPlaying;
parent->registerInfoTypes( this, supportedGetTypes, supportedPushTypes );
/* /*
Your API Key is 7194b85b6d1f424fe1668173a78c0c4a Your API Key is 7194b85b6d1f424fe1668173a78c0c4a
@@ -110,14 +111,6 @@ LastFmPlugin::getInfo( const QString caller, const Tomahawk::InfoSystem::InfoTyp
switch ( type ) switch ( type )
{ {
case InfoMiscSubmitNowPlaying:
nowPlaying( caller, type, input, customData );
break;
case InfoMiscSubmitScrobble:
scrobble( caller, type, input, customData );
break;
case InfoArtistImages: case InfoArtistImages:
fetchArtistImages( caller, type, input, customData ); fetchArtistImages( caller, type, input, customData );
break; break;
@@ -133,19 +126,34 @@ LastFmPlugin::getInfo( const QString caller, const Tomahawk::InfoSystem::InfoTyp
void void
LastFmPlugin::nowPlaying( const QString &caller, const InfoType type, const QVariant &input, const Tomahawk::InfoSystem::InfoCustomData &customData ) LastFmPlugin::pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input )
{
qDebug() << Q_FUNC_INFO;
switch ( type )
{
case InfoSubmitNowPlaying:
nowPlaying( caller, type, input );
break;
case InfoSubmitScrobble:
scrobble( caller, type, input );
break;
default:
return;
}
}
void
LastFmPlugin::nowPlaying( const QString &caller, const InfoType type, const QVariant &input )
{ {
if ( !input.canConvert< Tomahawk::InfoSystem::InfoCriteriaHash >() || !m_scrobbler ) if ( !input.canConvert< Tomahawk::InfoSystem::InfoCriteriaHash >() || !m_scrobbler )
{
dataError( caller, type, input, customData );
return; return;
}
InfoCriteriaHash hash = input.value< Tomahawk::InfoSystem::InfoCriteriaHash >(); InfoCriteriaHash hash = input.value< Tomahawk::InfoSystem::InfoCriteriaHash >();
if ( !hash.contains( "title" ) || !hash.contains( "artist" ) || !hash.contains( "album" ) || !hash.contains( "duration" ) ) if ( !hash.contains( "title" ) || !hash.contains( "artist" ) || !hash.contains( "album" ) || !hash.contains( "duration" ) )
{
dataError( caller, type, input, customData );
return; return;
}
m_track = lastfm::MutableTrack(); m_track = lastfm::MutableTrack();
m_track.stamp(); m_track.stamp();
@@ -158,26 +166,20 @@ LastFmPlugin::nowPlaying( const QString &caller, const InfoType type, const QVar
m_track.setSource( lastfm::Track::Player ); m_track.setSource( lastfm::Track::Player );
m_scrobbler->nowPlaying( m_track ); m_scrobbler->nowPlaying( m_track );
emit info( caller, type, input, QVariant(), customData );
} }
void void
LastFmPlugin::scrobble( const QString &caller, const InfoType type, const QVariant &input, const Tomahawk::InfoSystem::InfoCustomData &customData ) LastFmPlugin::scrobble( const QString &caller, const InfoType type, const QVariant &input )
{ {
Q_ASSERT( QThread::currentThread() == thread() ); Q_ASSERT( QThread::currentThread() == thread() );
if ( !m_scrobbler || m_track.isNull() ) if ( !m_scrobbler || m_track.isNull() )
{
dataError( caller, type, input, customData );
return; return;
}
qDebug() << Q_FUNC_INFO << m_track.toString(); qDebug() << Q_FUNC_INFO << m_track.toString();
m_scrobbler->cache( m_track ); m_scrobbler->cache( m_track );
m_scrobbler->submit(); m_scrobbler->submit();
emit info( caller, type, input, QVariant(), customData );
} }

View File

@@ -55,13 +55,15 @@ protected slots:
virtual void getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData ); virtual void getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData );
virtual void notInCacheSlot( const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData ); virtual void notInCacheSlot( const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData );
virtual void pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant data );
private: private:
void fetchCoverArt( const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input, const Tomahawk::InfoSystem::InfoCustomData &customData ); void fetchCoverArt( const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input, const Tomahawk::InfoSystem::InfoCustomData &customData );
void fetchArtistImages( const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input, const Tomahawk::InfoSystem::InfoCustomData &customData ); void fetchArtistImages( const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input, const Tomahawk::InfoSystem::InfoCustomData &customData );
void createScrobbler(); void createScrobbler();
void scrobble( const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input, const Tomahawk::InfoSystem::InfoCustomData &customData ); void scrobble( const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input );
void nowPlaying( const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input, const Tomahawk::InfoSystem::InfoCustomData &customData ); void nowPlaying( const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input );
void dataError( const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input, const Tomahawk::InfoSystem::InfoCustomData &customData ); void dataError( const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input, const Tomahawk::InfoSystem::InfoCustomData &customData );

View File

@@ -35,7 +35,7 @@ MusixMatchPlugin::MusixMatchPlugin(InfoSystemWorker *parent)
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
QSet< InfoType > supportedTypes; QSet< InfoType > supportedTypes;
supportedTypes << Tomahawk::InfoSystem::InfoTrackLyrics; supportedTypes << Tomahawk::InfoSystem::InfoTrackLyrics;
parent->registerInfoTypes(this, supportedTypes); parent->registerInfoTypes( this, supportedTypes, QSet< InfoType>() );
} }
MusixMatchPlugin::~MusixMatchPlugin() MusixMatchPlugin::~MusixMatchPlugin()

View File

@@ -45,6 +45,22 @@ public slots:
protected slots: protected slots:
virtual void getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData ); virtual void getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData );
virtual void pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant data )
{
Q_UNUSED( caller );
Q_UNUSED( type );
Q_UNUSED( data );
}
virtual void notInCacheSlot( const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData )
{
Q_UNUSED( criteria );
Q_UNUSED( caller );
Q_UNUSED( type );
Q_UNUSED( input );
Q_UNUSED( customData );
}
private: private:
bool isValidTrackData( const QString &caller, const QVariant &input, const InfoCustomData &customData ); bool isValidTrackData( const QString &caller, const QVariant &input, const InfoCustomData &customData );

View File

@@ -131,7 +131,7 @@ InfoSystem::newNam() const
void void
InfoSystem::getInfo(const QString &caller, const InfoType type, const QVariant& input, InfoCustomData customData) InfoSystem::getInfo( const QString &caller, const InfoType type, const QVariant& input, InfoCustomData customData )
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
@@ -142,15 +142,32 @@ InfoSystem::getInfo(const QString &caller, const InfoType type, const QVariant&
void void
InfoSystem::getInfo(const QString &caller, const InfoMap &input, InfoCustomData customData) InfoSystem::getInfo( const QString &caller, const InfoMap &input, InfoCustomData customData )
{ {
Q_FOREACH( InfoType type, input.keys() ) Q_FOREACH( InfoType type, input.keys() )
getInfo(caller, type, input[type], customData); getInfo( caller, type, input[type], customData );
} }
void void
InfoSystem::infoSlot(QString target, InfoType type, QVariant input, QVariant output, InfoCustomData customData) InfoSystem::pushInfo( const QString &caller, const InfoType type, const QVariant& input )
{
qDebug() << Q_FUNC_INFO;
QMetaObject::invokeMethod( m_worker, "pushInfo", Qt::QueuedConnection, Q_ARG( QString, caller ), Q_ARG( Tomahawk::InfoSystem::InfoType, type ), Q_ARG( QVariant, input ) );
}
void
InfoSystem::pushInfo( const QString &caller, const InfoMap &input )
{
Q_FOREACH( InfoType type, input.keys() )
pushInfo( caller, type, input[type] );
}
void
InfoSystem::infoSlot( QString target, InfoType type, QVariant input, QVariant output, InfoCustomData customData )
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
qDebug() << "current count in dataTracker is " << m_dataTracker[target][type]; qDebug() << "current count in dataTracker is " << m_dataTracker[target][type];

View File

@@ -38,61 +38,61 @@ namespace InfoSystem {
class InfoSystemCache; class InfoSystemCache;
class InfoSystemWorker; class InfoSystemWorker;
enum InfoType { enum InfoType { // as items are saved in cache, mark them here to not change them
InfoTrackID = 0, InfoTrackID = 0,
InfoTrackArtist, InfoTrackArtist = 1,
InfoTrackAlbum, InfoTrackAlbum = 2,
InfoTrackGenre, InfoTrackGenre = 3,
InfoTrackComposer, InfoTrackComposer = 4,
InfoTrackDate, InfoTrackDate = 5,
InfoTrackNumber, InfoTrackNumber = 6,
InfoTrackDiscNumber, InfoTrackDiscNumber = 7,
InfoTrackBitRate, InfoTrackBitRate = 8,
InfoTrackLength, InfoTrackLength = 9,
InfoTrackSampleRate, InfoTrackSampleRate = 10,
InfoTrackFileSize, InfoTrackFileSize = 11,
InfoTrackBPM, InfoTrackBPM = 12,
InfoTrackReplayGain, InfoTrackReplayGain = 13,
InfoTrackReplayPeakGain, InfoTrackReplayPeakGain = 14,
InfoTrackLyrics, InfoTrackLyrics = 15,
InfoTrackLocation, InfoTrackLocation = 16,
InfoTrackProfile, InfoTrackProfile = 17,
InfoTrackEnergy, InfoTrackEnergy = 18,
InfoTrackDanceability, InfoTrackDanceability = 19,
InfoTrackTempo, InfoTrackTempo = 20,
InfoTrackLoudness, InfoTrackLoudness = 21,
InfoArtistID, InfoArtistID = 22,
InfoArtistName, InfoArtistName = 23,
InfoArtistBiography, InfoArtistBiography = 24,
InfoArtistBlog, InfoArtistBlog = 25,
InfoArtistFamiliarity, InfoArtistFamiliarity = 26,
InfoArtistHotttness, InfoArtistHotttness = 27,
InfoArtistImages, InfoArtistImages = 28,
InfoArtistNews, InfoArtistNews = 29,
InfoArtistProfile, InfoArtistProfile = 30,
InfoArtistReviews, InfoArtistReviews = 31,
InfoArtistSongs, InfoArtistSongs = 32,
InfoArtistSimilars, InfoArtistSimilars = 33,
InfoArtistTerms, InfoArtistTerms = 34,
InfoArtistLinks, InfoArtistLinks = 35,
InfoArtistVideos, InfoArtistVideos = 36,
InfoAlbumID, InfoAlbumID = 37,
InfoAlbumName, InfoAlbumName = 38,
InfoAlbumArtist, InfoAlbumArtist = 39,
InfoAlbumDate, InfoAlbumDate = 40,
InfoAlbumGenre, InfoAlbumGenre = 41,
InfoAlbumComposer, InfoAlbumComposer = 42,
InfoAlbumCoverArt, InfoAlbumCoverArt = 43, //cached -- do not change
InfoMiscTopHotttness, InfoMiscTopHotttness = 44,
InfoMiscTopTerms, InfoMiscTopTerms = 45,
InfoMiscSubmitNowPlaying, InfoSubmitNowPlaying = 46,
InfoMiscSubmitScrobble, InfoSubmitScrobble = 47,
InfoNoInfo InfoNoInfo = 48
}; };
typedef QMap< InfoType, QVariant > InfoMap; typedef QMap< InfoType, QVariant > InfoMap;
@@ -120,16 +120,8 @@ signals:
protected slots: protected slots:
virtual void getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant data, const Tomahawk::InfoSystem::InfoCustomData customData ) = 0; virtual void getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant data, const Tomahawk::InfoSystem::InfoCustomData customData ) = 0;
virtual void pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant data ) = 0;
//FIXME: Make pure virtual when everything supports it virtual void notInCacheSlot( const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData ) = 0;
virtual void notInCacheSlot( const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData )
{
Q_UNUSED( criteria );
Q_UNUSED( caller );
Q_UNUSED( type );
Q_UNUSED( input );
Q_UNUSED( customData );
}
protected: protected:
InfoType m_type; InfoType m_type;
@@ -152,6 +144,8 @@ public:
void getInfo( const QString &caller, const InfoType type, const QVariant &input, InfoCustomData customData ); void getInfo( const QString &caller, const InfoType type, const QVariant &input, InfoCustomData customData );
void getInfo( const QString &caller, const InfoMap &input, InfoCustomData customData ); void getInfo( const QString &caller, const InfoMap &input, InfoCustomData customData );
void pushInfo( const QString &caller, const InfoType type, const QVariant &input );
void pushInfo( const QString &caller, const InfoMap &input );
InfoSystemCache* getCache() const { return m_cache; } InfoSystemCache* getCache() const { return m_cache; }
void newNam() const; void newNam() const;

View File

@@ -89,21 +89,23 @@ InfoSystemWorker::~InfoSystemWorker()
void void
InfoSystemWorker::registerInfoTypes(const InfoPluginPtr &plugin, const QSet< InfoType >& types) InfoSystemWorker::registerInfoTypes( const InfoPluginPtr &plugin, const QSet< InfoType >& getTypes, const QSet< InfoType >& pushTypes )
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
Q_FOREACH(InfoType type, types) Q_FOREACH( InfoType type, getTypes )
m_infoMap[type].append(plugin); m_infoGetMap[type].append( plugin );
Q_FOREACH( InfoType type, pushTypes )
m_infoPushMap[type].append( plugin );
} }
QLinkedList< InfoPluginPtr > QLinkedList< InfoPluginPtr >
InfoSystemWorker::determineOrderedMatches(const InfoType type) const InfoSystemWorker::determineOrderedMatches( const InfoType type ) const
{ {
//Dummy function for now that returns the various items in the QSet; at some point this will //Dummy function for now that returns the various items in the QSet; at some point this will
//probably need to support ordering based on the data source //probably need to support ordering based on the data source
QLinkedList< InfoPluginPtr > providers; QLinkedList< InfoPluginPtr > providers;
Q_FOREACH(InfoPluginPtr ptr, m_infoMap[type]) Q_FOREACH( InfoPluginPtr ptr, m_infoGetMap[type] )
providers << ptr; providers << ptr;
return providers; return providers;
} }
@@ -114,16 +116,16 @@ InfoSystemWorker::getInfo( QString caller, InfoType type, QVariant input, InfoCu
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
QLinkedList< InfoPluginPtr > providers = determineOrderedMatches(type); QLinkedList< InfoPluginPtr > providers = determineOrderedMatches(type);
if (providers.isEmpty()) if ( providers.isEmpty() )
{ {
emit info(caller, type, QVariant(), QVariant(), customData); emit info( caller, type, QVariant(), QVariant(), customData );
return; return;
} }
InfoPluginPtr ptr = providers.first(); InfoPluginPtr ptr = providers.first();
if (!ptr) if ( !ptr )
{ {
emit info(caller, type, QVariant(), QVariant(), customData); emit info( caller, type, QVariant(), QVariant(), customData );
return; return;
} }
@@ -131,6 +133,19 @@ InfoSystemWorker::getInfo( QString caller, InfoType type, QVariant input, InfoCu
} }
void
InfoSystemWorker::pushInfo( const QString caller, const InfoType type, const QVariant input )
{
qDebug() << Q_FUNC_INFO;
Q_FOREACH( InfoPluginPtr ptr, m_infoPushMap[type] )
{
if( ptr )
QMetaObject::invokeMethod( ptr.data(), "pushInfo", Qt::QueuedConnection, Q_ARG( QString, caller ), Q_ARG( Tomahawk::InfoSystem::InfoType, type ), Q_ARG( QVariant, input ) );
}
}
QNetworkAccessManager* QNetworkAccessManager*
InfoSystemWorker::nam() const InfoSystemWorker::nam() const
{ {

View File

@@ -44,7 +44,7 @@ public:
InfoSystemWorker(); InfoSystemWorker();
~InfoSystemWorker(); ~InfoSystemWorker();
void registerInfoTypes( const InfoPluginPtr &plugin, const QSet< InfoType > &types ); void registerInfoTypes( const InfoPluginPtr &plugin, const QSet< InfoType > &getTypes, const QSet< InfoType > &pushTypes );
QNetworkAccessManager* nam() const; QNetworkAccessManager* nam() const;
signals: signals:
@@ -52,6 +52,7 @@ signals:
public slots: public slots:
void getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData ); void getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData );
void pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input );
void newNam(); void newNam();
private: private:
@@ -60,7 +61,8 @@ private:
// For now, statically instantiate plugins; this is just somewhere to keep them // For now, statically instantiate plugins; this is just somewhere to keep them
QLinkedList< InfoPluginPtr > m_plugins; QLinkedList< InfoPluginPtr > m_plugins;
QMap< InfoType, QLinkedList< InfoPluginPtr > > m_infoMap; QMap< InfoType, QLinkedList< InfoPluginPtr > > m_infoGetMap;
QMap< InfoType, QLinkedList< InfoPluginPtr > > m_infoPushMap;
QNetworkAccessManager *m_nam; QNetworkAccessManager *m_nam;
}; };

View File

@@ -80,9 +80,9 @@ Scrobbler::trackStarted( const Tomahawk::result_ptr& track )
trackInfo["artist"] = track->artist()->name(); trackInfo["artist"] = track->artist()->name();
trackInfo["album"] = track->album()->name(); trackInfo["album"] = track->album()->name();
trackInfo["duration"] = QString::number( track->duration() ); trackInfo["duration"] = QString::number( track->duration() );
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo(
s_scInfoIdentifier, Tomahawk::InfoSystem::InfoMiscSubmitNowPlaying, s_scInfoIdentifier, Tomahawk::InfoSystem::InfoSubmitNowPlaying,
QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( trackInfo ), Tomahawk::InfoSystem::InfoCustomData() ); QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( trackInfo ) );
m_scrobblePoint = ScrobblePoint( track->duration() / 2 ); m_scrobblePoint = ScrobblePoint( track->duration() / 2 );
} }
@@ -128,9 +128,9 @@ Scrobbler::scrobble()
{ {
Q_ASSERT( QThread::currentThread() == thread() ); Q_ASSERT( QThread::currentThread() == thread() );
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo(
s_scInfoIdentifier, Tomahawk::InfoSystem::InfoMiscSubmitScrobble, s_scInfoIdentifier, Tomahawk::InfoSystem::InfoSubmitScrobble,
QVariant(), Tomahawk::InfoSystem::InfoCustomData() ); QVariant() );
} }
@@ -141,13 +141,7 @@ Scrobbler::infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type,
Q_UNUSED( output ); Q_UNUSED( output );
Q_UNUSED( customData ); Q_UNUSED( customData );
if ( caller == s_scInfoIdentifier ) if ( caller == s_scInfoIdentifier )
{
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
if ( type == Tomahawk::InfoSystem::InfoMiscSubmitNowPlaying )
qDebug() << "Scrobbler received now playing response from InfoSystem";
else if ( type == Tomahawk::InfoSystem::InfoMiscSubmitScrobble )
qDebug() << "Scrobbler received scrobble response from InfoSystem";
}
} }