mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-13 09:34:53 +02:00
Don't try to filter artists/albums in ScriptCommands. This would fail because filtering for 'We will rock you' should still return 'Queen' e.g.
This commit is contained in:
@@ -107,7 +107,7 @@ ScriptCommand_AllAlbums::reportFailure()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ScriptCommand_AllAlbums::onAlbumsJobDone(const QVariantMap& result)
|
ScriptCommand_AllAlbums::onAlbumsJobDone( const QVariantMap& result )
|
||||||
{
|
{
|
||||||
ScriptJob* job = qobject_cast< ScriptJob* >( sender() );
|
ScriptJob* job = qobject_cast< ScriptJob* >( sender() );
|
||||||
Q_ASSERT( job );
|
Q_ASSERT( job );
|
||||||
@@ -129,19 +129,7 @@ ScriptCommand_AllAlbums::onAlbumsJobDone(const QVariantMap& result)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QList< Tomahawk::album_ptr > a = parseAlbumVariantList( resultArtists, result[ "albums" ].toList() );
|
QList< Tomahawk::album_ptr > a = parseAlbumVariantList( resultArtists, result[ "albums" ].toList() );
|
||||||
if ( m_filter.isEmpty() )
|
emit albums( a );
|
||||||
emit albums( a );
|
|
||||||
else
|
|
||||||
{
|
|
||||||
QList< Tomahawk::album_ptr > filtered;
|
|
||||||
foreach( const Tomahawk::album_ptr& album, a )
|
|
||||||
{
|
|
||||||
if( album->name().toLower().contains( m_filter.toLower() ) ||
|
|
||||||
album->artist()->name().toLower().contains( m_filter.toLower() ) )
|
|
||||||
filtered.append( album );
|
|
||||||
}
|
|
||||||
emit albums( filtered );
|
|
||||||
}
|
|
||||||
emit done();
|
emit done();
|
||||||
|
|
||||||
job->deleteLater();
|
job->deleteLater();
|
||||||
|
@@ -98,22 +98,7 @@ ScriptCommand_AllArtists::onArtistsJobDone( const QVariantMap& result )
|
|||||||
}
|
}
|
||||||
|
|
||||||
QList< Tomahawk::artist_ptr > a = parseArtistVariantList( result[ "artists" ].toList() );
|
QList< Tomahawk::artist_ptr > a = parseArtistVariantList( result[ "artists" ].toList() );
|
||||||
|
emit artists( a );
|
||||||
if ( m_filter.isEmpty() )
|
|
||||||
{
|
|
||||||
emit artists( a );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
QList< Tomahawk::artist_ptr > filtered;
|
|
||||||
foreach( const Tomahawk::artist_ptr& artist, a )
|
|
||||||
{
|
|
||||||
if ( artist->name().contains( m_filter ) )
|
|
||||||
filtered.append( artist );
|
|
||||||
}
|
|
||||||
emit artists( a );
|
|
||||||
}
|
|
||||||
|
|
||||||
emit done();
|
emit done();
|
||||||
|
|
||||||
job->deleteLater();
|
job->deleteLater();
|
||||||
|
Reference in New Issue
Block a user