mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-31 06:02:27 +02:00
Add requestId tracking to InfoSystem in preparation for timeouts
This commit is contained in:
parent
ce7040d1fd
commit
5d0c734187
@ -66,37 +66,37 @@ EchoNestPlugin::namChangedSlot( QNetworkAccessManager *nam )
|
||||
}
|
||||
|
||||
void
|
||||
EchoNestPlugin::getInfo(const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData)
|
||||
EchoNestPlugin::getInfo( uint requestId, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData )
|
||||
{
|
||||
switch (type)
|
||||
switch ( type )
|
||||
{
|
||||
case Tomahawk::InfoSystem::InfoArtistBiography:
|
||||
return getArtistBiography(caller, input, customData);
|
||||
return getArtistBiography( requestId, caller, input, customData );
|
||||
case Tomahawk::InfoSystem::InfoArtistFamiliarity:
|
||||
return getArtistFamiliarity(caller, input, customData);
|
||||
return getArtistFamiliarity( requestId, caller, input, customData );
|
||||
case Tomahawk::InfoSystem::InfoArtistHotttness:
|
||||
return getArtistHotttnesss(caller, input, customData);
|
||||
return getArtistHotttnesss( requestId, caller, input, customData );
|
||||
case Tomahawk::InfoSystem::InfoArtistTerms:
|
||||
return getArtistTerms(caller, input, customData);
|
||||
return getArtistTerms( requestId, caller, input, customData );
|
||||
case Tomahawk::InfoSystem::InfoTrackEnergy:
|
||||
return getSongProfile(caller, input, customData, "energy");
|
||||
return getSongProfile( requestId, caller, input, customData, "energy" );
|
||||
case Tomahawk::InfoSystem::InfoMiscTopTerms:
|
||||
return getMiscTopTerms(caller, input, customData);
|
||||
return getMiscTopTerms( requestId, caller, input, customData );
|
||||
default:
|
||||
{
|
||||
emit info(caller, Tomahawk::InfoSystem::InfoNoInfo, QVariant(), QVariant(), customData);
|
||||
emit info( requestId, caller, Tomahawk::InfoSystem::InfoNoInfo, QVariant(), QVariant(), customData );
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
EchoNestPlugin::getSongProfile(const QString &caller, const QVariant &input, const QVariantMap &customData, const QString &item)
|
||||
EchoNestPlugin::getSongProfile( uint requestId, const QString &caller, const QVariant &input, const QVariantMap &customData, const QString &item )
|
||||
{
|
||||
//WARNING: Totally not implemented yet
|
||||
Q_UNUSED( item );
|
||||
|
||||
if( !isValidTrackData( caller, input, customData ) )
|
||||
if( !isValidTrackData( requestId, caller, input, customData ) )
|
||||
return;
|
||||
|
||||
// Track track( input.toString() );
|
||||
@ -108,9 +108,9 @@ EchoNestPlugin::getSongProfile(const QString &caller, const QVariant &input, con
|
||||
}
|
||||
|
||||
void
|
||||
EchoNestPlugin::getArtistBiography(const QString &caller, const QVariant &input, const QVariantMap &customData)
|
||||
EchoNestPlugin::getArtistBiography( uint requestId, const QString &caller, const QVariant &input, const QVariantMap &customData )
|
||||
{
|
||||
if( !isValidArtistData( caller, input, customData ) )
|
||||
if( !isValidArtistData( requestId, caller, input, customData ) )
|
||||
return;
|
||||
|
||||
Echonest::Artist artist( input.toString() );
|
||||
@ -119,62 +119,67 @@ EchoNestPlugin::getArtistBiography(const QString &caller, const QVariant &input,
|
||||
reply->setProperty( "input", input );
|
||||
reply->setProperty( "customData", customData );
|
||||
reply->setProperty( "caller", caller );
|
||||
connect(reply, SIGNAL(finished()), SLOT(getArtistBiographySlot()));
|
||||
reply->setProperty( "requestId", requestId );
|
||||
connect( reply, SIGNAL( finished() ), SLOT( getArtistBiographySlot() ) );
|
||||
}
|
||||
|
||||
void
|
||||
EchoNestPlugin::getArtistFamiliarity(const QString &caller, const QVariant &input, const QVariantMap &customData)
|
||||
EchoNestPlugin::getArtistFamiliarity( uint requestId, const QString &caller, const QVariant &input, const QVariantMap &customData )
|
||||
{
|
||||
if( !isValidArtistData( caller, input, customData ) )
|
||||
if( !isValidArtistData( requestId, caller, input, customData ) )
|
||||
return;
|
||||
|
||||
qDebug() << "Fetching artist familiarity!" << input;
|
||||
Echonest::Artist artist( input.toString() );
|
||||
QNetworkReply* reply = artist.fetchFamiliarity();
|
||||
reply->setProperty( "artist", QVariant::fromValue<Echonest::Artist>(artist));
|
||||
reply->setProperty( "artist", QVariant::fromValue< Echonest::Artist >( artist ) );
|
||||
reply->setProperty( "input", input );
|
||||
reply->setProperty( "customData", customData );
|
||||
reply->setProperty( "caller", caller );
|
||||
connect(reply, SIGNAL(finished()), SLOT(getArtistFamiliaritySlot()));
|
||||
reply->setProperty( "requestId", requestId );
|
||||
connect( reply, SIGNAL( finished() ), SLOT( getArtistFamiliaritySlot() ) );
|
||||
}
|
||||
|
||||
void
|
||||
EchoNestPlugin::getArtistHotttnesss(const QString &caller, const QVariant &input, const QVariantMap &customData)
|
||||
EchoNestPlugin::getArtistHotttnesss( uint requestId, const QString &caller, const QVariant &input, const QVariantMap &customData )
|
||||
{
|
||||
if( !isValidArtistData( caller, input, customData ) )
|
||||
if( !isValidArtistData( requestId, caller, input, customData ) )
|
||||
return;
|
||||
|
||||
Echonest::Artist artist( input.toString() );
|
||||
QNetworkReply* reply = artist.fetchHotttnesss();
|
||||
reply->setProperty( "artist", QVariant::fromValue<Echonest::Artist>(artist));
|
||||
reply->setProperty( "artist", QVariant::fromValue< Echonest::Artist >( artist ) );
|
||||
reply->setProperty( "input", input );
|
||||
reply->setProperty( "customData", customData );
|
||||
reply->setProperty( "caller", caller );
|
||||
connect(reply, SIGNAL(finished()), SLOT(getArtistHotttnesssSlot()));
|
||||
reply->setProperty( "requestId", requestId );
|
||||
connect( reply, SIGNAL( finished() ), SLOT( getArtistHotttnesssSlot() ) );
|
||||
}
|
||||
|
||||
void
|
||||
EchoNestPlugin::getArtistTerms(const QString &caller, const QVariant &input, const QVariantMap &customData)
|
||||
EchoNestPlugin::getArtistTerms( uint requestId, const QString &caller, const QVariant &input, const QVariantMap &customData )
|
||||
{
|
||||
if( !isValidArtistData( caller, input, customData ) )
|
||||
if( !isValidArtistData( requestId, caller, input, customData ) )
|
||||
return;
|
||||
|
||||
Echonest::Artist artist( input.toString() );
|
||||
QNetworkReply* reply = artist.fetchTerms( Echonest::Artist::Weight );
|
||||
reply->setProperty( "artist", QVariant::fromValue<Echonest::Artist>(artist));
|
||||
reply->setProperty( "artist", QVariant::fromValue< Echonest::Artist >( artist ) );
|
||||
reply->setProperty( "input", input );
|
||||
reply->setProperty( "customData", customData );
|
||||
reply->setProperty( "caller", caller );
|
||||
connect(reply, SIGNAL( finished() ), SLOT( getArtistTermsSlot() ) );
|
||||
reply->setProperty( "requestId", requestId );
|
||||
connect( reply, SIGNAL( finished() ), SLOT( getArtistTermsSlot() ) );
|
||||
}
|
||||
|
||||
void
|
||||
EchoNestPlugin::getMiscTopTerms(const QString &caller, const QVariant &input, const QVariantMap& customData)
|
||||
EchoNestPlugin::getMiscTopTerms( uint requestId, const QString &caller, const QVariant &input, const QVariantMap& customData )
|
||||
{
|
||||
Q_UNUSED( input );
|
||||
QNetworkReply* reply = Echonest::Artist::topTerms( 20 );
|
||||
reply->setProperty( "customData", customData );
|
||||
reply->setProperty( "caller", caller );
|
||||
reply->setProperty( "requestId", requestId );
|
||||
connect( reply, SIGNAL( finished() ), SLOT( getMiscTopSlot() ) );
|
||||
}
|
||||
|
||||
@ -196,7 +201,8 @@ EchoNestPlugin::getArtistBiographySlot()
|
||||
biographyMap[biography.site()]["attribution"] = biography.license().url.toString();
|
||||
|
||||
}
|
||||
emit info( reply->property( "caller" ).toString(),
|
||||
emit info( reply->property( "requestId" ).toUInt(),
|
||||
reply->property( "caller" ).toString(),
|
||||
Tomahawk::InfoSystem::InfoArtistBiography,
|
||||
reply->property( "input" ),
|
||||
QVariant::fromValue< Tomahawk::InfoSystem::InfoGenericMap >( biographyMap ),
|
||||
@ -210,7 +216,8 @@ EchoNestPlugin::getArtistFamiliaritySlot()
|
||||
QNetworkReply* reply = qobject_cast<QNetworkReply*>( sender() );
|
||||
Echonest::Artist artist = artistFromReply( reply );
|
||||
qreal familiarity = artist.familiarity();
|
||||
emit info( reply->property( "caller" ).toString(),
|
||||
emit info( reply->property( "requestId" ).toUInt(),
|
||||
reply->property( "caller" ).toString(),
|
||||
Tomahawk::InfoSystem::InfoArtistFamiliarity,
|
||||
reply->property( "input" ),
|
||||
familiarity,
|
||||
@ -224,7 +231,8 @@ EchoNestPlugin::getArtistHotttnesssSlot()
|
||||
QNetworkReply* reply = qobject_cast<QNetworkReply*>( sender() );
|
||||
Echonest::Artist artist = artistFromReply( reply );
|
||||
qreal hotttnesss = artist.hotttnesss();
|
||||
emit info( reply->property( "caller" ).toString(),
|
||||
emit info( reply->property( "requestId" ).toUInt(),
|
||||
reply->property( "caller" ).toString(),
|
||||
Tomahawk::InfoSystem::InfoArtistHotttness,
|
||||
reply->property( "input" ),
|
||||
hotttnesss,
|
||||
@ -245,7 +253,8 @@ EchoNestPlugin::getArtistTermsSlot()
|
||||
termMap[ "frequency" ] = QString::number(term.frequency());
|
||||
termsMap[ term.name() ] = termMap;
|
||||
}
|
||||
emit info( reply->property( "caller" ).toString(),
|
||||
emit info( reply->property( "requestId" ).toUInt(),
|
||||
reply->property( "caller" ).toString(),
|
||||
Tomahawk::InfoSystem::InfoArtistTerms,
|
||||
reply->property( "input" ),
|
||||
QVariant::fromValue< Tomahawk::InfoSystem::InfoGenericMap >( termsMap ),
|
||||
@ -265,7 +274,8 @@ EchoNestPlugin::getMiscTopSlot()
|
||||
termMap[ "frequency" ] = QString::number( term.frequency() );
|
||||
termsMap[ term.name().toLower() ] = termMap;
|
||||
}
|
||||
emit info( reply->property( "caller" ).toString(),
|
||||
emit info( reply->property( "requestId" ).toUInt(),
|
||||
reply->property( "caller" ).toString(),
|
||||
Tomahawk::InfoSystem::InfoMiscTopTerms,
|
||||
QVariant(),
|
||||
QVariant::fromValue< Tomahawk::InfoSystem::InfoGenericMap >( termsMap ),
|
||||
@ -274,50 +284,53 @@ EchoNestPlugin::getMiscTopSlot()
|
||||
}
|
||||
|
||||
bool
|
||||
EchoNestPlugin::isValidArtistData(const QString &caller, const QVariant &input, const QVariantMap &customData)
|
||||
EchoNestPlugin::isValidArtistData( uint requestId, const QString &caller, const QVariant &input, const QVariantMap &customData )
|
||||
{
|
||||
if (input.isNull() || !input.isValid() || !input.canConvert<QString>())
|
||||
if ( input.isNull() || !input.isValid() || !input.canConvert< QString >() )
|
||||
{
|
||||
emit info(caller, Tomahawk::InfoSystem::InfoNoInfo, QVariant(), QVariant(), customData);
|
||||
emit info( requestId, caller, Tomahawk::InfoSystem::InfoNoInfo, QVariant(), QVariant(), customData );
|
||||
return false;
|
||||
}
|
||||
QString artistName = input.toString();
|
||||
if (artistName.isEmpty() )
|
||||
if ( artistName.isEmpty() )
|
||||
{
|
||||
emit info(caller, Tomahawk::InfoSystem::InfoNoInfo, QVariant(), QVariant(), customData);
|
||||
emit info( requestId, caller, Tomahawk::InfoSystem::InfoNoInfo, QVariant(), QVariant(), customData );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
EchoNestPlugin::isValidTrackData(const QString &caller, const QVariant &input, const QVariantMap &customData)
|
||||
EchoNestPlugin::isValidTrackData( uint requestId, const QString &caller, const QVariant &input, const QVariantMap &customData )
|
||||
{
|
||||
if (input.isNull() || !input.isValid() || !input.canConvert<QString>())
|
||||
if ( input.isNull() || !input.isValid() || !input.canConvert< QString >() )
|
||||
{
|
||||
emit info(caller, Tomahawk::InfoSystem::InfoNoInfo, QVariant(), QVariant(), customData);
|
||||
emit info( requestId, caller, Tomahawk::InfoSystem::InfoNoInfo, QVariant(), QVariant(), customData );
|
||||
return false;
|
||||
}
|
||||
QString trackName = input.toString();
|
||||
if (trackName.isEmpty() )
|
||||
if ( trackName.isEmpty() )
|
||||
{
|
||||
emit info(caller, Tomahawk::InfoSystem::InfoNoInfo, QVariant(), QVariant(), customData);
|
||||
emit info( requestId, caller, Tomahawk::InfoSystem::InfoNoInfo, QVariant(), QVariant(), customData );
|
||||
return false;
|
||||
}
|
||||
if (!customData.contains("artistName") ||
|
||||
customData["artistName"].toString().isEmpty())
|
||||
if ( !customData.contains( "artistName" ) || customData[ "artistName" ].toString().isEmpty() )
|
||||
{
|
||||
emit info( requestId, caller, Tomahawk::InfoSystem::InfoNoInfo, QVariant(), QVariant(), customData );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Artist
|
||||
EchoNestPlugin::artistFromReply(QNetworkReply* reply)
|
||||
EchoNestPlugin::artistFromReply( QNetworkReply* reply )
|
||||
{
|
||||
Echonest::Artist artist = reply->property("artist").value<Echonest::Artist>();
|
||||
try {
|
||||
artist.parseProfile(reply);
|
||||
artist.parseProfile( reply );
|
||||
} catch( const Echonest::ParseError& e ) {
|
||||
qWarning() << "Caught parser error from echonest!" << e.what();
|
||||
}
|
||||
return artist;
|
||||
}
|
||||
//
|
@ -44,7 +44,7 @@ public:
|
||||
virtual ~EchoNestPlugin();
|
||||
|
||||
protected slots:
|
||||
virtual void getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData );
|
||||
virtual void getInfo( uint requestId, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData );
|
||||
|
||||
virtual void pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant data )
|
||||
{
|
||||
@ -53,8 +53,9 @@ protected slots:
|
||||
Q_UNUSED( data );
|
||||
}
|
||||
|
||||
virtual void notInCacheSlot( const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData )
|
||||
virtual void notInCacheSlot( uint requestId, const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData )
|
||||
{
|
||||
Q_UNUSED( requestId );
|
||||
Q_UNUSED( criteria );
|
||||
Q_UNUSED( caller );
|
||||
Q_UNUSED( type );
|
||||
@ -66,15 +67,15 @@ public slots:
|
||||
void namChangedSlot( QNetworkAccessManager *nam );
|
||||
|
||||
private:
|
||||
void getSongProfile( const QString &caller, const QVariant &input, const QVariantMap &customData, const QString &item = QString() );
|
||||
void getArtistBiography ( const QString &caller, const QVariant &input, const QVariantMap &customData );
|
||||
void getArtistFamiliarity( const QString &caller, const QVariant &input, const QVariantMap &customData );
|
||||
void getArtistHotttnesss( const QString &caller, const QVariant &input, const QVariantMap &customData );
|
||||
void getArtistTerms( const QString &caller, const QVariant &input, const QVariantMap &customData );
|
||||
void getMiscTopTerms( const QString &caller, const QVariant &input, const QVariantMap &customData );
|
||||
void getSongProfile( uint requestId, const QString &caller, const QVariant &input, const QVariantMap &customData, const QString &item = QString() );
|
||||
void getArtistBiography ( uint requestId, const QString &caller, const QVariant &input, const QVariantMap &customData );
|
||||
void getArtistFamiliarity( uint requestId, const QString &caller, const QVariant &input, const QVariantMap &customData );
|
||||
void getArtistHotttnesss( uint requestId, const QString &caller, const QVariant &input, const QVariantMap &customData );
|
||||
void getArtistTerms( uint requestId, const QString &caller, const QVariant &input, const QVariantMap &customData );
|
||||
void getMiscTopTerms( uint requestId, const QString &caller, const QVariant &input, const QVariantMap &customData );
|
||||
|
||||
bool isValidArtistData( const QString &caller, const QVariant &input, const QVariantMap& customData );
|
||||
bool isValidTrackData( const QString &caller, const QVariant &input, const QVariantMap& customData );
|
||||
bool isValidArtistData( uint requestId, const QString &caller, const QVariant &input, const QVariantMap& customData );
|
||||
bool isValidTrackData( uint requestId, const QString &caller, const QVariant &input, const QVariantMap& customData );
|
||||
Echonest::Artist artistFromReply( QNetworkReply* );
|
||||
|
||||
private slots:
|
||||
|
@ -120,38 +120,38 @@ LastFmPlugin::namChangedSlot( QNetworkAccessManager *nam )
|
||||
|
||||
|
||||
void
|
||||
LastFmPlugin::dataError( const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input, const QVariantMap &customData )
|
||||
LastFmPlugin::dataError( uint requestId, const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input, const QVariantMap &customData )
|
||||
{
|
||||
emit info( caller, type, input, QVariant(), customData );
|
||||
emit info( requestId, caller, type, input, QVariant(), customData );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LastFmPlugin::getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData )
|
||||
LastFmPlugin::getInfo( uint requestId, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
switch ( type )
|
||||
{
|
||||
case InfoArtistImages:
|
||||
fetchArtistImages( caller, type, input, customData );
|
||||
fetchArtistImages( requestId, caller, type, input, customData );
|
||||
break;
|
||||
|
||||
case InfoAlbumCoverArt:
|
||||
fetchCoverArt( caller, type, input, customData );
|
||||
fetchCoverArt( requestId, caller, type, input, customData );
|
||||
break;
|
||||
|
||||
case InfoArtistSimilars:
|
||||
fetchSimilarArtists( caller, type, input, customData );
|
||||
fetchSimilarArtists( requestId, caller, type, input, customData );
|
||||
break;
|
||||
|
||||
case InfoArtistSongs:
|
||||
fetchTopTracks( caller, type, input, customData );
|
||||
fetchTopTracks( requestId, caller, type, input, customData );
|
||||
break;
|
||||
|
||||
default:
|
||||
dataError( caller, type, input, customData );
|
||||
dataError( requestId, caller, type, input, customData );
|
||||
}
|
||||
}
|
||||
|
||||
@ -263,64 +263,64 @@ LastFmPlugin::sendLoveSong( const InfoType type, QVariant input )
|
||||
|
||||
|
||||
void
|
||||
LastFmPlugin::fetchSimilarArtists( const QString &caller, const InfoType type, const QVariant &input, const QVariantMap &customData )
|
||||
LastFmPlugin::fetchSimilarArtists( uint requestId, const QString &caller, const InfoType type, const QVariant &input, const QVariantMap &customData )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
if ( !input.canConvert< Tomahawk::InfoSystem::InfoCriteriaHash >() )
|
||||
{
|
||||
dataError( caller, type, input, customData );
|
||||
dataError( requestId, caller, type, input, customData );
|
||||
return;
|
||||
}
|
||||
InfoCriteriaHash hash = input.value< Tomahawk::InfoSystem::InfoCriteriaHash >();
|
||||
if ( !hash.contains( "artist" ) )
|
||||
{
|
||||
dataError( caller, type, input, customData );
|
||||
dataError( requestId, caller, type, input, customData );
|
||||
return;
|
||||
}
|
||||
|
||||
Tomahawk::InfoSystem::InfoCriteriaHash criteria;
|
||||
criteria["artist"] = hash["artist"];
|
||||
|
||||
emit getCachedInfo( criteria, 2419200000, caller, type, input, customData );
|
||||
emit getCachedInfo( requestId, criteria, 2419200000, caller, type, input, customData );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LastFmPlugin::fetchTopTracks( const QString &caller, const InfoType type, const QVariant &input, const QVariantMap &customData )
|
||||
LastFmPlugin::fetchTopTracks( uint requestId, const QString &caller, const InfoType type, const QVariant &input, const QVariantMap &customData )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
if ( !input.canConvert< Tomahawk::InfoSystem::InfoCriteriaHash >() )
|
||||
{
|
||||
dataError( caller, type, input, customData );
|
||||
dataError( requestId, caller, type, input, customData );
|
||||
return;
|
||||
}
|
||||
InfoCriteriaHash hash = input.value< Tomahawk::InfoSystem::InfoCriteriaHash >();
|
||||
if ( !hash.contains( "artist" ) )
|
||||
{
|
||||
dataError( caller, type, input, customData );
|
||||
dataError( requestId, caller, type, input, customData );
|
||||
return;
|
||||
}
|
||||
|
||||
Tomahawk::InfoSystem::InfoCriteriaHash criteria;
|
||||
criteria["artist"] = hash["artist"];
|
||||
|
||||
emit getCachedInfo( criteria, 2419200000, caller, type, input, customData );
|
||||
emit getCachedInfo( requestId, criteria, 2419200000, caller, type, input, customData );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LastFmPlugin::fetchCoverArt( const QString &caller, const InfoType type, const QVariant &input, const QVariantMap &customData )
|
||||
LastFmPlugin::fetchCoverArt( uint requestId, const QString &caller, const InfoType type, const QVariant &input, const QVariantMap &customData )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
if ( !input.canConvert< Tomahawk::InfoSystem::InfoCriteriaHash >() )
|
||||
{
|
||||
dataError( caller, type, input, customData );
|
||||
dataError( requestId, caller, type, input, customData );
|
||||
return;
|
||||
}
|
||||
InfoCriteriaHash hash = input.value< Tomahawk::InfoSystem::InfoCriteriaHash >();
|
||||
if ( !hash.contains( "artist" ) || !hash.contains( "album" ) )
|
||||
{
|
||||
dataError( caller, type, input, customData );
|
||||
dataError( requestId, caller, type, input, customData );
|
||||
return;
|
||||
}
|
||||
|
||||
@ -328,42 +328,42 @@ LastFmPlugin::fetchCoverArt( const QString &caller, const InfoType type, const Q
|
||||
criteria["artist"] = hash["artist"];
|
||||
criteria["album"] = hash["album"];
|
||||
|
||||
emit getCachedInfo( criteria, 2419200000, caller, type, input, customData );
|
||||
emit getCachedInfo( requestId, criteria, 2419200000, caller, type, input, customData );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LastFmPlugin::fetchArtistImages( const QString &caller, const InfoType type, const QVariant &input, const QVariantMap &customData )
|
||||
LastFmPlugin::fetchArtistImages( uint requestId, const QString &caller, const InfoType type, const QVariant &input, const QVariantMap &customData )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
if ( !input.canConvert< Tomahawk::InfoSystem::InfoCriteriaHash >() )
|
||||
{
|
||||
dataError( caller, type, input, customData );
|
||||
dataError( requestId, caller, type, input, customData );
|
||||
return;
|
||||
}
|
||||
InfoCriteriaHash hash = input.value< Tomahawk::InfoSystem::InfoCriteriaHash >();
|
||||
if ( !hash.contains( "artist" ) )
|
||||
{
|
||||
dataError( caller, type, input, customData );
|
||||
dataError( requestId, caller, type, input, customData );
|
||||
return;
|
||||
}
|
||||
|
||||
Tomahawk::InfoSystem::InfoCriteriaHash criteria;
|
||||
criteria["artist"] = hash["artist"];
|
||||
|
||||
emit getCachedInfo( criteria, 2419200000, caller, type, input, customData );
|
||||
emit getCachedInfo( requestId, criteria, 2419200000, caller, type, input, customData );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LastFmPlugin::notInCacheSlot( const QHash<QString, QString> criteria, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData )
|
||||
LastFmPlugin::notInCacheSlot( uint requestId, const QHash<QString, QString> criteria, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
if ( !lastfm::nam() )
|
||||
{
|
||||
qDebug() << "Have a null QNAM, uh oh";
|
||||
emit info( caller, type, input, QVariant(), customData );
|
||||
emit info( requestId, caller, type, input, QVariant(), customData );
|
||||
return;
|
||||
}
|
||||
|
||||
@ -376,7 +376,8 @@ LastFmPlugin::notInCacheSlot( const QHash<QString, QString> criteria, const QStr
|
||||
reply->setProperty( "customData", QVariant::fromValue<QVariantMap>( customData ) );
|
||||
reply->setProperty( "origData", input );
|
||||
reply->setProperty( "caller", caller );
|
||||
reply->setProperty( "type", (uint)(type) );
|
||||
reply->setProperty( "type", (uint)( type ) );
|
||||
reply->setProperty( "requestId", requestId );
|
||||
|
||||
connect( reply, SIGNAL( finished() ), SLOT( similarArtistsReturned() ) );
|
||||
return;
|
||||
@ -389,7 +390,8 @@ LastFmPlugin::notInCacheSlot( const QHash<QString, QString> criteria, const QStr
|
||||
reply->setProperty( "customData", QVariant::fromValue<QVariantMap>( customData ) );
|
||||
reply->setProperty( "origData", input );
|
||||
reply->setProperty( "caller", caller );
|
||||
reply->setProperty( "type", (uint)(type) );
|
||||
reply->setProperty( "type", (uint)( type ) );
|
||||
reply->setProperty( "requestId", requestId );
|
||||
|
||||
connect( reply, SIGNAL( finished() ), SLOT( topTracksReturned() ) );
|
||||
return;
|
||||
@ -406,7 +408,8 @@ LastFmPlugin::notInCacheSlot( const QHash<QString, QString> criteria, const QStr
|
||||
reply->setProperty( "customData", QVariant::fromValue<QVariantMap>( customData ) );
|
||||
reply->setProperty( "origData", input );
|
||||
reply->setProperty( "caller", caller );
|
||||
reply->setProperty( "type", (uint)(type) );
|
||||
reply->setProperty( "type", (uint)( type ) );
|
||||
reply->setProperty( "requestId", requestId );
|
||||
|
||||
connect( reply, SIGNAL( finished() ), SLOT( coverArtReturned() ) );
|
||||
return;
|
||||
@ -422,7 +425,8 @@ LastFmPlugin::notInCacheSlot( const QHash<QString, QString> criteria, const QStr
|
||||
reply->setProperty( "customData", QVariant::fromValue<QVariantMap>( customData ) );
|
||||
reply->setProperty( "origData", input );
|
||||
reply->setProperty( "caller", caller );
|
||||
reply->setProperty( "type", (uint)(type) );
|
||||
reply->setProperty( "type", (uint)( type ) );
|
||||
reply->setProperty( "requestId", requestId );
|
||||
|
||||
connect( reply, SIGNAL( finished() ), SLOT( artistImagesReturned() ) );
|
||||
return;
|
||||
@ -431,7 +435,7 @@ LastFmPlugin::notInCacheSlot( const QHash<QString, QString> criteria, const QStr
|
||||
default:
|
||||
{
|
||||
qDebug() << "Couldn't figure out what to do with this type of request after cache miss";
|
||||
emit info( caller, type, input, QVariant(), customData );
|
||||
emit info( requestId, caller, type, input, QVariant(), customData );
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -461,6 +465,7 @@ LastFmPlugin::similarArtistsReturned()
|
||||
QVariantMap customData = reply->property( "customData" ).value< QVariantMap >();
|
||||
InfoType type = (Tomahawk::InfoSystem::InfoType)(reply->property( "type" ).toUInt());
|
||||
emit info(
|
||||
reply->property( "requestId" ).toUInt(),
|
||||
reply->property( "caller" ).toString(),
|
||||
type,
|
||||
reply->property( "origData" ),
|
||||
@ -493,6 +498,7 @@ LastFmPlugin::topTracksReturned()
|
||||
QVariantMap customData = reply->property( "customData" ).value< QVariantMap >();
|
||||
InfoType type = (Tomahawk::InfoSystem::InfoType)(reply->property( "type" ).toUInt());
|
||||
emit info(
|
||||
reply->property( "requestId" ).toUInt(),
|
||||
reply->property( "caller" ).toString(),
|
||||
type,
|
||||
reply->property( "origData" ),
|
||||
@ -521,7 +527,7 @@ LastFmPlugin::coverArtReturned()
|
||||
qDebug() << "Uh oh, null byte array";
|
||||
InfoType type = (Tomahawk::InfoSystem::InfoType)(reply->property( "type" ).toUInt());
|
||||
QVariantMap customData = reply->property( "customData" ).value< QVariantMap >();
|
||||
emit info( reply->property( "caller" ).toString(), type, reply->property( "origData" ), QVariant(), customData );
|
||||
emit info( reply->property( "requestId" ).toUInt(), reply->property( "caller" ).toString(), type, reply->property( "origData" ), QVariant(), customData );
|
||||
return;
|
||||
}
|
||||
foreach ( const QUrl& url, m_badUrls )
|
||||
@ -537,6 +543,7 @@ LastFmPlugin::coverArtReturned()
|
||||
QVariantMap customData = reply->property( "customData" ).value< QVariantMap >();
|
||||
InfoType type = (Tomahawk::InfoSystem::InfoType)(reply->property( "type" ).toUInt());
|
||||
emit info(
|
||||
reply->property( "requestId" ).toUInt(),
|
||||
reply->property( "caller" ).toString(),
|
||||
type,
|
||||
reply->property( "origData" ),
|
||||
@ -557,7 +564,7 @@ LastFmPlugin::coverArtReturned()
|
||||
qDebug() << "Uh oh, nam is null";
|
||||
InfoType type = (Tomahawk::InfoSystem::InfoType)(reply->property( "type" ).toUInt());
|
||||
QVariantMap customData = reply->property( "customData" ).value< QVariantMap >();
|
||||
emit info( reply->property( "caller" ).toString(), type, reply->property( "origData" ), QVariant(), customData );
|
||||
emit info( reply->property( "requestId" ).toUInt(), reply->property( "caller" ).toString(), type, reply->property( "origData" ), QVariant(), customData );
|
||||
return;
|
||||
}
|
||||
// Follow HTTP redirect
|
||||
@ -567,6 +574,7 @@ LastFmPlugin::coverArtReturned()
|
||||
newReply->setProperty( "customData", reply->property( "customData" ) );
|
||||
newReply->setProperty( "caller", reply->property( "caller" ) );
|
||||
newReply->setProperty( "type", reply->property( "type" ) );
|
||||
newReply->setProperty( "requestId", reply->property( "requestId" ) );
|
||||
connect( newReply, SIGNAL( finished() ), SLOT( coverArtReturned() ) );
|
||||
}
|
||||
|
||||
@ -588,7 +596,7 @@ LastFmPlugin::artistImagesReturned()
|
||||
qDebug() << "Uh oh, null byte array";
|
||||
InfoType type = (Tomahawk::InfoSystem::InfoType)(reply->property( "type" ).toUInt());
|
||||
QVariantMap customData = reply->property( "customData" ).value< QVariantMap >();
|
||||
emit info( reply->property( "caller" ).toString(), type, reply->property( "origData" ), QVariant(), customData );
|
||||
emit info( reply->property( "requestId" ).toUInt(), reply->property( "caller" ).toString(), type, reply->property( "origData" ), QVariant(), customData );
|
||||
return;
|
||||
}
|
||||
foreach ( const QUrl& url, m_badUrls )
|
||||
@ -602,7 +610,7 @@ LastFmPlugin::artistImagesReturned()
|
||||
|
||||
InfoType type = (Tomahawk::InfoSystem::InfoType)(reply->property( "type" ).toUInt());
|
||||
QVariantMap customData = reply->property( "customData" ).value< QVariantMap >();
|
||||
emit info( reply->property( "caller" ).toString(), type, reply->property( "origData" ), returnedData, customData );
|
||||
emit info( reply->property( "requestId" ).toUInt(), reply->property( "caller" ).toString(), type, reply->property( "origData" ), returnedData, customData );
|
||||
|
||||
InfoCriteriaHash origData = reply->property( "origData" ).value< Tomahawk::InfoSystem::InfoCriteriaHash >();
|
||||
Tomahawk::InfoSystem::InfoCriteriaHash criteria;
|
||||
@ -616,7 +624,7 @@ LastFmPlugin::artistImagesReturned()
|
||||
qDebug() << "Uh oh, nam is null";
|
||||
InfoType type = (Tomahawk::InfoSystem::InfoType)(reply->property( "type" ).toUInt());
|
||||
QVariantMap customData = reply->property( "customData" ).value< QVariantMap >();
|
||||
emit info( reply->property( "caller" ).toString(), type, reply->property( "origData" ), QVariant(), customData );
|
||||
emit info( reply->property( "requestId" ).toUInt(), reply->property( "caller" ).toString(), type, reply->property( "origData" ), QVariant(), customData );
|
||||
return;
|
||||
}
|
||||
// Follow HTTP redirect
|
||||
@ -626,6 +634,7 @@ LastFmPlugin::artistImagesReturned()
|
||||
newReply->setProperty( "customData", reply->property( "customData" ) );
|
||||
newReply->setProperty( "caller", reply->property( "caller" ) );
|
||||
newReply->setProperty( "type", reply->property( "type" ) );
|
||||
newReply->setProperty( "requestId", reply->property( "requestId" ) );
|
||||
connect( newReply, SIGNAL( finished() ), SLOT( artistImagesReturned() ) );
|
||||
}
|
||||
|
||||
|
@ -55,23 +55,23 @@ public slots:
|
||||
void namChangedSlot( QNetworkAccessManager *nam );
|
||||
|
||||
protected slots:
|
||||
virtual void getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData );
|
||||
virtual void notInCacheSlot( const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData );
|
||||
virtual void getInfo( uint requestId, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData );
|
||||
virtual void notInCacheSlot( uint requestId, const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap 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 QVariantMap &customData );
|
||||
void fetchArtistImages( const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input, const QVariantMap &customData );
|
||||
void fetchSimilarArtists( const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input, const QVariantMap &customData );
|
||||
void fetchTopTracks( const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input, const QVariantMap &customData );
|
||||
void fetchCoverArt( uint requestId, const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input, const QVariantMap &customData );
|
||||
void fetchArtistImages( uint requestId, const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input, const QVariantMap &customData );
|
||||
void fetchSimilarArtists( uint requestId, const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input, const QVariantMap &customData );
|
||||
void fetchTopTracks( uint requestId, const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input, const QVariantMap &customData );
|
||||
|
||||
void createScrobbler();
|
||||
void nowPlaying( const QVariant &input );
|
||||
void scrobble();
|
||||
void sendLoveSong( const InfoType type, QVariant input );
|
||||
|
||||
void dataError( const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input, const QVariantMap &customData );
|
||||
void dataError( uint requestId, const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input, const QVariantMap &customData );
|
||||
|
||||
lastfm::MutableTrack m_track;
|
||||
lastfm::Audioscrobbler* m_scrobbler;
|
||||
|
@ -51,53 +51,54 @@ MusixMatchPlugin::namChangedSlot( QNetworkAccessManager *nam )
|
||||
}
|
||||
|
||||
void
|
||||
MusixMatchPlugin::getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData )
|
||||
MusixMatchPlugin::getInfo( uint requestId, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
if( !isValidTrackData(caller, input, customData) || !input.canConvert<QVariantMap>() || m_nam.isNull() || type != Tomahawk::InfoSystem::InfoTrackLyrics )
|
||||
if( !isValidTrackData( requestId, caller, input, customData ) || !input.canConvert< QVariantMap >() || m_nam.isNull() || type != Tomahawk::InfoSystem::InfoTrackLyrics )
|
||||
return;
|
||||
QVariantMap hash = input.value<QVariantMap>();
|
||||
QVariantMap hash = input.value< QVariantMap >();
|
||||
QString artist = hash["artistName"].toString();
|
||||
QString track = hash["trackName"].toString();
|
||||
if( artist.isEmpty() || track.isEmpty() )
|
||||
{
|
||||
emit info(caller, Tomahawk::InfoSystem::InfoTrackLyrics, input, QVariant(), customData);
|
||||
emit info( requestId, caller, Tomahawk::InfoSystem::InfoTrackLyrics, input, QVariant(), customData );
|
||||
return;
|
||||
}
|
||||
qDebug() << "artist is " << artist << ", track is " << track;
|
||||
QString requestString("http://api.musixmatch.com/ws/1.1/track.search?format=xml&page_size=1&f_has_lyrics=1");
|
||||
QUrl url(requestString);
|
||||
url.addQueryItem("apikey", m_apiKey);
|
||||
url.addQueryItem("q_artist", artist);
|
||||
url.addQueryItem("q_track", track);
|
||||
QNetworkReply* reply = m_nam.data()->get(QNetworkRequest(url));
|
||||
reply->setProperty("customData", QVariant::fromValue<QVariantMap>(customData));
|
||||
reply->setProperty("origData", input);
|
||||
reply->setProperty("caller", caller);
|
||||
QString requestString( "http://api.musixmatch.com/ws/1.1/track.search?format=xml&page_size=1&f_has_lyrics=1" );
|
||||
QUrl url( requestString );
|
||||
url.addQueryItem( "apikey", m_apiKey );
|
||||
url.addQueryItem( "q_artist", artist );
|
||||
url.addQueryItem( "q_track", track );
|
||||
QNetworkReply* reply = m_nam.data()->get( QNetworkRequest( url ) );
|
||||
reply->setProperty( "customData", QVariant::fromValue< QVariantMap >( customData ) );
|
||||
reply->setProperty( "origData", input );
|
||||
reply->setProperty( "caller", caller );
|
||||
reply->setProperty( "requestId", requestId );
|
||||
|
||||
connect(reply, SIGNAL(finished()), SLOT(trackSearchSlot()));
|
||||
connect( reply, SIGNAL( finished() ), SLOT( trackSearchSlot() ) );
|
||||
}
|
||||
|
||||
bool
|
||||
MusixMatchPlugin::isValidTrackData( const QString &caller, const QVariant &input, const QVariantMap &customData )
|
||||
MusixMatchPlugin::isValidTrackData( uint requestId, const QString &caller, const QVariant &input, const QVariantMap &customData )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
if (input.isNull() || !input.isValid() || !input.canConvert<QVariantMap>())
|
||||
if ( input.isNull() || !input.isValid() || !input.canConvert< QVariantMap >() )
|
||||
{
|
||||
emit info(caller, Tomahawk::InfoSystem::InfoTrackLyrics, input, QVariant(), customData);
|
||||
emit info( requestId, caller, Tomahawk::InfoSystem::InfoTrackLyrics, input, QVariant(), customData );
|
||||
qDebug() << "MusixMatchPlugin::isValidTrackData: Data null, invalid, or can't convert";
|
||||
return false;
|
||||
}
|
||||
QVariantMap hash = input.value<QVariantMap>();
|
||||
if (hash["trackName"].toString().isEmpty() )
|
||||
QVariantMap hash = input.value< QVariantMap >();
|
||||
if ( hash["trackName"].toString().isEmpty() )
|
||||
{
|
||||
emit info(caller, Tomahawk::InfoSystem::InfoTrackLyrics, input, QVariant(), customData);
|
||||
emit info( requestId, caller, Tomahawk::InfoSystem::InfoTrackLyrics, input, QVariant(), customData );
|
||||
qDebug() << "MusixMatchPlugin::isValidTrackData: Track name is empty";
|
||||
return false;
|
||||
}
|
||||
if (hash["artistName"].toString().isEmpty() )
|
||||
if ( hash["artistName"].toString().isEmpty() )
|
||||
{
|
||||
emit info(caller, Tomahawk::InfoSystem::InfoTrackLyrics, input, QVariant(), customData);
|
||||
emit info( requestId, caller, Tomahawk::InfoSystem::InfoTrackLyrics, input, QVariant(), customData );
|
||||
qDebug() << "MusixMatchPlugin::isValidTrackData: No artist name found";
|
||||
return false;
|
||||
}
|
||||
@ -109,9 +110,9 @@ MusixMatchPlugin::trackSearchSlot()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
QNetworkReply* oldReply = qobject_cast<QNetworkReply*>( sender() );
|
||||
if ( !oldReply || m_nam.isNull() )
|
||||
if ( !oldReply )
|
||||
{
|
||||
emit info(QString(), Tomahawk::InfoSystem::InfoTrackLyrics, QVariant(), QVariant(), QVariantMap());
|
||||
emit info( 0, QString(), Tomahawk::InfoSystem::InfoTrackLyrics, QVariant(), QVariant(), QVariantMap() );
|
||||
return;
|
||||
}
|
||||
QDomDocument doc;
|
||||
@ -120,40 +121,41 @@ MusixMatchPlugin::trackSearchSlot()
|
||||
QDomNodeList domNodeList = doc.elementsByTagName("track_id");
|
||||
if (domNodeList.isEmpty())
|
||||
{
|
||||
emit info(oldReply->property("caller").toString(), Tomahawk::InfoSystem::InfoTrackLyrics, oldReply->property("origData"), QVariant(), oldReply->property("customData").value<QVariantMap>());
|
||||
emit info( oldReply->property( "requestId" ).toUInt(), oldReply->property( "caller" ).toString(), Tomahawk::InfoSystem::InfoTrackLyrics, oldReply->property( "origData" ), QVariant(), oldReply->property( "customData" ).value< QVariantMap >() );
|
||||
return;
|
||||
}
|
||||
QString track_id = domNodeList.at(0).toElement().text();
|
||||
QString requestString("http://api.musixmatch.com/ws/1.1/track.lyrics.get?track_id=%1&format=xml&apikey=%2");
|
||||
QUrl url(requestString);
|
||||
url.addQueryItem("apikey", m_apiKey);
|
||||
url.addQueryItem("track_id", track_id);
|
||||
QNetworkReply* newReply = m_nam.data()->get(QNetworkRequest(url));
|
||||
newReply->setProperty("origData", oldReply->property("origData"));
|
||||
newReply->setProperty("customData", oldReply->property("customData"));
|
||||
newReply->setProperty("caller", oldReply->property("caller"));
|
||||
connect(newReply, SIGNAL(finished()), SLOT(trackLyricsSlot()));
|
||||
QString requestString( "http://api.musixmatch.com/ws/1.1/track.lyrics.get?track_id=%1&format=xml&apikey=%2" );
|
||||
QUrl url( requestString );
|
||||
url.addQueryItem( "apikey", m_apiKey );
|
||||
url.addQueryItem( "track_id", track_id );
|
||||
QNetworkReply* newReply = m_nam.data()->get( QNetworkRequest( url ) );
|
||||
newReply->setProperty( "origData", oldReply->property( "origData" ) );
|
||||
newReply->setProperty( "customData", oldReply->property( "customData" ) );
|
||||
newReply->setProperty( "caller", oldReply->property( "caller" ) );
|
||||
newReply->setProperty( "requestId", oldReply->property( "requestId" ) );
|
||||
connect( newReply, SIGNAL( finished() ), SLOT( trackLyricsSlot() ) );
|
||||
}
|
||||
|
||||
void
|
||||
MusixMatchPlugin::trackLyricsSlot()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
QNetworkReply* reply = qobject_cast<QNetworkReply*>( sender() );
|
||||
if (!reply)
|
||||
QNetworkReply* reply = qobject_cast< QNetworkReply* >( sender() );
|
||||
if ( !reply )
|
||||
{
|
||||
emit info(QString(), Tomahawk::InfoSystem::InfoTrackLyrics, QVariant(), QVariant(), QVariantMap());
|
||||
emit info( 0, QString(), Tomahawk::InfoSystem::InfoTrackLyrics, QVariant(), QVariant(), QVariantMap() );
|
||||
return;
|
||||
}
|
||||
QDomDocument doc;
|
||||
doc.setContent(reply->readAll());
|
||||
QDomNodeList domNodeList = doc.elementsByTagName("lyrics_body");
|
||||
if (domNodeList.isEmpty())
|
||||
doc.setContent( reply->readAll() );
|
||||
QDomNodeList domNodeList = doc.elementsByTagName( "lyrics_body" );
|
||||
if ( domNodeList.isEmpty() )
|
||||
{
|
||||
emit info(reply->property("caller").toString(), Tomahawk::InfoSystem::InfoTrackLyrics, reply->property("origData"), QVariant(), reply->property("customData").value<QVariantMap>());
|
||||
emit info( reply->property( "requestId" ).toUInt(), reply->property( "caller" ).toString(), Tomahawk::InfoSystem::InfoTrackLyrics, reply->property( "origData" ), QVariant(), reply->property( "customData" ).value< QVariantMap >() );
|
||||
return;
|
||||
}
|
||||
QString lyrics = domNodeList.at(0).toElement().text();
|
||||
qDebug() << "Emitting lyrics: " << lyrics;
|
||||
emit info(reply->property("caller").toString(), Tomahawk::InfoSystem::InfoTrackLyrics, reply->property("origData"), QVariant(lyrics), reply->property("customData").value<QVariantMap>());
|
||||
emit info( reply->property( "requestId" ).toUInt(), reply->property( "caller" ).toString(), Tomahawk::InfoSystem::InfoTrackLyrics, reply->property( "origData" ), QVariant( lyrics ), reply->property( "customData" ).value<QVariantMap>() );
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public slots:
|
||||
void namChangedSlot( QNetworkAccessManager *nam );
|
||||
|
||||
protected slots:
|
||||
virtual void getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData );
|
||||
virtual void getInfo( uint requestId, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData );
|
||||
|
||||
virtual void pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant data )
|
||||
{
|
||||
@ -54,8 +54,9 @@ protected slots:
|
||||
Q_UNUSED( data );
|
||||
}
|
||||
|
||||
virtual void notInCacheSlot( const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData )
|
||||
virtual void notInCacheSlot( uint requestId, const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData )
|
||||
{
|
||||
Q_UNUSED( requestId );
|
||||
Q_UNUSED( criteria );
|
||||
Q_UNUSED( caller );
|
||||
Q_UNUSED( type );
|
||||
@ -64,7 +65,7 @@ protected slots:
|
||||
}
|
||||
|
||||
private:
|
||||
bool isValidTrackData( const QString &caller, const QVariant &input, const QVariantMap &customData );
|
||||
bool isValidTrackData( uint requestId, const QString &caller, const QVariant &input, const QVariantMap &customData );
|
||||
|
||||
QString m_apiKey;
|
||||
|
||||
|
@ -39,12 +39,29 @@ public:
|
||||
virtual ~AdiumPlugin();
|
||||
|
||||
protected slots:
|
||||
void getInfo( const QString caller, const InfoType type, const QVariant data, QVariantMap customData );
|
||||
virtual void getInfo( uint requestId, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData )
|
||||
{
|
||||
Q_UNUSED( requestId );
|
||||
Q_UNUSED( caller );
|
||||
Q_UNUSED( type );
|
||||
Q_UNUSED( input );
|
||||
Q_UNUSED( customData );
|
||||
}
|
||||
|
||||
void pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input );
|
||||
|
||||
public slots:
|
||||
void namChangedSlot( QNetworkAccessManager* /*nam*/ ) {} // unused
|
||||
void notInCacheSlot( const Tomahawk::InfoSystem::InfoCriteriaHash /*criteria*/, const QString /*caller*/, const Tomahawk::InfoSystem::InfoType /*type*/, const QVariant /*input*/, const QVariantMap /*customData*/ ) {} // unused
|
||||
|
||||
virtual void notInCacheSlot( uint requestId, const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData )
|
||||
{
|
||||
Q_UNUSED( requestId );
|
||||
Q_UNUSED( criteria );
|
||||
Q_UNUSED( caller );
|
||||
Q_UNUSED( type );
|
||||
Q_UNUSED( input );
|
||||
Q_UNUSED( customData );
|
||||
}
|
||||
|
||||
private slots:
|
||||
void clearStatus();
|
||||
|
@ -38,8 +38,9 @@ public:
|
||||
virtual void namChangedSlot( QNetworkAccessManager* ) {}
|
||||
|
||||
protected slots:
|
||||
virtual void getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData )
|
||||
virtual void getInfo( uint requestId, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData )
|
||||
{
|
||||
Q_UNUSED( requestId );
|
||||
Q_UNUSED( caller );
|
||||
Q_UNUSED( type );
|
||||
Q_UNUSED( input );
|
||||
@ -48,8 +49,9 @@ protected slots:
|
||||
|
||||
virtual void pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant pushData );
|
||||
|
||||
virtual void notInCacheSlot( const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData )
|
||||
virtual void notInCacheSlot( uint requestId, const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData )
|
||||
{
|
||||
Q_UNUSED( requestId );
|
||||
Q_UNUSED( criteria );
|
||||
Q_UNUSED( caller );
|
||||
Q_UNUSED( type );
|
||||
|
@ -52,6 +52,9 @@ InfoSystem::instance()
|
||||
|
||||
InfoSystem::InfoSystem(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_infoSystemCacheThreadController( 0 )
|
||||
, m_infoSystemWorkerThreadController( 0 )
|
||||
, m_nextRequest( 0 )
|
||||
{
|
||||
s_instance = this;
|
||||
|
||||
@ -71,11 +74,11 @@ InfoSystem::InfoSystem(QObject *parent)
|
||||
|
||||
connect( TomahawkSettings::instance(), SIGNAL( changed() ), SLOT( newNam() ) );
|
||||
|
||||
connect( m_cache.data(), SIGNAL( info( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, QVariantMap ) ),
|
||||
this, SLOT( infoSlot( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, QVariantMap ) ), Qt::UniqueConnection );
|
||||
connect( m_cache.data(), SIGNAL( info( uint, QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, QVariantMap ) ),
|
||||
this, SLOT( infoSlot( uint, QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, QVariantMap ) ), Qt::UniqueConnection );
|
||||
|
||||
connect( m_worker.data(), SIGNAL( info( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, QVariantMap ) ),
|
||||
this, SLOT( infoSlot( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, QVariantMap ) ), Qt::UniqueConnection );
|
||||
connect( m_worker.data(), SIGNAL( info( uint, QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, QVariantMap ) ),
|
||||
this, SLOT( infoSlot( uint, QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, QVariantMap ) ), Qt::UniqueConnection );
|
||||
}
|
||||
|
||||
InfoSystem::~InfoSystem()
|
||||
@ -120,9 +123,11 @@ InfoSystem::getInfo( const QString &caller, const InfoType type, const QVariant&
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
uint requestnum = ++m_nextRequest;
|
||||
qDebug() << "assigning request with requestId " << requestnum;
|
||||
m_dataTracker[caller][type] = m_dataTracker[caller][type] + 1;
|
||||
qDebug() << "current count in dataTracker for type" << type << "is" << m_dataTracker[caller][type];
|
||||
QMetaObject::invokeMethod( m_worker.data(), "getInfo", Qt::QueuedConnection, Q_ARG( QString, caller ), Q_ARG( Tomahawk::InfoSystem::InfoType, type ), Q_ARG( QVariant, input ), Q_ARG( QVariantMap, customData ) );
|
||||
QMetaObject::invokeMethod( m_worker.data(), "getInfo", Qt::QueuedConnection, Q_ARG( uint, requestnum ), Q_ARG( QString, caller ), Q_ARG( Tomahawk::InfoSystem::InfoType, type ), Q_ARG( QVariant, input ), Q_ARG( QVariantMap, customData ) );
|
||||
}
|
||||
|
||||
|
||||
@ -147,34 +152,34 @@ void
|
||||
InfoSystem::pushInfo( const QString &caller, const InfoTypeMap &input )
|
||||
{
|
||||
Q_FOREACH( InfoType type, input.keys() )
|
||||
pushInfo( caller, type, input[type] );
|
||||
pushInfo( caller, type, input[ type ] );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
InfoSystem::infoSlot( QString target, InfoType type, QVariant input, QVariant output, QVariantMap customData )
|
||||
InfoSystem::infoSlot( uint requestId, QString target, InfoType type, QVariant input, QVariant output, QVariantMap customData )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
qDebug() << "current count in dataTracker is " << m_dataTracker[target][type];
|
||||
if (m_dataTracker[target][type] == 0)
|
||||
qDebug() << Q_FUNC_INFO << " with requestId " << requestId;
|
||||
qDebug() << "current count in dataTracker for target " << target << " is " << m_dataTracker[ target ][ type ];
|
||||
if ( m_dataTracker[ target ][ type ] == 0 )
|
||||
{
|
||||
qDebug() << "Caller was not waiting for that type of data!";
|
||||
return;
|
||||
}
|
||||
emit info(target, type, input, output, customData);
|
||||
emit info( target, type, input, output, customData );
|
||||
|
||||
m_dataTracker[target][type] = m_dataTracker[target][type] - 1;
|
||||
qDebug() << "current count in dataTracker is " << m_dataTracker[target][type];
|
||||
Q_FOREACH(InfoType testtype, m_dataTracker[target].keys())
|
||||
m_dataTracker[ target ][ type ] = m_dataTracker[ target ][ type ] - 1;
|
||||
qDebug() << "current count in dataTracker for target " << target << " is " << m_dataTracker[ target ][ type ];
|
||||
Q_FOREACH( InfoType testtype, m_dataTracker[ target ].keys() )
|
||||
{
|
||||
if (m_dataTracker[target][testtype] != 0)
|
||||
if ( m_dataTracker[ target ][ testtype ] != 0)
|
||||
{
|
||||
qDebug() << "found outstanding request of type" << testtype;
|
||||
return;
|
||||
}
|
||||
}
|
||||
qDebug() << "emitting finished with target" << target;
|
||||
emit finished(target);
|
||||
emit finished( target );
|
||||
}
|
||||
|
||||
} //namespace InfoSystem
|
||||
|
@ -124,15 +124,15 @@ public:
|
||||
QSet< InfoType > supportedPushTypes() const { return m_supportedPushTypes; }
|
||||
|
||||
signals:
|
||||
void getCachedInfo( Tomahawk::InfoSystem::InfoCriteriaHash criteria, qint64 newMaxAge, QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariantMap customData );
|
||||
void getCachedInfo( uint requestId, Tomahawk::InfoSystem::InfoCriteriaHash criteria, qint64 newMaxAge, QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariantMap customData );
|
||||
void info( uint requestId, QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, QVariantMap customData );
|
||||
|
||||
void updateCache( Tomahawk::InfoSystem::InfoCriteriaHash criteria, qint64, Tomahawk::InfoSystem::InfoType type, QVariant output );
|
||||
void info( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, QVariantMap customData );
|
||||
void finished( QString, Tomahawk::InfoSystem::InfoType );
|
||||
|
||||
protected slots:
|
||||
virtual void getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant data, const QVariantMap customData ) = 0;
|
||||
virtual void getInfo( uint requestId, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant data, const QVariantMap customData ) = 0;
|
||||
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 QVariantMap customData ) = 0;
|
||||
virtual void notInCacheSlot( uint requestId, const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData ) = 0;
|
||||
|
||||
virtual void namChangedSlot( QNetworkAccessManager *nam ) = 0;
|
||||
|
||||
@ -167,7 +167,7 @@ signals:
|
||||
void finished( QString target );
|
||||
|
||||
public slots:
|
||||
void infoSlot( const QString target, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariant output, const QVariantMap customData );
|
||||
void infoSlot( uint requestId, const QString target, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariant output, const QVariantMap customData );
|
||||
|
||||
void newNam() const;
|
||||
|
||||
@ -179,6 +179,8 @@ private:
|
||||
QThread* m_infoSystemCacheThreadController;
|
||||
QThread* m_infoSystemWorkerThreadController;
|
||||
|
||||
uint m_nextRequest;
|
||||
|
||||
static InfoSystem* s_instance;
|
||||
};
|
||||
|
||||
|
@ -84,7 +84,7 @@ InfoSystemCache::pruneTimerFired()
|
||||
|
||||
|
||||
void
|
||||
InfoSystemCache::getCachedInfoSlot( const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const qint64 newMaxAge, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData )
|
||||
InfoSystemCache::getCachedInfoSlot( uint requestId, const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const qint64 newMaxAge, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
const QString criteriaHashVal = criteriaMd5( criteria );
|
||||
@ -94,7 +94,7 @@ InfoSystemCache::getCachedInfoSlot( const Tomahawk::InfoSystem::InfoCriteriaHash
|
||||
if ( !fileLocationHash.isEmpty() )
|
||||
{
|
||||
//We already know of some values, so no need to re-read the directory again as it's already happened
|
||||
emit notInCache( criteria, caller, type, input, customData );
|
||||
emit notInCache( requestId, criteria, caller, type, input, customData );
|
||||
return;
|
||||
}
|
||||
|
||||
@ -103,7 +103,7 @@ InfoSystemCache::getCachedInfoSlot( const Tomahawk::InfoSystem::InfoCriteriaHash
|
||||
if ( !dir.exists() )
|
||||
{
|
||||
//Dir doesn't exist so clearly not in cache
|
||||
emit notInCache( criteria, caller, type, input, customData );
|
||||
emit notInCache( requestId, criteria, caller, type, input, customData );
|
||||
return;
|
||||
}
|
||||
|
||||
@ -119,7 +119,7 @@ InfoSystemCache::getCachedInfoSlot( const Tomahawk::InfoSystem::InfoCriteriaHash
|
||||
if ( !fileLocationHash.contains( criteriaHashVal ) )
|
||||
{
|
||||
//Still didn't fine it? It's really not in the cache then
|
||||
emit notInCache( criteria, caller, type, input, customData );
|
||||
emit notInCache( requestId, criteria, caller, type, input, customData );
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -138,7 +138,7 @@ InfoSystemCache::getCachedInfoSlot( const Tomahawk::InfoSystem::InfoCriteriaHash
|
||||
m_fileLocationCache[type] = fileLocationHash;
|
||||
m_dataCache.remove( criteriaHashVal );
|
||||
|
||||
emit notInCache( criteria, caller, type, input, customData );
|
||||
emit notInCache( requestId, criteria, caller, type, input, customData );
|
||||
return;
|
||||
}
|
||||
else if ( newMaxAge > 0 )
|
||||
@ -148,7 +148,7 @@ InfoSystemCache::getCachedInfoSlot( const Tomahawk::InfoSystem::InfoCriteriaHash
|
||||
if ( !QFile::rename( file.canonicalFilePath(), newFilePath ) )
|
||||
{
|
||||
qDebug() << "Failed to move old cache file to new location!";
|
||||
emit notInCache( criteria, caller, type, input, customData );
|
||||
emit notInCache( requestId, criteria, caller, type, input, customData );
|
||||
return;
|
||||
}
|
||||
|
||||
@ -162,11 +162,11 @@ InfoSystemCache::getCachedInfoSlot( const Tomahawk::InfoSystem::InfoCriteriaHash
|
||||
QVariant output = cachedSettings.value( "data" );
|
||||
m_dataCache.insert( criteriaHashVal, new QVariant( output ) );
|
||||
|
||||
emit info( caller, type, input, output, customData );
|
||||
emit info( requestId, caller, type, input, output, customData );
|
||||
}
|
||||
else
|
||||
{
|
||||
emit info( caller, type, input, QVariant( *(m_dataCache[criteriaHashVal]) ), customData );
|
||||
emit info( requestId, caller, type, input, QVariant( *(m_dataCache[criteriaHashVal]) ), customData );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,11 +43,11 @@ public:
|
||||
virtual ~InfoSystemCache();
|
||||
|
||||
signals:
|
||||
void notInCache( Tomahawk::InfoSystem::InfoCriteriaHash criteria, QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariantMap customData );
|
||||
void info( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, QVariantMap customData );
|
||||
void notInCache( uint requestId, Tomahawk::InfoSystem::InfoCriteriaHash criteria, QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariantMap customData );
|
||||
void info( uint requestId, QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, QVariantMap customData );
|
||||
|
||||
public slots:
|
||||
void getCachedInfoSlot( const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const qint64 newMaxAge, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData );
|
||||
void getCachedInfoSlot( uint requestId, const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const qint64 newMaxAge, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData );
|
||||
void updateCacheSlot( const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const qint64 maxAge, const Tomahawk::InfoSystem::InfoType type, const QVariant output );
|
||||
|
||||
private slots:
|
||||
|
@ -87,23 +87,23 @@ InfoSystemWorker::init( QWeakPointer< Tomahawk::InfoSystem::InfoSystemCache> cac
|
||||
{
|
||||
connect(
|
||||
plugin.data(),
|
||||
SIGNAL( info( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, QVariantMap ) ),
|
||||
SIGNAL( info( uint, QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, QVariantMap ) ),
|
||||
InfoSystem::instance(),
|
||||
SLOT( infoSlot( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, QVariantMap ) ),
|
||||
SLOT( infoSlot( uint, QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, QVariantMap ) ),
|
||||
Qt::UniqueConnection
|
||||
);
|
||||
|
||||
connect(
|
||||
plugin.data(),
|
||||
SIGNAL( getCachedInfo( Tomahawk::InfoSystem::InfoCriteriaHash, qint64, QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariantMap ) ),
|
||||
SIGNAL( getCachedInfo( uint, Tomahawk::InfoSystem::InfoCriteriaHash, qint64, QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariantMap ) ),
|
||||
cache.data(),
|
||||
SLOT( getCachedInfoSlot( Tomahawk::InfoSystem::InfoCriteriaHash, qint64, QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariantMap ) )
|
||||
SLOT( getCachedInfoSlot( uint, Tomahawk::InfoSystem::InfoCriteriaHash, qint64, QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariantMap ) )
|
||||
);
|
||||
connect(
|
||||
cache.data(),
|
||||
SIGNAL( notInCache( Tomahawk::InfoSystem::InfoCriteriaHash, QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariantMap ) ),
|
||||
SIGNAL( notInCache( uint, Tomahawk::InfoSystem::InfoCriteriaHash, QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariantMap ) ),
|
||||
plugin.data(),
|
||||
SLOT( notInCacheSlot( Tomahawk::InfoSystem::InfoCriteriaHash, QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariantMap ) )
|
||||
SLOT( notInCacheSlot( uint, Tomahawk::InfoSystem::InfoCriteriaHash, QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariantMap ) )
|
||||
);
|
||||
connect(
|
||||
plugin.data(),
|
||||
@ -147,24 +147,24 @@ InfoSystemWorker::determineOrderedMatches( const InfoType type ) const
|
||||
|
||||
|
||||
void
|
||||
InfoSystemWorker::getInfo( QString caller, InfoType type, QVariant input, QVariantMap customData )
|
||||
InfoSystemWorker::getInfo( uint requestId, QString caller, InfoType type, QVariant input, QVariantMap customData )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
QLinkedList< InfoPluginPtr > providers = determineOrderedMatches(type);
|
||||
if ( providers.isEmpty() )
|
||||
{
|
||||
emit info( caller, type, QVariant(), QVariant(), customData );
|
||||
emit info( requestId, caller, type, QVariant(), QVariant(), customData );
|
||||
return;
|
||||
}
|
||||
|
||||
InfoPluginPtr ptr = providers.first();
|
||||
if ( !ptr )
|
||||
{
|
||||
emit info( caller, type, QVariant(), QVariant(), customData );
|
||||
emit info( requestId, caller, type, QVariant(), QVariant(), customData );
|
||||
return;
|
||||
}
|
||||
|
||||
QMetaObject::invokeMethod( ptr.data(), "getInfo", Qt::QueuedConnection, Q_ARG( QString, caller ), Q_ARG( Tomahawk::InfoSystem::InfoType, type ), Q_ARG( QVariant, input ), Q_ARG( QVariantMap, customData ) );
|
||||
QMetaObject::invokeMethod( ptr.data(), "getInfo", Qt::QueuedConnection, Q_ARG( uint, requestId ), Q_ARG( QString, caller ), Q_ARG( Tomahawk::InfoSystem::InfoType, type ), Q_ARG( QVariant, input ), Q_ARG( QVariantMap, customData ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -48,12 +48,12 @@ public:
|
||||
QNetworkAccessManager* nam() const;
|
||||
|
||||
signals:
|
||||
void info( QString target, Tomahawk::InfoSystem::InfoType, QVariant input, QVariant output, QVariantMap customData );
|
||||
void info( uint requestId, QString target, Tomahawk::InfoSystem::InfoType, QVariant input, QVariant output, QVariantMap customData );
|
||||
void namChanged( QNetworkAccessManager* );
|
||||
|
||||
public slots:
|
||||
void init( QWeakPointer< Tomahawk::InfoSystem::InfoSystemCache > cache );
|
||||
void getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData );
|
||||
void getInfo( uint requestId, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const QVariantMap customData );
|
||||
void pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input );
|
||||
void newNam();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user