Page 1 of 1

Asynchronous strategies

Posted: November 6th, 2007, 2:29 pm
by bradshaw1965
hey folks,

With the new XML parsing abilities in AE CS3, I've been playing around with parsing web feeds and I've reached the point where I'd like to deal with some enclosures.

I've been following roughly the workflow of

1. set up a socket
2. feed a url to the socket
3. parse the xml and gather urls
4. feed the urls to system.callSystem('curl -O ' + photoUrl);

5. download and wait a bit

6. import and do stuff with the downloads

It's the wait a bit that I'm struggling a bit with. The downloads come down asynchronously and I have limited communication with the task on callSystem().

I guess I could launch a shell script, but I don't think I really have calllback capability. I could launch the task and wait in a while loop, set an internal timeout and if I don't accomplish my task, bail. Do all of this stuff server side and just check for completion at an interval.

Lots of possibilities. How are you folks handling asynchronous tasks with potientially leaky network communication and a scripting environment more set up for synchronous communication.

Posted: December 5th, 2007, 6:08 am
by Darkmoon_UK
Its a tricky one. I haven't been in the same situation just yet, though I am presently experiencing the joys of trying to get Java to talk to JavaScript via TCP.

I don't know what kind of output curl gives you on the commandline, but one idea would be to pipe that to a file which your AE script then continuously reads to get some kind of feedback on progress.

e.g.

Code: Select all

curl -O photourl >c:\curlProgress.txt

Posted: December 5th, 2007, 7:28 am
by bradshaw1965
Hey Darkmoon,

That's a good idea.

In general, I wish we had a user thread that was non-blocking. I'm struggling with both asynch and user feedback stuff. If there was a non-blocking event listener with a useful polling event we could marshal scripts a lot more efficently.

Off to do a feature request...

Dale