Registered Member
|
I'm currently writing a script, for dynamic playlist generation. Therefore I need to look up every song in a online database. Currently I saw this downloader in other scripts:
...well, I prefer the code to stop until a response arrives like:
how may I realize this? I didn't figure it out how to handle it with the trolltech network module... |
KDE Developer
|
There is no need to use the Downloader in a synchronous way. Just give it the method that it should call after finishing, and do nothing.
Here you can see an example of how it works: http://kollide.net:8060/browse/~raw,r=1 ... rc/main.js
--
Mark Kretschmann - Amarok Developer |
Registered Member
|
thx for your answer... let me reformulate my problem If I would do something like this:
...or is there a way to add an additional argument to 'download_finished'? I made a very ugly hack with a stack but it somehow works this way now... |
Registered Member
|
I /just/ started doing amarok plugin programming, so bear with me. Here is how it would work in javascript though:
var query = db.exec( SQL_GET_ARTIST_TITLE ); var row_dex = 0; while( query.next() ){ var track_id = query.value(0) var artist = query.value(1); var title = query.value(2); var path = "http://localhost/getCoordinates.php?" + "artist=" + artist + "&title=" + title; qurl = new QUrl( path ); new Downloader( qurl , function(data) { if ( whatever your condition that needs to access row_dex is ) print( "I'm a happy anonymous function that since JS is totally crazy, can inherit variables from where it is instantiained. No joke: "+row_dex ); } ); row_dex++; } |
Registered users: bancha, Bing [Bot], daret, Evergrowing, Google [Bot], lockheed, sandyvee, Sogou [Bot]