View Single Post
Posts: 72 | Thanked: 53 times | Joined on Jan 2012 @ Berlin, Germany
#16
Hi, thanks for the great plugin! I wanted to create my own plugin for sharing pics in my custom blog software and with this I just need to write a simple script!

It would be really nice to be able to report the progress via stdout, for example, this script should show an advance of 10% each second:

Code:
#!/bin/sh
for i in `seq 0.0 0.1 1.0`
do
    sleep 1
    echo $i
done
If I have some time I will implement it myself, but I'm not familiar with sharing plug-ins and glib (which I saw you use to spawn the process).

I've been investigating a little and I think I'll have to use g_spawn_async_with_pipes() + g_shell_parse_argv() and a glib event loop (or there is one already?) instead of the simpler g_spawn_command_line_sync() in use now.

My idea is to just read the stdout pipe line by line and try to convert each line to a float and if the conversion succeeded, just call sharing_transfer_set_progress() with the new value.

What do you think?