void ScriptCommand_AllTracks::exec() { Tomahawk::ScriptCollection* collection = qobject_cast< Tomahawk::ScriptCollection* >( m_collection.data() ); if ( collection == 0 ) { reportFailure(); return; } ScriptJob* job; if( m_album ) { QVariantMap arguments; arguments[ "artist" ] = m_album->artist()->name(); arguments[ "album" ] = m_album->name(); job = collection->scriptObject()->invoke( "albumTracks", arguments ); } else { job = collection->scriptObject()->invoke( "tracks" ); } connect( job, SIGNAL( done( QVariantMap ) ), SLOT( onTracksJobDone( QVariantMap ) ), Qt::QueuedConnection ); job->start(); }
void ScriptCommand_AllArtists::exec() { Tomahawk::ScriptCollection* collection = qobject_cast< Tomahawk::ScriptCollection* >( m_collection.data() ); Q_ASSERT( collection ); QVariantMap arguments; if ( !m_filter.isEmpty() ) { arguments[ "filter" ] = m_filter; } ScriptJob* job = collection->scriptObject()->invoke( "artists", arguments ); connect( job, SIGNAL( done( QVariantMap ) ), SLOT( onArtistsJobDone( QVariantMap ) ), Qt::QueuedConnection ); job->start(); }
bool DownloadJob::download() { if ( m_state == Running ) return true; setState( Running ); if ( m_result->resolvedByCollection() ) { Tomahawk::ScriptCollection* collection = qobject_cast<Tomahawk::ScriptCollection*>( m_result->resolvedByCollection().data() ); if ( collection ) { QVariantMap arguments; arguments[ "url" ] = m_format.url; // HACK: *shrug* WIP. Tomahawk::ScriptJob* job = collection->scriptObject()->invoke( "getStreamUrlPromise", arguments ); connect( job, SIGNAL( done(QVariantMap) ), SLOT( onUrlRetrieved(QVariantMap) ) ); job->start(); } } return true; }