2011-11-04 13:38:48 +00:00
|
|
|
#!/mod/bin/jimsh
|
|
|
|
|
|
|
|
package require cgi
|
2012-05-21 20:23:41 +00:00
|
|
|
source /mod/webif/lib/setup
|
2011-11-04 13:38:48 +00:00
|
|
|
require ts.class
|
|
|
|
|
2013-02-09 22:46:15 +00:00
|
|
|
httpheader
|
2011-11-04 13:38:48 +00:00
|
|
|
|
2011-11-16 22:55:06 +00:00
|
|
|
set perc [cgi_get perc 100]
|
2011-11-04 20:47:27 +00:00
|
|
|
set tsfile [file normalize [cgi_get file]]
|
2011-11-04 13:38:48 +00:00
|
|
|
|
2011-11-04 20:47:27 +00:00
|
|
|
set origfile "[file dirname $tsfile]/_original/[file tail $tsfile]"
|
|
|
|
set newfile [file rootname $tsfile]
|
|
|
|
|
|
|
|
if {![file exists $newfile]} {
|
2011-11-04 13:38:48 +00:00
|
|
|
puts "0"
|
|
|
|
} else {
|
2011-11-04 20:47:27 +00:00
|
|
|
set sz [file size $origfile]
|
2011-11-16 22:55:06 +00:00
|
|
|
set expected $($sz / 100 * $perc)
|
2011-11-04 20:47:27 +00:00
|
|
|
set nsz [file size $newfile]
|
2011-11-04 13:38:48 +00:00
|
|
|
|
2011-11-16 22:55:06 +00:00
|
|
|
set perc [expr $nsz * 100 / $expected]
|
|
|
|
if {$perc > 100} { set perc 100 }
|
|
|
|
puts $perc
|
2011-11-04 13:38:48 +00:00
|
|
|
}
|
|
|
|
|