Curl, youtube & a progress bar...

I am trying to create a progressbar which shows how long it takes to download a youtube movie to my desktop.

I use this for the download process:

do shell script "curl -L " & quoted form of downloadURL & " -o " & POSIX path of outputFile & “> /dev/null 2>&1 & echo $!”

“curl -L " & quoted form of downloadURL = download location of the youtube movie
& POSIX path of outputFile = location on my drive
/dev/null 2>&1 & echo $!” = shell script job runs in background, so script continous immediatly & gives a code (pid) back

I found out that Curl has its own progress code but can’t find anything more than:

PROGRESS METER

The progress meter exists to show a user that something actually is
happening. The different fields in the output have the following meaning:

% Total % Received % Xferd Average Speed Time Curr.
Dload Upload Total Current Left Speed
0 151M 0 38608 0 0 9406 0 4:41:43 0:00:04 4:41:39 9287

From left-to-right:
% - percentage completed of the whole transfer
Total - total size of the whole expected transfer
% - percentage completed of the download
Received - currently downloaded amount of bytes
% - percentage completed of the upload
Xferd - currently uploaded amount of bytes
Average Speed
Dload - the average transfer speed of the download
Average Speed
Upload - the average transfer speed of the upload
Time Total - expected time to complete the operation
Time Current - time passed since the invoke
Time Left - expected time left to completion
Curr.Speed - the average transfer speed the last 5 seconds (the first
5 seconds of a transfer is based on less time of course.)

The -# option will display a totally different progress bar that doesn’t
need much explanation!

Well it does :wink:

Anyone any experience or can help me out with some nice tricks ??

Kemalski

anyone ?

is stdout what i need to fix this ?

http://forum.soft32.com/mac/reading-stdin-writing-stdout-script-ftopict39285.html

http://macscripter.net/viewtopic.php?id=27232

for me this is abacadabra so anyone that can piont me in the right direction or has some example code snippet…

thanks in advance!

KS

Hi,

You need to redirect output of the curl of do shell script on file and on idle parse the output file and update the progress bar.

Hagimeno

Hagimeno,

Can you give me an example how to do this ?

Kemalski