Hi ,
I created a custom *script filter* which performs multiple queries against a distant webservice. Like the "Google Suggest" example, I first get a list of entries from the service (one fast request), but then I perform two additional queries (slow ones) *per item* which I use as *subtitle* and *icon*.
Even by limiting to 9 items and caching results, it is slow. It wonder if it's possible (and how) to send a first XML response to Alfred immediately and send another response later (when I have performed all the requests) to replace the first one.
For illustration, using the "Google Suggest" example, imagine that for each suggestion I want to show as subtitle the URL of the first result when searching with Google and the associated favicon. The script would first send to Alfred (immediately after getting suggestions):
<?xml version="1.0"?>
<items>
<item uid="1.1364323823" arg="alfred" valid="yes" autocomplete="">
<title>alfred</title>
<subtitle>Search Google for alfred</subtitle>
<icon>icon.png</icon>
</item>
<item uid="2.1364323823" arg="alfred hitchcock" valid="yes" autocomplete="">
<title>alfred hitchcock</title>
<subtitle>Search Google for alfred hitchcock</subtitle>
<icon>icon.png</icon>
</item>
<item uid="3.1364323823" arg="alfred university" valid="yes" autocomplete="">
<title>alfred university</title>
<subtitle>Search Google for alfred university</subtitle>
<icon>icon.png</icon>
</item>
</items>
and some 2-3 seconds later change the result to (with more information):
<?xml version="1.0"?>
<items>
<item uid="1.1364323984" arg="http://www.alfredapp.com/" valid="yes" autocomplete="">
<title>alfred</title>
<subtitle>alfredapp.com/</subtitle>
<icon>favicons/www.alfredapp.com.png</icon>
</item>
<item uid="2.1364323984" arg="http://en.wikipedia.org/wiki/Alfred_Hitchcock" valid="yes" autocomplete="">
<title>alfred hitchcock</title>
<subtitle>en.wikipedia.org/wiki/Alfred_Hitchcock</subtitle>
<icon>favicons/en.wikipedia.org.png</icon>
</item>
<item uid="3.1364323984" arg="http://www.alfred.edu/" valid="yes" autocomplete="">
<title>alfred university</title>
<subtitle>http://www.alfred.edu/</subtitle>
<icon>favicons/www.alfred.edu.png</icon>
</item>
</items>
I tried sending two results (via standard output) to Alfred but only the first is shown.
Thank you .