diff options
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | getabook.c | 1 | ||||
-rw-r--r-- | getbnbook.c | 1 | ||||
-rw-r--r-- | getgbook.c | 1 | ||||
-rwxr-xr-x | getxbookgui.tcl | 17 |
5 files changed, 18 insertions, 4 deletions
@@ -1,5 +1,3 @@ getxbookgui, check whether the input box starts http and if so check against url patterns -print number of pages (which may be) available in 1st line of output from tools, and use that to generate a progress bar (even if not perfect, still good). - submit 'pad' file to websites http://padsites.asp-software.org/ @@ -211,6 +211,7 @@ int main(int argc, char *argv[]) if(pages[i]->url[0] == '\0') getpageurls(pages[i]->num); getpage(pages[i]); + printf("%.0f%% done\n", (float)i / (float)numpages * 100); } } else if(argv[1][0] == '-' && argv[1][1] == 'n') { while(fgets(buf, BUFSIZ, stdin)) { diff --git a/getbnbook.c b/getbnbook.c index a10d98e..6fa247f 100644 --- a/getbnbook.c +++ b/getbnbook.c @@ -136,6 +136,7 @@ int main(int argc, char *argv[]) continue; } getpage(pages[i]); + printf("%.0f%% done\n", (float)i / (float)numpages * 100); } } else if(argv[1][0] == '-' && argv[1][1] == 'n') { while(fgets(buf, BUFSIZ, stdin)) { @@ -214,6 +214,7 @@ int main(int argc, char *argv[]) } searchpage(pages[i]); getpage(pages[i]); + printf("%.0f%% done\n", (float)i / (float)numpages * 100); } } else if(argv[1][0] == '-') { while(fgets(buf, BUFSIZ, stdin)) { diff --git a/getxbookgui.tcl b/getxbookgui.tcl index 06cf3c7..f7135df 100755 --- a/getxbookgui.tcl +++ b/getxbookgui.tcl @@ -19,12 +19,20 @@ proc updateStatus {chan} { global dling if {![eof $chan]} { set a [gets $chan] - if { $a != "" } { .st configure -text $a } + if { $a != "" } { + if { [string match "*%*" "$a"] } { + if { [regexp {^([0-9]*)} $a m num] } { + .prog coords bar 0 0 [expr $num * 2] 20 + } + } else { .st configure -text $a } + } } else { if { ! [catch {close $chan}] } { .st configure -text "[.input.id get] Done" + .prog coords bar 0 0 200 20 } .dl configure -state normal -text "Download" + .input.id configure -state normal set dling 0 } } @@ -35,7 +43,9 @@ proc go {} { set cmd "[lindex [lindex $cmds $cmdselected] 0] [.input.id get]" set dling 1 .dl configure -state disabled -text "Downloading" + .input.id configure -state readonly .st configure -text "" + .prog coords bar 0 0 0 20 set out [open "|$cmd 2>@1" "r"] fileevent $out readable [list updateStatus $out] } @@ -102,10 +112,13 @@ foreach b $cmds { button .dl -text "Download" -command go label .st +canvas .prog -width 200 -height 20 -relief sunken -bd 1 +.prog create rectangle 0 0 0 20 -tags bar -fill black + pack .input.lab -side left pack .input.id -pack .cmdfr .input .dl .st +pack .cmdfr .input .dl .prog .st bind . <Return> go bind .input.id <Key> {set manual 1} |