mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-07-31 03:10:12 +02:00
Add version controll to force cacheupdates on new sources.
This commit is contained in:
@@ -46,6 +46,8 @@ ChartsPlugin::ChartsPlugin()
|
||||
{
|
||||
/// Add resources here
|
||||
m_chartResources << "billboard" << "itunes" << "rdio" << "wearehunted" << "ex.fm" << "soundcloudwall.com";
|
||||
/// If you add resource, update version aswell
|
||||
m_chartVersion = "1.0";
|
||||
m_supportedGetTypes << InfoChart << InfoChartCapabilities;
|
||||
|
||||
}
|
||||
@@ -153,7 +155,8 @@ ChartsPlugin::fetchChartCapabilities( Tomahawk::InfoSystem::InfoRequestData requ
|
||||
|
||||
Tomahawk::InfoSystem::InfoStringHash criteria;
|
||||
criteria[ "InfoChartCapabilities" ] = "chartsplugin";
|
||||
emit getCachedInfo( criteria, 604800000, requestData );
|
||||
criteria[ "InfoChartVersion" ] = m_chartVersion;
|
||||
emit getCachedInfo( criteria, 864000000, requestData );
|
||||
}
|
||||
|
||||
void
|
||||
@@ -182,8 +185,8 @@ ChartsPlugin::notInCacheSlot( QHash<QString, QString> criteria, Tomahawk::InfoSy
|
||||
|
||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "InfoChartCapabilities not in cache! Fetching...";
|
||||
// we never need to re-fetch
|
||||
if ( !m_allChartsMap.isEmpty() )
|
||||
return;
|
||||
//if ( !m_allChartsMap.isEmpty() )
|
||||
// return;
|
||||
|
||||
/// Then get each chart from resource
|
||||
|
||||
@@ -333,6 +336,7 @@ ChartsPlugin::chartTypes()
|
||||
if( source == "wearehunted" ){
|
||||
chartName = "WeAreHunted";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -422,7 +426,8 @@ ChartsPlugin::chartTypes()
|
||||
// update cache
|
||||
Tomahawk::InfoSystem::InfoStringHash criteria;
|
||||
criteria[ "InfoChartCapabilities" ] = "chartsplugin";
|
||||
emit updateCache( criteria, 604800000, request.type, m_allChartsMap );
|
||||
criteria[ "InfoChartVersion" ] = m_chartVersion;
|
||||
emit updateCache( criteria, 864000000, request.type, m_allChartsMap );
|
||||
}
|
||||
m_cachedRequests.clear();
|
||||
}
|
||||
|
@@ -72,16 +72,13 @@ private:
|
||||
void dataError( Tomahawk::InfoSystem::InfoRequestData requestData );
|
||||
|
||||
QStringList m_chartResources;
|
||||
QString m_chartVersion;
|
||||
QList< InfoStringHash > m_charts;
|
||||
ChartType m_chartType;
|
||||
|
||||
QVariantMap m_allChartsMap;
|
||||
|
||||
uint m_chartsFetchJobs;
|
||||
QList< InfoRequestData > m_cachedRequests;
|
||||
|
||||
QHash< QString, QString > m_cachedCountries;
|
||||
|
||||
QWeakPointer< QNetworkAccessManager > m_nam;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user