Ftp after render

What type of scripts do you need?

Moderator: byronnash

Teeling

January 20th, 2005, 10:48 am

fairly often I have to wait for a render just to ftp it up to a clients or my own ftp servers.
I haven't had time to look up if it would be possible to run console commands or so in After Effects scripting, but if thats possible I guess it would be fairly easy to adapt the render and email script that comes with AE.
One day when I have time I'll look in to it, but for now maybe somebody else would like to check it out?

-Micke Teeling
User avatar
Disciple
Posts: 137
Joined: June 5th, 2004, 8:05 am
Location: Los Angeles, CA
Contact:

January 20th, 2005, 11:26 am

Hey Micke

Funny you would request that, as it is apparently something many people want. You may want to check out what Byron already started developping in that regard.
Unfortunately the FTP part is quite complicated. It requires using the Socket Object, that is very poorly documented, and establishing a communication with the remote server to send commands and receive feedback.

I'm sure Impudent can chime in on this as he has been working on some tests to get the socket object to work.

If you have any suggestions, would be great to hear them.

Alex
Guest

January 20th, 2005, 7:28 pm

As far as ftp goes, I wonder if you couldn't write and execute a bat file(windows) or a sh(?) file(mac) that uploads to an ftp. If you could glean the file path and your ftp info stayed relatively static, I think that would be possible without the socket object right?
User avatar
Disciple
Posts: 137
Joined: June 5th, 2004, 8:05 am
Location: Los Angeles, CA
Contact:

January 21st, 2005, 12:36 am

Sounds like a good idea. However I haven't seen any scripts correctly write and launch and .sh file on a mac...
Alex
Teeling

January 21st, 2005, 2:40 am

If its possible to launch other stuff from AE scripting it should be fairly easy. I havent looked more than a few minutes (and that was a while ago), but I couldnt find any way of launching or executing commands. An idea that would be fairly simple (but not as clean) would be to have a little AE helper program running in the background that listens to a socket and executes stuff that AE sends in.
I have done this kind of things with the koala lumpur socket object (and AEs looks very similar, at least to me), and that works just fine!
If one could only find the time to work a little on something like this! ;-)

-Micke Teeling
Impudent1
Posts: 57
Joined: June 12th, 2004, 6:40 pm

January 22nd, 2005, 11:35 am

I have been trying to get it to telnet or link to mysql as mentioned with not a great success. I will take a look at ftp and see if it will go.
vidpat
Posts: 86
Joined: October 21st, 2004, 12:36 am
Location: Phoenix, AZ
Contact:

January 24th, 2005, 12:48 am

I had some free time on Saturday so I decided to try my hand at the FTP script. Below you will find what I came up with. I have not tested it rigorously. However, it does seem to work.

I was surprised that there doesn't seem to be a way to launch a shell script from an AE script. Thus, I implemented a simple FTP client script.

When RenderFTP.jsx is run, the user is prompted for FTP information and then all enqueued render items are rendered and subsequently uploaded to the specified server. For detailed usage, please read the comments.

Please let me know of any comments, bugs (I am sure there will be many), etc. I hope you find this of some use.

RenderFTP.jsx
Render queue items are rendered and uploaded to an FTP server.
Download RenderFTP.jsx.

Dependencies:

(lib)/FTPConnection.jsx
A simple FTP client implementation using Adobe JavaScript Sockets.
Download FTPConnection.jsx.

(lib)/UILayout.jsx
A rudimentary layout manager for Adobe JavaScript UIs.
Download UILayout.jsx if you haven't already.
User avatar
Disciple
Posts: 137
Joined: June 5th, 2004, 8:05 am
Location: Los Angeles, CA
Contact:

January 24th, 2005, 3:50 am

Hey VidPat

Just tried launching the script on a mac. I put the main script in a folder, and created a (lib) folder inside this main folder. When I run the script with one item in the render queue, nothing happens. No error, no prompt, nada. I had tried running the script with the dependencies in the same folder as the RenderFTP.jsx, and that gave an error ("script not found" for the two dependency scripts).

Any ideas what could be going wrong?

Alex
vidpat
Posts: 86
Joined: October 21st, 2004, 12:36 am
Location: Phoenix, AZ
Contact:

January 24th, 2005, 12:59 pm

That's not good. I can't think of anything that would cause this. In any nominal situation, the script would pop up something. If there are no queued render items, it would tell you otherwise it would prompt you for FTP settings. If it didn't find the scripts upon which it depends, it would warn you, as well. I don't see a path where something wouldn't pop up. If the scripting IO features were disabled (which they probably aren't) or if there was an error, AE would complain with an alert or the debugger.

Maybe it's something wrong with the file itself. The only possible difference I could imagine running it on a Mac would be the bare line feeds in UI/alert() strings but that's never been a problem for me before. Even then, it shouldn't keep the script from running, just improperly formatting the text.

I'm sorry it doesn't seem to be working. I'm stumped for now. I'll keep looking at the code to see if I can come up with anything. If anyone else tries it and has success or difficulty, please let me know as it might help hone in on the problem.

