void
ScriptCommand_AllTracks::onTracksJobDone( const QVariantMap& result )
{
    ScriptJob* job = qobject_cast< ScriptJob* >( sender() );
    Q_ASSERT( job );

    qDebug() << "Resolver reporting album tracks:" << result;

    if ( job->error() )
    {
        reportFailure();
        return;
    }

    QSharedPointer< ScriptCollection > collection = m_collection.objectCast< ScriptCollection >();
    Q_ASSERT( !collection.isNull() );

    QList< Tomahawk::result_ptr > t = collection->scriptAccount()->parseResultVariantList( result[ "results"].toList() );


    QList< Tomahawk::query_ptr > queries;
    foreach ( const Tomahawk::result_ptr& result, t )
    {
        result->setResolvedByCollection( m_collection );
        queries.append( result->toQuery() );
    }
void
ScriptCommand_AllArtists::onArtistsJobDone( const QVariantMap& result )
{
    ScriptJob* job = qobject_cast< ScriptJob* >( sender() );
    Q_ASSERT( job );

    if ( job->error() )
    {
        reportFailure();
        return;
    }

    QList< Tomahawk::artist_ptr > a = parseArtistVariantList( result[ "artists" ].toList() );
    emit artists( a );
    emit done();

    job->deleteLater();
}
void
ScriptInfoPlugin::onGetInfoRequestDone( const QVariantMap& result )
{
    Q_ASSERT( QThread::currentThread() == thread() );

    Q_D( ScriptInfoPlugin );



    ScriptJob* job = qobject_cast< ScriptJob* >( sender() );

    if ( job->error() )
    {
        emit info( d->requestDataCache[ job->id().toInt() ], QVariantMap() );
    }
    else
    {

        emit getCachedInfo( convertQVariantMapToInfoStringHash( result[ "criteria" ].toMap() ), result[ "newMaxAge" ].toLongLong(), d->requestDataCache[ job->id().toInt() ] );
    }

    d->requestDataCache.remove( job->id().toInt() );
    sender()->deleteLater();
}