You are not logged in.
Pages: 1
I have been trying to figure out how to pipe the percent of curl to dzen widget realtime with no luck so far, is having a stat file the only way? i have seen the uzbl wiki scripts but i dont understand all the code,
i have my browser(surf) to handle my downloads via the following script, i just want to add some kind of notification AND status to it, a place where i can see whats going on. any help would be great thanks
the argumment passed to the script is the url
handler.sh
#!/bin/bash
DOWNLOAD_DIR=/home/user/downloads
cd $DOWNLOAD_DIR
curl -# -o `basename $1` "$1"
#do update percent while not done
#do notify finished
Last edited by exe (2010-09-15 14:34:20)
Offline
You might be able to do something with expect (see http://en.wikipedia.org/wiki/Expect) but I don't know that app.
Otherwise, the problem is that piping the output means that the receiver it only gets the last update - eg 100%. So you do really need to use a file.
Try this (untested will need a tweak or two):
curl -# -o $TARGET $URL > progress 2>&1 &
PID=$!
while ps -A | grep -q $pid; do
REM="$(awk '{print $NF}' progress)"
done
And build from there.
You'll need to do something with REM (check-out OSD_CAT for an alternative way of showing progress), and tidy-up the file, etc.
Last edited by skanky (2010-09-12 21:04:13)
"...one cannot be angry when one looks at a penguin." - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle
Offline
thanks i will give it a go and report back
Offline
so yeah tried and looks like the only option is to write a file, i checked a script over at the uzbl wiki and they handle multiple downloads writing to tmp/file.$PID that way you can keep track of multiple wget/curl instances with ps, i have not decided what to use to download my files, i also tried gwget and is nice as you can add urls from the cli directly into the gui by just calling it with the url and it does notify, however it uses gnome deps wich are quite pig (as in heavy), isnt there a gtk alternative to gwget? thanks in advance.
Offline
Pages: 1