updates for HD cropping

git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@514 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2011-11-16 22:55:06 +00:00
parent 8cc2ef3d3f
commit df67594f29
3 changed files with 19 additions and 11 deletions

View File

@ -131,9 +131,9 @@ function preparemenu(el, menu)
else else
$(menu).changeContextMenuItem('#enc', $(menu).changeContextMenuItem('#enc',
'Set Enc'); 'Set Enc');
$('#optmenu').disableContextMenuItems('#crop');
} }
else if (el.attr('bx') > 0)
if (el.attr('bx') > 0)
$('#optmenu').enableContextMenuItems('#crop'); $('#optmenu').enableContextMenuItems('#crop');
else else
$('#optmenu').disableContextMenuItems('#crop'); $('#optmenu').disableContextMenuItems('#crop');

View File

@ -65,7 +65,7 @@ puts "
<table class=keyval cellpadding=5> <table class=keyval cellpadding=5>
<tr><th>File:</th><td>$rfile</td></tr> <tr><th>File:</th><td>$rfile</td></tr>
<tr><th>Length:</th><td>[clock format $len -format "%T"]</td></tr> <tr><th>Length:</th><td>[clock format $len -format "%T"]</td></tr>
<tr><th>Size:</th><td>[pretty_size [$ts size]]</td></tr> <tr><th>Size:</th><td>[pretty_size [$ts size]] ([$ts get definition])</td></tr>
<tr><th>Bookmarks:</th><td>[$ts get bookmarks] @ " <tr><th>Bookmarks:</th><td>[$ts get bookmarks] @ "
set flag 0 set flag 0
@ -119,6 +119,7 @@ if {$start > 0} {
set keepperc $($keeping * 100.0 / $len) set keepperc $($keeping * 100.0 / $len)
set esttime $(int($keeping * 0.025)) set esttime $(int($keeping * 0.025))
if {[$ts get definition] eq "HD"} { set esttime $($esttime * 4) }
puts " puts "
</div> </div>
@ -131,16 +132,16 @@ puts "
</table> </table>
" "
puts { puts "
<div id=cropdiv> <div id=cropdiv>
<button id=cropit>Perform crop operation</button> <button id=cropit>Perform crop operation</button>
</div> </div>
<div id=progressdiv style="display: none"> <div id=progressdiv style=\"display: none\">
Cropping: <div id=progressbar></div> Cropping: <div id=progressbar></div>
} <button id=back
puts "<button id=back
dir=\"[cgi_quote_url $dir]\" dir=\"[cgi_quote_url $dir]\"
rfile=\"[cgi_quote_url $rfile]\" rfile=\"[cgi_quote_url $rfile]\"
perc=\"$keepperc\"
style=\"display: none\">Back to media list</button>" style=\"display: none\">Back to media list</button>"
puts { puts {
<div id=output class=pre style="margin-top: 10px"></div> <div id=output class=pre style="margin-top: 10px"></div>
@ -152,8 +153,10 @@ var handle = 0;
function update() function update()
{ {
$.get('/cgi-bin/browse/crop_progress.jim?file=' $.get('/cgi-bin/browse/crop_progress.jim'
+ $('#back').attr('rfile'), function(data) { + '?perc=' + $('#back').attr('perc')
+ '&file=' + $('#back').attr('rfile'),
function(data) {
if (handle) if (handle)
$('#progressbar').reportprogress(data); $('#progressbar').reportprogress(data);
}); });
@ -172,7 +175,8 @@ $('#cropit').button().click(function() {
$('#progressdiv').show('slow'); $('#progressdiv').show('slow');
handle = setInterval("update()", 1000); handle = setInterval("update()", 1000);
$('#output').text('Please do not interrupt...') $('#output').text('Please do not interrupt...')
.load(document.URL + '&do=it', function() { .load(document.URL + '&do=it',
function() {
clearInterval(handle); clearInterval(handle);
handle = 0; handle = 0;
$('#back').show(); $('#back').show();

View File

@ -9,6 +9,7 @@ puts "Content-Type: text/html\r\n\r\n"
cgi_input cgi_input
#cgi_dump #cgi_dump
set perc [cgi_get perc 100]
set tsfile [file normalize [cgi_get file]] set tsfile [file normalize [cgi_get file]]
set origfile "[file dirname $tsfile]/_original/[file tail $tsfile]" set origfile "[file dirname $tsfile]/_original/[file tail $tsfile]"
@ -18,8 +19,11 @@ if {![file exists $newfile]} {
puts "0" puts "0"
} else { } else {
set sz [file size $origfile] set sz [file size $origfile]
set expected $($sz / 100 * $perc)
set nsz [file size $newfile] set nsz [file size $newfile]
puts [expr $nsz * 100 / $sz] set perc [expr $nsz * 100 / $expected]
if {$perc > 100} { set perc 100 }
puts $perc
} }