mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-04 21:27:58 +02:00
only load genre/style/mood from cache if it is empty
This commit is contained in:
@@ -615,7 +615,8 @@ EchonestGenerator::loadStylesMoodsAndGenres()
|
|||||||
{
|
{
|
||||||
if( !s_styles.isEmpty() && !s_moods.isEmpty() && !s_genres.isEmpty() )
|
if( !s_styles.isEmpty() && !s_moods.isEmpty() && !s_genres.isEmpty() )
|
||||||
return;
|
return;
|
||||||
|
if ( s_styles.isEmpty() )
|
||||||
|
{
|
||||||
QVariant styles = TomahawkUtils::Cache::instance()->getData( "EchonesGenerator", "styles" );
|
QVariant styles = TomahawkUtils::Cache::instance()->getData( "EchonesGenerator", "styles" );
|
||||||
if ( styles.isValid() && styles.canConvert< QStringList >() )
|
if ( styles.isValid() && styles.canConvert< QStringList >() )
|
||||||
{
|
{
|
||||||
@@ -627,7 +628,10 @@ EchonestGenerator::loadStylesMoodsAndGenres()
|
|||||||
s_stylesJob = Echonest::Artist::listTerms( "style" );
|
s_stylesJob = Echonest::Artist::listTerms( "style" );
|
||||||
connect( s_stylesJob, SIGNAL( finished() ), this, SLOT( stylesReceived() ) );
|
connect( s_stylesJob, SIGNAL( finished() ), this, SLOT( stylesReceived() ) );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( s_moods.isEmpty() )
|
||||||
|
{
|
||||||
QVariant moods = TomahawkUtils::Cache::instance()->getData( "EchonesGenerator", "moods" );
|
QVariant moods = TomahawkUtils::Cache::instance()->getData( "EchonesGenerator", "moods" );
|
||||||
if ( moods.isValid() && moods.canConvert< QStringList >() ) {
|
if ( moods.isValid() && moods.canConvert< QStringList >() ) {
|
||||||
s_moods = moods.toStringList();
|
s_moods = moods.toStringList();
|
||||||
@@ -638,7 +642,10 @@ EchonestGenerator::loadStylesMoodsAndGenres()
|
|||||||
s_moodsJob = Echonest::Artist::listTerms( "mood" );
|
s_moodsJob = Echonest::Artist::listTerms( "mood" );
|
||||||
connect( s_moodsJob, SIGNAL( finished() ), this, SLOT( moodsReceived() ) );
|
connect( s_moodsJob, SIGNAL( finished() ), this, SLOT( moodsReceived() ) );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( s_genres.isEmpty() )
|
||||||
|
{
|
||||||
QVariant genres = TomahawkUtils::Cache::instance()->getData( "EchonesGenerator", "genres" );
|
QVariant genres = TomahawkUtils::Cache::instance()->getData( "EchonesGenerator", "genres" );
|
||||||
if ( genres.isValid() && genres.canConvert< QStringList >() )
|
if ( genres.isValid() && genres.canConvert< QStringList >() )
|
||||||
{
|
{
|
||||||
@@ -650,6 +657,7 @@ EchonestGenerator::loadStylesMoodsAndGenres()
|
|||||||
s_genresJob = Echonest::Artist::fetchGenres();
|
s_genresJob = Echonest::Artist::fetchGenres();
|
||||||
connect( s_genresJob, SIGNAL( finished() ), this, SLOT( genresReceived() ) );
|
connect( s_genresJob, SIGNAL( finished() ), this, SLOT( genresReceived() ) );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Reference in New Issue
Block a user