mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-07 06:36:55 +02:00
* Style cleanups for Query & ChartsPlugin.
This commit is contained in:
@@ -70,11 +70,14 @@ ChartsPlugin::init()
|
|||||||
{
|
{
|
||||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << QThread::currentThread();
|
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << QThread::currentThread();
|
||||||
QVariantList source_qvarlist = TomahawkUtils::Cache::instance()->getData( "ChartsPlugin", "chart_sources" ).toList();
|
QVariantList source_qvarlist = TomahawkUtils::Cache::instance()->getData( "ChartsPlugin", "chart_sources" ).toList();
|
||||||
foreach( const QVariant & source, source_qvarlist ) {
|
|
||||||
|
foreach ( const QVariant & source, source_qvarlist )
|
||||||
|
{
|
||||||
m_chartResources.append( source.toString() );
|
m_chartResources.append( source.toString() );
|
||||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "fetched source from cache" << source.toString();
|
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "fetched source from cache" << source.toString();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "total sources" << m_chartResources.size() << source_qvarlist.size();
|
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "total sources" << m_chartResources.size() << source_qvarlist.size();
|
||||||
if ( m_chartResources.size() == 0 )
|
if ( m_chartResources.size() == 0 )
|
||||||
fetchChartSourcesList( true );
|
fetchChartSourcesList( true );
|
||||||
@@ -92,9 +95,6 @@ ChartsPlugin::dataError( Tomahawk::InfoSystem::InfoRequestData requestData )
|
|||||||
void
|
void
|
||||||
ChartsPlugin::getInfo( Tomahawk::InfoSystem::InfoRequestData requestData )
|
ChartsPlugin::getInfo( Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||||
{
|
{
|
||||||
//qDebug() << Q_FUNC_INFO << requestData.caller;
|
|
||||||
//qDebug() << Q_FUNC_INFO << requestData.customData;
|
|
||||||
|
|
||||||
InfoStringHash hash = requestData.input.value< Tomahawk::InfoSystem::InfoStringHash >();
|
InfoStringHash hash = requestData.input.value< Tomahawk::InfoSystem::InfoStringHash >();
|
||||||
bool foundSource = false;
|
bool foundSource = false;
|
||||||
|
|
||||||
@@ -142,7 +142,6 @@ ChartsPlugin::getInfo( Tomahawk::InfoSystem::InfoRequestData requestData )
|
|||||||
void
|
void
|
||||||
ChartsPlugin::fetchChartFromCache( Tomahawk::InfoSystem::InfoRequestData requestData )
|
ChartsPlugin::fetchChartFromCache( Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( !requestData.input.canConvert< Tomahawk::InfoSystem::InfoStringHash >() )
|
if ( !requestData.input.canConvert< Tomahawk::InfoSystem::InfoStringHash >() )
|
||||||
{
|
{
|
||||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Could not convert requestData to InfoStringHash!";
|
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Could not convert requestData to InfoStringHash!";
|
||||||
@@ -166,10 +165,10 @@ ChartsPlugin::fetchChartFromCache( Tomahawk::InfoSystem::InfoRequestData request
|
|||||||
criteria["chart_source"] = hash["chart_source"];
|
criteria["chart_source"] = hash["chart_source"];
|
||||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Checking cache for " << hash["chart_id"] << " from " << hash["chart_source"];
|
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Checking cache for " << hash["chart_id"] << " from " << hash["chart_source"];
|
||||||
|
|
||||||
|
|
||||||
emit getCachedInfo( criteria, 86400000, requestData );
|
emit getCachedInfo( criteria, 86400000, requestData );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ChartsPlugin::fetchChartCapabilitiesFromCache( Tomahawk::InfoSystem::InfoRequestData requestData )
|
ChartsPlugin::fetchChartCapabilitiesFromCache( Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||||
{
|
{
|
||||||
@@ -187,6 +186,7 @@ ChartsPlugin::fetchChartCapabilitiesFromCache( Tomahawk::InfoSystem::InfoRequest
|
|||||||
emit getCachedInfo( criteria, 864000000, requestData );
|
emit getCachedInfo( criteria, 864000000, requestData );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ChartsPlugin::notInCacheSlot( QHash<QString, QString> criteria, Tomahawk::InfoSystem::InfoRequestData requestData )
|
ChartsPlugin::notInCacheSlot( QHash<QString, QString> criteria, Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||||
{
|
{
|
||||||
@@ -197,7 +197,6 @@ ChartsPlugin::notInCacheSlot( QHash<QString, QString> criteria, Tomahawk::InfoSy
|
|||||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "InfoChart not in cache! Fetching...";
|
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "InfoChart not in cache! Fetching...";
|
||||||
fetchChart( requestData, criteria["chart_source"], criteria["chart_id"] );
|
fetchChart( requestData, criteria["chart_source"], criteria["chart_id"] );
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case InfoChartCapabilities:
|
case InfoChartCapabilities:
|
||||||
@@ -205,7 +204,6 @@ ChartsPlugin::notInCacheSlot( QHash<QString, QString> criteria, Tomahawk::InfoSy
|
|||||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "InfoChartCapabilities not in cache! Fetching...";
|
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "InfoChartCapabilities not in cache! Fetching...";
|
||||||
fetchChartSourcesList( false );
|
fetchChartSourcesList( false );
|
||||||
m_cachedRequests.append( requestData );
|
m_cachedRequests.append( requestData );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,6 +216,7 @@ ChartsPlugin::notInCacheSlot( QHash<QString, QString> criteria, Tomahawk::InfoSy
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ChartsPlugin::fetchChartSourcesList( bool fetchOnlySourceList )
|
ChartsPlugin::fetchChartSourcesList( bool fetchOnlySourceList )
|
||||||
{
|
{
|
||||||
@@ -225,12 +224,10 @@ ChartsPlugin::fetchChartSourcesList( bool fetchOnlySourceList )
|
|||||||
QNetworkReply* reply = TomahawkUtils::nam()->get( QNetworkRequest( url ) );
|
QNetworkReply* reply = TomahawkUtils::nam()->get( QNetworkRequest( url ) );
|
||||||
reply->setProperty( "only_source_list", fetchOnlySourceList );
|
reply->setProperty( "only_source_list", fetchOnlySourceList );
|
||||||
|
|
||||||
|
|
||||||
tDebug() << Q_FUNC_INFO << "fetching:" << url;
|
|
||||||
connect( reply, SIGNAL( finished() ), SLOT( chartSourcesList() ) );
|
connect( reply, SIGNAL( finished() ), SLOT( chartSourcesList() ) );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ChartsPlugin::chartSourcesList()
|
ChartsPlugin::chartSourcesList()
|
||||||
{
|
{
|
||||||
@@ -251,10 +248,11 @@ ChartsPlugin::chartSourcesList()
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_chartResources.clear();
|
m_chartResources.clear();
|
||||||
foreach(const QVariant &source, sources) {
|
foreach ( const QVariant& source, sources )
|
||||||
|
{
|
||||||
m_chartResources << source.toString();
|
m_chartResources << source.toString();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "storing sources in cache" << m_chartResources;
|
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "storing sources in cache" << m_chartResources;
|
||||||
TomahawkUtils::Cache::instance()->putData( "ChartsPlugin", 172800000 /* 2 days */, "chart_sources", m_chartResources );
|
TomahawkUtils::Cache::instance()->putData( "ChartsPlugin", 172800000 /* 2 days */, "chart_sources", m_chartResources );
|
||||||
if ( !reply->property( "only_source_list" ).toBool() )
|
if ( !reply->property( "only_source_list" ).toBool() )
|
||||||
@@ -264,7 +262,9 @@ ChartsPlugin::chartSourcesList()
|
|||||||
tDebug() << Q_FUNC_INFO << "Encountered error fetching chart sources list";
|
tDebug() << Q_FUNC_INFO << "Encountered error fetching chart sources list";
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChartsPlugin::fetchAllChartSources()
|
|
||||||
|
void
|
||||||
|
ChartsPlugin::fetchAllChartSources()
|
||||||
{
|
{
|
||||||
if ( !m_chartResources.isEmpty() && m_allChartsMap.isEmpty() )
|
if ( !m_chartResources.isEmpty() && m_allChartsMap.isEmpty() )
|
||||||
{
|
{
|
||||||
@@ -274,8 +274,6 @@ void ChartsPlugin::fetchAllChartSources()
|
|||||||
QUrl url = QUrl( QString( CHART_URL "charts/%1" ).arg( source ) );
|
QUrl url = QUrl( QString( CHART_URL "charts/%1" ).arg( source ) );
|
||||||
QNetworkReply* reply = TomahawkUtils::nam()->get( QNetworkRequest( url ) );
|
QNetworkReply* reply = TomahawkUtils::nam()->get( QNetworkRequest( url ) );
|
||||||
reply->setProperty( "chart_source", source );
|
reply->setProperty( "chart_source", source );
|
||||||
|
|
||||||
tDebug() << Q_FUNC_INFO << "fetching:" << url;
|
|
||||||
connect( reply, SIGNAL( finished() ), SLOT( chartsList() ) );
|
connect( reply, SIGNAL( finished() ), SLOT( chartsList() ) );
|
||||||
|
|
||||||
m_chartsFetchJobs++;
|
m_chartsFetchJobs++;
|
||||||
@@ -283,7 +281,9 @@ void ChartsPlugin::fetchAllChartSources()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChartsPlugin::fetchChart( Tomahawk::InfoSystem::InfoRequestData requestData, const QString& source, const QString& chart_id)
|
|
||||||
|
void
|
||||||
|
ChartsPlugin::fetchChart( Tomahawk::InfoSystem::InfoRequestData requestData, const QString& source, const QString& chart_id )
|
||||||
{
|
{
|
||||||
/// Fetch the chart, we need source and id
|
/// Fetch the chart, we need source and id
|
||||||
QUrl url = QUrl( QString( CHART_URL "charts/%1/%2" ).arg( source ).arg( chart_id ) );
|
QUrl url = QUrl( QString( CHART_URL "charts/%1/%2" ).arg( source ).arg( chart_id ) );
|
||||||
@@ -296,7 +296,6 @@ void ChartsPlugin::fetchChart( Tomahawk::InfoSystem::InfoRequestData requestData
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ChartsPlugin::chartsList()
|
ChartsPlugin::chartsList()
|
||||||
{
|
{
|
||||||
@@ -359,7 +358,6 @@ ChartsPlugin::chartsList()
|
|||||||
QString extra;
|
QString extra;
|
||||||
if ( !geo.isEmpty() )
|
if ( !geo.isEmpty() )
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( !m_cachedCountries.contains( geo ) )
|
if ( !m_cachedCountries.contains( geo ) )
|
||||||
{
|
{
|
||||||
QLocale l( QString( "en_%1" ).arg( geo ) );
|
QLocale l( QString( "en_%1" ).arg( geo ) );
|
||||||
@@ -408,18 +406,19 @@ ChartsPlugin::chartsList()
|
|||||||
charts[ c ] = extraType[ c ];
|
charts[ c ] = extraType[ c ];
|
||||||
// tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "extraType has types:" << c;
|
// tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "extraType has types:" << c;
|
||||||
}
|
}
|
||||||
if( source == "itunes" ){
|
if ( source == "itunes" )
|
||||||
|
{
|
||||||
chartName = "iTunes";
|
chartName = "iTunes";
|
||||||
}
|
}
|
||||||
if( source == "soundcloudwall" ){
|
else if ( source == "soundcloudwall" )
|
||||||
|
{
|
||||||
chartName = "SoundCloudWall";
|
chartName = "SoundCloudWall";
|
||||||
}
|
}
|
||||||
if( source == "wearehunted" ){
|
else if ( source == "wearehunted" )
|
||||||
|
{
|
||||||
chartName = "WeAreHunted";
|
chartName = "WeAreHunted";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -432,17 +431,20 @@ ChartsPlugin::chartsList()
|
|||||||
|
|
||||||
foreach ( const QVariant& chartObj, res.values() )
|
foreach ( const QVariant& chartObj, res.values() )
|
||||||
{
|
{
|
||||||
if( !chartObj.toMap().isEmpty() ){
|
if ( !chartObj.toMap().isEmpty() )
|
||||||
|
{
|
||||||
const QVariantMap chart = chartObj.toMap();
|
const QVariantMap chart = chartObj.toMap();
|
||||||
const QString type = chart.value( "type" ).toString();
|
const QString type = chart.value( "type" ).toString();
|
||||||
const bool isDefault = ( chart.contains( "default" ) && chart[ "default" ].toInt() == 1 );
|
const bool isDefault = ( chart.contains( "default" ) && chart[ "default" ].toInt() == 1 );
|
||||||
|
|
||||||
InfoStringHash c;
|
InfoStringHash c;
|
||||||
c[ "id" ] = chart.value( "id" ).toString();
|
c[ "id" ] = chart.value( "id" ).toString();
|
||||||
|
|
||||||
if ( chart.value( "genre").isValid() )
|
if ( chart.value( "genre").isValid() )
|
||||||
c[ "label" ] = chart.value( "genre" ).toString();
|
c[ "label" ] = chart.value( "genre" ).toString();
|
||||||
else
|
else
|
||||||
c[ "label" ] = chart.value( "name" ).toString();
|
c[ "label" ] = chart.value( "name" ).toString();
|
||||||
|
|
||||||
if ( isDefault )
|
if ( isDefault )
|
||||||
c[ "default" ] = "true";
|
c[ "default" ] = "true";
|
||||||
|
|
||||||
@@ -455,12 +457,11 @@ ChartsPlugin::chartsList()
|
|||||||
{
|
{
|
||||||
c[ "type" ] = "tracks";
|
c[ "type" ] = "tracks";
|
||||||
trackCharts.append( c );
|
trackCharts.append( c );
|
||||||
|
}
|
||||||
}else if ( type == "Artist" )
|
else if ( type == "Artist" )
|
||||||
{
|
{
|
||||||
c[ "type" ] = "artists";
|
c[ "type" ] = "artists";
|
||||||
artistCharts.append( c );
|
artistCharts.append( c );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isDefault )
|
if ( isDefault )
|
||||||
@@ -470,6 +471,7 @@ ChartsPlugin::chartsList()
|
|||||||
defaultChain.append( c[ "label" ] );
|
defaultChain.append( c[ "label" ] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !artistCharts.isEmpty() )
|
if ( !artistCharts.isEmpty() )
|
||||||
charts.insert( tr( "Artists" ), QVariant::fromValue< QList< Tomahawk::InfoSystem::InfoStringHash > >( artistCharts ) );
|
charts.insert( tr( "Artists" ), QVariant::fromValue< QList< Tomahawk::InfoSystem::InfoStringHash > >( artistCharts ) );
|
||||||
if ( !albumCharts.isEmpty() )
|
if ( !albumCharts.isEmpty() )
|
||||||
@@ -485,13 +487,12 @@ ChartsPlugin::chartsList()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Add the possible charts and its types to breadcrumb
|
/// Add the possible charts and its types to breadcrumb
|
||||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "ADDING CHART TO CHARTS:" << chartName;
|
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Adding to charts:" << chartName;
|
||||||
QVariantMap defaultMap = m_allChartsMap.value( "defaults" ).value< QVariantMap >();
|
QVariantMap defaultMap = m_allChartsMap.value( "defaults" ).value< QVariantMap >();
|
||||||
defaultMap[ source ] = defaultChain;
|
defaultMap[ source ] = defaultChain;
|
||||||
m_allChartsMap[ "defaults" ] = defaultMap;
|
m_allChartsMap[ "defaults" ] = defaultMap;
|
||||||
m_allChartsMap[ "defaultSource" ] = "itunes";
|
m_allChartsMap[ "defaultSource" ] = "itunes";
|
||||||
m_allChartsMap.insert( chartName , QVariant::fromValue< QVariantMap >( charts ) );
|
m_allChartsMap.insert( chartName , QVariant::fromValue< QVariantMap >( charts ) );
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -513,13 +514,12 @@ ChartsPlugin::chartsList()
|
|||||||
}
|
}
|
||||||
m_cachedRequests.clear();
|
m_cachedRequests.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ChartsPlugin::chartReturned()
|
ChartsPlugin::chartReturned()
|
||||||
{
|
{
|
||||||
|
|
||||||
/// Chart request returned something! Woho
|
/// Chart request returned something! Woho
|
||||||
QNetworkReply* reply = qobject_cast<QNetworkReply*>( sender() );
|
QNetworkReply* reply = qobject_cast<QNetworkReply*>( sender() );
|
||||||
QVariantMap returnedData;
|
QVariantMap returnedData;
|
||||||
@@ -554,16 +554,13 @@ ChartsPlugin::chartReturned()
|
|||||||
else
|
else
|
||||||
setChartType( None );
|
setChartType( None );
|
||||||
|
|
||||||
|
foreach ( const QVariant& chartR, chartResponse )
|
||||||
// qDebug() << "Got chart returned!" << res;
|
|
||||||
foreach ( QVariant chartR, chartResponse )
|
|
||||||
{
|
{
|
||||||
QString title, artist, album, streamUrl;
|
QString title, artist, album, streamUrl;
|
||||||
QVariantMap chartMap = chartR.toMap();
|
QVariantMap chartMap = chartR.toMap();
|
||||||
|
|
||||||
if ( !chartMap.isEmpty() )
|
if ( !chartMap.isEmpty() )
|
||||||
{
|
{
|
||||||
|
|
||||||
title = chartMap.value( "track" ).toString();
|
title = chartMap.value( "track" ).toString();
|
||||||
album = chartMap.value( "album" ).toString();
|
album = chartMap.value( "album" ).toString();
|
||||||
artist = chartMap.value( "artist" ).toString();
|
artist = chartMap.value( "artist" ).toString();
|
||||||
@@ -573,74 +570,62 @@ ChartsPlugin::chartReturned()
|
|||||||
|
|
||||||
if ( chartType() == Album )
|
if ( chartType() == Album )
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( album.isEmpty() && artist.isEmpty() ) // don't have enough...
|
if ( album.isEmpty() && artist.isEmpty() ) // don't have enough...
|
||||||
{
|
{
|
||||||
tDebug( LOGVERBOSE ) << "Didn't get an artist and album name from chart, not enough to build a query on. Aborting" << title << album << artist;
|
tDebug( LOGVERBOSE ) << "Didn't get an artist and album name from chart, not enough to build a query on. Aborting" << title << album << artist;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
Tomahawk::InfoSystem::InfoStringHash pair;
|
Tomahawk::InfoSystem::InfoStringHash pair;
|
||||||
pair["artist"] = artist;
|
pair["artist"] = artist;
|
||||||
pair["album"] = album;
|
pair["album"] = album;
|
||||||
top_albums.append( pair );
|
top_albums.append( pair );
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ( chartType() == Track )
|
else if ( chartType() == Track )
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( title.isEmpty() && artist.isEmpty() ) // don't have enough...
|
if ( title.isEmpty() && artist.isEmpty() ) // don't have enough...
|
||||||
{
|
{
|
||||||
tDebug( LOGVERBOSE ) << "Didn't get an artist and track name from charts, not enough to build a query on. Aborting" << title << artist << album;
|
tDebug( LOGVERBOSE ) << "Didn't get an artist and track name from charts, not enough to build a query on. Aborting" << title << artist << album;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
Tomahawk::InfoSystem::InfoStringHash pair;
|
Tomahawk::InfoSystem::InfoStringHash pair;
|
||||||
pair["artist"] = artist;
|
pair["artist"] = artist;
|
||||||
pair["track"] = title;
|
pair["track"] = title;
|
||||||
pair["streamUrl"] = streamUrl;
|
pair["streamUrl"] = streamUrl;
|
||||||
top_tracks.append( pair );
|
top_tracks.append( pair );
|
||||||
|
|
||||||
}
|
}
|
||||||
}else if( chartType() == Artist )
|
}
|
||||||
|
else if ( chartType() == Artist )
|
||||||
{
|
{
|
||||||
if ( artist.isEmpty() ) // don't have enough...
|
if ( artist.isEmpty() ) // don't have enough...
|
||||||
{
|
{
|
||||||
tDebug( LOGVERBOSE ) << "Didn't get an artist from charts, not enough to build a query on. Aborting" << artist;
|
tDebug( LOGVERBOSE ) << "Didn't get an artist from charts, not enough to build a query on. Aborting" << artist;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
top_artists.append( artist );
|
top_artists.append( artist );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( chartType() == Artist )
|
if ( chartType() == Artist )
|
||||||
{
|
{
|
||||||
tDebug() << "ChartsPlugin:" << "\tgot " << top_artists.size() << " artists";
|
tDebug( LOGVERBOSE ) << "ChartsPlugin:" << "got" << top_artists.size() << "artists";
|
||||||
returnedData[ "artists" ] = QVariant::fromValue< QStringList >( top_artists );
|
returnedData[ "artists" ] = QVariant::fromValue< QStringList >( top_artists );
|
||||||
returnedData[ "type" ] = "artists";
|
returnedData[ "type" ] = "artists";
|
||||||
}
|
}
|
||||||
|
else if ( chartType() == Track )
|
||||||
if( chartType() == Track )
|
|
||||||
{
|
{
|
||||||
tDebug() << "ChartsPlugin:" << "\tgot " << top_tracks.size() << " tracks";
|
tDebug( LOGVERBOSE ) << "ChartsPlugin:" << "got" << top_tracks.size() << "tracks";
|
||||||
returnedData[ "tracks" ] = QVariant::fromValue< QList< Tomahawk::InfoSystem::InfoStringHash > >( top_tracks );
|
returnedData[ "tracks" ] = QVariant::fromValue< QList< Tomahawk::InfoSystem::InfoStringHash > >( top_tracks );
|
||||||
returnedData[ "type" ] = "tracks";
|
returnedData[ "type" ] = "tracks";
|
||||||
}
|
}
|
||||||
|
else if ( chartType() == Album )
|
||||||
if( chartType() == Album )
|
|
||||||
{
|
{
|
||||||
tDebug() << "ChartsPlugin:" << "\tgot " << top_albums.size() << " albums";
|
tDebug( LOGVERBOSE ) << "ChartsPlugin:" << "got" << top_albums.size() << "albums";
|
||||||
returnedData[ "albums" ] = QVariant::fromValue< QList< Tomahawk::InfoSystem::InfoStringHash > >( top_albums );
|
returnedData[ "albums" ] = QVariant::fromValue< QList< Tomahawk::InfoSystem::InfoStringHash > >( top_albums );
|
||||||
returnedData[ "type" ] = "albums";
|
returnedData[ "type" ] = "albums";
|
||||||
}
|
}
|
||||||
@@ -657,7 +642,6 @@ ChartsPlugin::chartReturned()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Network error in fetching chart:" << reply->url().toString();
|
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Network error in fetching chart:" << reply->url().toString();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user