mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-23 17:29:42 +01:00
Add pushInfo API to InfoSystem, and switch the LastFM Plugin over to
using it
This commit is contained in:
parent
eec9283aff
commit
2a39355fb6
@ -32,7 +32,7 @@ EchoNestPlugin::EchoNestPlugin(InfoSystemWorker *parent)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
QSet< InfoType > supportedTypes;
|
||||
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()
|
||||
|
@ -46,6 +46,22 @@ public:
|
||||
protected slots:
|
||||
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:
|
||||
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 );
|
||||
|
@ -47,9 +47,10 @@ LastFmPlugin::LastFmPlugin( InfoSystemWorker* parent )
|
||||
, m_authJob( 0 )
|
||||
, m_infoSystemWorker( parent )
|
||||
{
|
||||
QSet< InfoType > supportedTypes;
|
||||
supportedTypes << InfoMiscSubmitScrobble << InfoMiscSubmitNowPlaying << InfoAlbumCoverArt << InfoArtistImages;
|
||||
parent->registerInfoTypes(this, supportedTypes);
|
||||
QSet< InfoType > supportedGetTypes, supportedPushTypes;
|
||||
supportedGetTypes << InfoAlbumCoverArt << InfoArtistImages;
|
||||
supportedPushTypes << InfoSubmitScrobble << InfoSubmitNowPlaying;
|
||||
parent->registerInfoTypes( this, supportedGetTypes, supportedPushTypes );
|
||||
|
||||
/*
|
||||
Your API Key is 7194b85b6d1f424fe1668173a78c0c4a
|
||||
@ -110,14 +111,6 @@ LastFmPlugin::getInfo( const QString caller, const Tomahawk::InfoSystem::InfoTyp
|
||||
|
||||
switch ( type )
|
||||
{
|
||||
case InfoMiscSubmitNowPlaying:
|
||||
nowPlaying( caller, type, input, customData );
|
||||
break;
|
||||
|
||||
case InfoMiscSubmitScrobble:
|
||||
scrobble( caller, type, input, customData );
|
||||
break;
|
||||
|
||||
case InfoArtistImages:
|
||||
fetchArtistImages( caller, type, input, customData );
|
||||
break;
|
||||
@ -133,19 +126,34 @@ LastFmPlugin::getInfo( const QString caller, const Tomahawk::InfoSystem::InfoTyp
|
||||
|
||||
|
||||
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 )
|
||||
{
|
||||
dataError( caller, type, input, customData );
|
||||
return;
|
||||
}
|
||||
|
||||
InfoCriteriaHash hash = input.value< Tomahawk::InfoSystem::InfoCriteriaHash >();
|
||||
if ( !hash.contains( "title" ) || !hash.contains( "artist" ) || !hash.contains( "album" ) || !hash.contains( "duration" ) )
|
||||
{
|
||||
dataError( caller, type, input, customData );
|
||||
return;
|
||||
}
|
||||
|
||||
m_track = lastfm::MutableTrack();
|
||||
m_track.stamp();
|
||||
@ -158,26 +166,20 @@ LastFmPlugin::nowPlaying( const QString &caller, const InfoType type, const QVar
|
||||
m_track.setSource( lastfm::Track::Player );
|
||||
|
||||
m_scrobbler->nowPlaying( m_track );
|
||||
emit info( caller, type, input, QVariant(), customData );
|
||||
}
|
||||
|
||||
|
||||
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() );
|
||||
|
||||
if ( !m_scrobbler || m_track.isNull() )
|
||||
{
|
||||
dataError( caller, type, input, customData );
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << Q_FUNC_INFO << m_track.toString();
|
||||
m_scrobbler->cache( m_track );
|
||||
m_scrobbler->submit();
|
||||
|
||||
emit info( caller, type, input, QVariant(), customData );
|
||||
}
|
||||
|
||||
|
||||
|
@ -54,14 +54,16 @@ public slots:
|
||||
protected slots:
|
||||
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 pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant data );
|
||||
|
||||
private:
|
||||
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 createScrobbler();
|
||||
void scrobble( 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, 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 );
|
||||
|
||||
void dataError( const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input, const Tomahawk::InfoSystem::InfoCustomData &customData );
|
||||
|
||||
|
@ -35,7 +35,7 @@ MusixMatchPlugin::MusixMatchPlugin(InfoSystemWorker *parent)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
QSet< InfoType > supportedTypes;
|
||||
supportedTypes << Tomahawk::InfoSystem::InfoTrackLyrics;
|
||||
parent->registerInfoTypes(this, supportedTypes);
|
||||
parent->registerInfoTypes( this, supportedTypes, QSet< InfoType>() );
|
||||
}
|
||||
|
||||
MusixMatchPlugin::~MusixMatchPlugin()
|
||||
|
@ -44,6 +44,22 @@ public slots:
|
||||
|
||||
protected slots:
|
||||
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:
|
||||
bool isValidTrackData( const QString &caller, const QVariant &input, const InfoCustomData &customData );
|
||||
|
@ -131,7 +131,7 @@ InfoSystem::newNam() const
|
||||
|
||||
|
||||
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;
|
||||
|
||||
@ -142,15 +142,32 @@ InfoSystem::getInfo(const QString &caller, const InfoType type, const QVariant&
|
||||
|
||||
|
||||
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() )
|
||||
getInfo(caller, type, input[type], customData);
|
||||
getInfo( caller, type, input[type], customData );
|
||||
}
|
||||
|
||||
|
||||
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() << "current count in dataTracker is " << m_dataTracker[target][type];
|
||||
|
@ -38,61 +38,61 @@ namespace InfoSystem {
|
||||
class InfoSystemCache;
|
||||
class InfoSystemWorker;
|
||||
|
||||
enum InfoType {
|
||||
enum InfoType { // as items are saved in cache, mark them here to not change them
|
||||
InfoTrackID = 0,
|
||||
InfoTrackArtist,
|
||||
InfoTrackAlbum,
|
||||
InfoTrackGenre,
|
||||
InfoTrackComposer,
|
||||
InfoTrackDate,
|
||||
InfoTrackNumber,
|
||||
InfoTrackDiscNumber,
|
||||
InfoTrackBitRate,
|
||||
InfoTrackLength,
|
||||
InfoTrackSampleRate,
|
||||
InfoTrackFileSize,
|
||||
InfoTrackBPM,
|
||||
InfoTrackReplayGain,
|
||||
InfoTrackReplayPeakGain,
|
||||
InfoTrackLyrics,
|
||||
InfoTrackLocation,
|
||||
InfoTrackProfile,
|
||||
InfoTrackEnergy,
|
||||
InfoTrackDanceability,
|
||||
InfoTrackTempo,
|
||||
InfoTrackLoudness,
|
||||
InfoTrackArtist = 1,
|
||||
InfoTrackAlbum = 2,
|
||||
InfoTrackGenre = 3,
|
||||
InfoTrackComposer = 4,
|
||||
InfoTrackDate = 5,
|
||||
InfoTrackNumber = 6,
|
||||
InfoTrackDiscNumber = 7,
|
||||
InfoTrackBitRate = 8,
|
||||
InfoTrackLength = 9,
|
||||
InfoTrackSampleRate = 10,
|
||||
InfoTrackFileSize = 11,
|
||||
InfoTrackBPM = 12,
|
||||
InfoTrackReplayGain = 13,
|
||||
InfoTrackReplayPeakGain = 14,
|
||||
InfoTrackLyrics = 15,
|
||||
InfoTrackLocation = 16,
|
||||
InfoTrackProfile = 17,
|
||||
InfoTrackEnergy = 18,
|
||||
InfoTrackDanceability = 19,
|
||||
InfoTrackTempo = 20,
|
||||
InfoTrackLoudness = 21,
|
||||
|
||||
InfoArtistID,
|
||||
InfoArtistName,
|
||||
InfoArtistBiography,
|
||||
InfoArtistBlog,
|
||||
InfoArtistFamiliarity,
|
||||
InfoArtistHotttness,
|
||||
InfoArtistImages,
|
||||
InfoArtistNews,
|
||||
InfoArtistProfile,
|
||||
InfoArtistReviews,
|
||||
InfoArtistSongs,
|
||||
InfoArtistSimilars,
|
||||
InfoArtistTerms,
|
||||
InfoArtistLinks,
|
||||
InfoArtistVideos,
|
||||
InfoArtistID = 22,
|
||||
InfoArtistName = 23,
|
||||
InfoArtistBiography = 24,
|
||||
InfoArtistBlog = 25,
|
||||
InfoArtistFamiliarity = 26,
|
||||
InfoArtistHotttness = 27,
|
||||
InfoArtistImages = 28,
|
||||
InfoArtistNews = 29,
|
||||
InfoArtistProfile = 30,
|
||||
InfoArtistReviews = 31,
|
||||
InfoArtistSongs = 32,
|
||||
InfoArtistSimilars = 33,
|
||||
InfoArtistTerms = 34,
|
||||
InfoArtistLinks = 35,
|
||||
InfoArtistVideos = 36,
|
||||
|
||||
InfoAlbumID,
|
||||
InfoAlbumName,
|
||||
InfoAlbumArtist,
|
||||
InfoAlbumDate,
|
||||
InfoAlbumGenre,
|
||||
InfoAlbumComposer,
|
||||
InfoAlbumCoverArt,
|
||||
InfoAlbumID = 37,
|
||||
InfoAlbumName = 38,
|
||||
InfoAlbumArtist = 39,
|
||||
InfoAlbumDate = 40,
|
||||
InfoAlbumGenre = 41,
|
||||
InfoAlbumComposer = 42,
|
||||
InfoAlbumCoverArt = 43, //cached -- do not change
|
||||
|
||||
InfoMiscTopHotttness,
|
||||
InfoMiscTopTerms,
|
||||
InfoMiscTopHotttness = 44,
|
||||
InfoMiscTopTerms = 45,
|
||||
|
||||
InfoMiscSubmitNowPlaying,
|
||||
InfoMiscSubmitScrobble,
|
||||
InfoSubmitNowPlaying = 46,
|
||||
InfoSubmitScrobble = 47,
|
||||
|
||||
InfoNoInfo
|
||||
InfoNoInfo = 48
|
||||
};
|
||||
|
||||
typedef QMap< InfoType, QVariant > InfoMap;
|
||||
@ -120,16 +120,8 @@ signals:
|
||||
|
||||
protected slots:
|
||||
virtual void getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant data, const Tomahawk::InfoSystem::InfoCustomData customData ) = 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 )
|
||||
{
|
||||
Q_UNUSED( criteria );
|
||||
Q_UNUSED( caller );
|
||||
Q_UNUSED( type );
|
||||
Q_UNUSED( input );
|
||||
Q_UNUSED( customData );
|
||||
}
|
||||
virtual void pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant data ) = 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 ) = 0;
|
||||
|
||||
protected:
|
||||
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 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; }
|
||||
void newNam() const;
|
||||
|
@ -89,21 +89,23 @@ InfoSystemWorker::~InfoSystemWorker()
|
||||
|
||||
|
||||
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;
|
||||
Q_FOREACH(InfoType type, types)
|
||||
m_infoMap[type].append(plugin);
|
||||
Q_FOREACH( InfoType type, getTypes )
|
||||
m_infoGetMap[type].append( plugin );
|
||||
Q_FOREACH( InfoType type, pushTypes )
|
||||
m_infoPushMap[type].append( plugin );
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
//probably need to support ordering based on the data source
|
||||
QLinkedList< InfoPluginPtr > providers;
|
||||
Q_FOREACH(InfoPluginPtr ptr, m_infoMap[type])
|
||||
Q_FOREACH( InfoPluginPtr ptr, m_infoGetMap[type] )
|
||||
providers << ptr;
|
||||
return providers;
|
||||
}
|
||||
@ -114,16 +116,16 @@ InfoSystemWorker::getInfo( QString caller, InfoType type, QVariant input, InfoCu
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
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;
|
||||
}
|
||||
|
||||
InfoPluginPtr ptr = providers.first();
|
||||
if (!ptr)
|
||||
if ( !ptr )
|
||||
{
|
||||
emit info(caller, type, QVariant(), QVariant(), customData);
|
||||
emit info( caller, type, QVariant(), QVariant(), customData );
|
||||
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*
|
||||
InfoSystemWorker::nam() const
|
||||
{
|
||||
|
@ -44,7 +44,7 @@ public:
|
||||
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;
|
||||
|
||||
signals:
|
||||
@ -52,6 +52,7 @@ signals:
|
||||
|
||||
public slots:
|
||||
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();
|
||||
|
||||
private:
|
||||
@ -60,7 +61,8 @@ private:
|
||||
// For now, statically instantiate plugins; this is just somewhere to keep them
|
||||
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;
|
||||
};
|
||||
|
@ -80,9 +80,9 @@ Scrobbler::trackStarted( const Tomahawk::result_ptr& track )
|
||||
trackInfo["artist"] = track->artist()->name();
|
||||
trackInfo["album"] = track->album()->name();
|
||||
trackInfo["duration"] = QString::number( track->duration() );
|
||||
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo(
|
||||
s_scInfoIdentifier, Tomahawk::InfoSystem::InfoMiscSubmitNowPlaying,
|
||||
QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( trackInfo ), Tomahawk::InfoSystem::InfoCustomData() );
|
||||
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo(
|
||||
s_scInfoIdentifier, Tomahawk::InfoSystem::InfoSubmitNowPlaying,
|
||||
QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( trackInfo ) );
|
||||
|
||||
m_scrobblePoint = ScrobblePoint( track->duration() / 2 );
|
||||
}
|
||||
@ -128,9 +128,9 @@ Scrobbler::scrobble()
|
||||
{
|
||||
Q_ASSERT( QThread::currentThread() == thread() );
|
||||
|
||||
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo(
|
||||
s_scInfoIdentifier, Tomahawk::InfoSystem::InfoMiscSubmitScrobble,
|
||||
QVariant(), Tomahawk::InfoSystem::InfoCustomData() );
|
||||
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo(
|
||||
s_scInfoIdentifier, Tomahawk::InfoSystem::InfoSubmitScrobble,
|
||||
QVariant() );
|
||||
}
|
||||
|
||||
|
||||
@ -141,13 +141,7 @@ Scrobbler::infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type,
|
||||
Q_UNUSED( output );
|
||||
Q_UNUSED( customData );
|
||||
if ( caller == s_scInfoIdentifier )
|
||||
{
|
||||
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";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user