#!/mod/bin/jimsh package require cgi source /mod/webif/lib/setup require ts.class pretty_size jqplugin progressbar jscss crop.js header set rfile [cgi_get file] set ts [ts fetch $rfile] set dir [file dirname $rfile] set len [$ts duration 1] puts "
Crop recording
File:$rfile
Length:[clock format $len -format \"%T\"]
Size:[pretty_size [$ts size]] ([$ts get definition])
Bookmarks:[$ts get bookmarks] @ " set flag 0 foreach b [$ts bookmarks] { if $flag { puts -nonewline ", " } incr flag puts -nonewline [clock format $b -format "%T"] } puts "
File" puts "
" proc div {type left right} { set width $($right - $left) puts "
$type
" } set keeping 0 set last 0 set start -1 foreach b [$ts bookmarks] { if {$start < 0} { set start $b continue } set end $b incr keeping $($end - $start) set left $($start * 500 / $len) set right $($end * 500 / $len) div cut $last $($left - 1) div keep $left $($right - 1) set last $right set start -1 } if {$start > 0} { incr keeping $($len - $start) set left $($start * 500 / $len) div cut $last $($left - 1) div keep $left 500 } else { div cut $last 500 } set keepperc $($keeping * 100.0 / $len) set esttime $(int($keeping * 0.025)) if {[$ts get definition] eq "HD"} { set esttime $($esttime * 4) } puts "
Keeping: [clock format $keeping -format "%T"] ([format "%.2f" $keepperc]%)
Time: Cropping will take around [clock format $esttime -format "%T"]
"