Peter
Impudent1
Posts: 57
Joined: June 12th, 2004, 6:40 pm

January 24th, 2005, 2:17 pm

First off..
*Napolean Dynamite voice on*

Dude you have like, mad scripting skills

*Napolean Dynamite voice off*

I am totally trying to figure out how the heck you have gotten this socket to read things that I just could not seem to get into ae other than blank replies.

I did a quick test and yes the script did work as promised on windows side up to the ftp connect. I had set it as anonymous and it dropped with a could not find this.connect.

I quick edited line 92 to read this.open instead of this.connect and it didnt err but did not do the connection/upload.

I have to run for a bit but I will definately try to dissect this when I return. I wouldnt mind picking your brain about how you got some of these replies. Definately excited to get this and perhaps springboard that pesky mySQL connection monkey off the back :)

Imp
vidpat
Posts: 86
Joined: October 21st, 2004, 12:36 am
Location: Phoenix, AZ
Contact:

January 24th, 2005, 4:26 pm

Oops. That's what I get for renaming functions half way through. I correct line 92 of FTPConnection.jsx, as you have done, for future downloads. Thanks for letting me know.

I didn't have an anonymous FTP server to try it with, so I just put that functionality in on the chance that it would work. However, I set up an anonymous server today to try it and I think I have found the problem. The server occasionally sent some extra linefeeds which confuse my client. The server I was testing on before didn't do this so everything worked as expected.

Ignoring blank lines should be simple. However, when I do that I get caught in an infinite loop where the server is waiting for the file and the client is waiting for the server before sending the file. Something like select() or timeOut(), i.e. some sort of interrupt, would fix this but, alas, there is none.

Right now, the script should work on Windows and if your server doesn't send blank lines. I still don't know what would keep it from running on a Mac. I'll keep working at it. Stay tuned.

Peter
User avatar
Disciple
Posts: 137
Joined: June 5th, 2004, 8:05 am
Location: Los Angeles, CA
Contact:

January 24th, 2005, 5:05 pm

Wow, it just worked on another machine, same system

Maybe there was something wrong with my airport connection at the moment I tried it with my laptop, but here on my ethernet connected machine it works just fine.

This is AMAZING.

Do you see any way we could interface this with Byron's Render and FTP scripts?

Also, any way we could have some sort of live transcript of what is going on via your FTP client?

Thanks a lot Peter, this is really really great, as is.

Alex
Shinjipierre
Posts: 36
Joined: December 4th, 2004, 10:10 am

January 24th, 2005, 5:21 pm

Huumm... It seems really interesting, I was still wondering how sockets worked.

I'll try it tomorrow ^^
vidpat
Posts: 86
Joined: October 21st, 2004, 12:36 am
Location: Phoenix, AZ
Contact:

January 24th, 2005, 7:21 pm

I'm glad everyone seems to be pleased with the script... even before it worked. Thanks for your confidence.

Download the new version of FTPConnection.jsx which I have now had good luck with on several servers. Based on Disciple's latest report, all should be well in the Mac world. Also, I fixed the issue with servers that send extra lines which I believe was the problem Impudent experienced. Things might also run a bit faster, too.

I haven't looked much at Byron's script, but I shall. I imagine it would be possible to integrate FTPConnection.

As for logging the transfer:
The constructor for FTPConnection takes a boolean. When true, FTPConnection writes what's going on in the info palette. Of course, it goes by too quickly and the space is too small for it to be of much use. You could change RenderFTP.jsx to pass true to the constructor and enable this.

There is also some functionality for a log file in FTPConnection.jsx that I used while debugging. There is a variable _FTPC_DO_LOG that, when set to true, will create a log file at _FTPC_LOG_FILE that will contain a transcript of the entire FTP session. The interpreter doesn't seem to flush the write buffer often so the log probably won't appear until after the script is run successfully.

I am tempted to add a dialog that will display the session live (and maybe a progress bar?) but that would involve putting UI code in with FTPConnection which wouldn't be a pretty solution. I'll probably end up doing it eventually.

I hope that it all works better, now. Keep letting me know of any problems/suggestions/bugs.

Peter
Guest

January 25th, 2005, 3:15 pm

Well I did get a few mins to look at the code/update.

It does not upload files here if logged in anonymously or with user. Trapping the logfile gives :

+220 makedname Microsoft FTP Service (Version 5.0).
:USER anonymous
+331 Anonymous access allowed, send identity (e-mail name) as password.
:PASS aescript@
+230 Anonymous user logged in.
:TYPE I
+200 Type set to I.
:QUIT
+221

so it looks like it is passing the login stuff fine just not the put.

And I think what totally makes sense to why I was struggling with this was being a bit tunnel visioned and ASSuming that it would just be like phone. aka bidirectional , without worry of cross talk :P . From your script I see that it works by using one way pipes for talk and listen like walkie talkies :)

Imp
Post Reply