add strip

git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1046 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2012-06-10 21:16:22 +00:00
parent 7d1331f1aa
commit 7356e6e220
8 changed files with 217 additions and 3 deletions

View File

@ -1,9 +1,9 @@
Package: webif
Priority: optional
Section: web
Version: 0.9.10-1
Version: 0.9.11
Architecture: mipsel
Maintainer: af123@hummypkg.org.uk
Depends: webif-channelicons(>=1.0.1),mongoose(>=3.0-7),jim(>=0.73-1),jim-oo,jim-sqlite3(>=0.73),jim-cgi(>=0.5),service-control(>=1.2),busybox(>=1.19.3-1),lsof,epg(>=1.0.9),hmt(>=1.1.6),ssmtp,anacron,trm,openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2)
Depends: webif-channelicons(>=1.0.1),mongoose(>=3.0-7),jim(>=0.73-1),jim-oo,jim-sqlite3(>=0.73),jim-cgi(>=0.5),service-control(>=1.2),busybox(>=1.19.3-1),lsof,epg(>=1.0.9),hmt(>=1.1.6),ssmtp,anacron,trm,openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2),stripts
Suggests: ffmpeg,webif-iphone
Description: An evolving web interface for the Humax.

View File

@ -100,16 +100,19 @@ proc entry {file} {{i 0}} {
set type ts
set ts [ts fetch $file 1]
set img Video_TS
set omenu opt
} elseif {$ext eq ".hmt"} {
if {[file exists "${base}.ts"]} { continue }
# Sole hmt file indicates failure to track.
set type bad
set ts 0
set img Video_Failed
set omenu oopt
} else {
set type gen
set ts 0
set img Video_Other
set omenu oopt
}
set new 0
@ -194,7 +197,7 @@ proc entry {file} {{i 0}} {
puts "
<a href=#>
<img class=\"opt va\" border=0 width=45 type=$type did=$i
<img class=\"$omenu va\" border=0 width=45 type=$type did=$i
locked=$locked encd=$encd def=$def new=$new bx=$bx
rsize=$rsz
odencd=$odencd dlna=$dlna

View File

@ -15,6 +15,9 @@ puts {
}
if {$model eq "HDR"} {
puts { <li class="separator"><a href=#decrypt>Decrypt</a></li> }
puts { <li class="cut"><a href=#strip>Strip</a></li> }
} else {
puts { <li class="cut separator"><a href=#strip>Strip</a></li> }
}
if {[system pkginst ffmpeg]} {
puts {
@ -33,6 +36,15 @@ puts {
<li><a href=#new>Toggle New</a></li>
</ul>
<ul id=ooptmenu class=contextMenu style="width: 160px">
<li class=delete><a href=#delete>Delete</a></li>
<li class=cut><a href=#cut>Cut to clipboard</a></li>
<li class=pwcopy><a href=#copy>Copy to clipboard</a></li>
<li class=separator><a href=#rename>Rename</a></li>
<li><a href=#download>Download</a></li>
</ul>
<ul id=doptmenu class=contextMenu style="width: 160px">
<li class=delete><a href=#delete>Delete</a></li>
<li class=cut><a href=#cut>Cut to clipboard</a></li>

View File

@ -218,6 +218,11 @@ function preparemenu(el, menu)
else
$(menu).disableContextMenuItems('#crop');
if (el.attr('def') == 'HD')
$(menu).disableContextMenuItems('#strip');
else
$(menu).enableContextMenuItems('#strip');
if (el.attr('rsize') > 4294967296)
$(menu).enableContextMenuItems('#chunk');
else
@ -268,6 +273,7 @@ function preparemenu(el, menu)
$(menu).disableContextMenuItems('#audio');
$(menu).disableContextMenuItems('#mpg');
$(menu).disableContextMenuItems('#crop');
$(menu).disableContextMenuItems('#strip');
$(menu).disableContextMenuItems('#chunk');
}
@ -357,6 +363,11 @@ var menuclick = function(action, el, pos)
file;
break;
case 'strip':
window.location.href = '/cgi-bin/browse/strip/strip.jim?file=' +
file;
break;
case 'chunk':
window.location.href = '/cgi-bin/browse/chunk/chunk.jim?file=' +
file;
@ -457,6 +468,16 @@ var dmenuclick = function(action, el, pos)
menuclick
);
// Bind context menu to opt+ image
$('img.oopt').contextMenu(
{
menu: 'ooptmenu',
leftButton: true,
beforeShow: preparemenu
},
menuclick
);
$('img.dopt').contextMenu(
{
menu: 'doptmenu',

View File

@ -0,0 +1,52 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
require ts.class pretty_size
puts "Content-Type: text/html\r\n\r\n"
cgi_input
#cgi_dump
set rfile [cgi_get file]
set ts [ts fetch $rfile]
set dir [file dirname $rfile]
set len [$ts duration 1]
set stripstart [clock milliseconds]
set base [file rootname $rfile]
set origdir "$dir/_original"
if {![file exists $origdir]} { file mkdir $origdir }
set shname [file tail $base]
puts "Processing $shname"
if {[file exists "$origdir/$shname.ts"]} {
puts "This recording already exists within _original"
puts "Cannot continue."
exit
}
puts "Moving recording to $origdir"
foreach f [glob -nocomplain "${base}.*"] {
set tail [file tail $f]
puts " $tail"
file rename $f "$origdir/$tail"
}
puts [exec /mod/bin/stripts \
"$origdir/$shname" \
"$dir/$shname" \
]
set newname "$shname-[clock seconds]"
puts "Renaming file group to $newname"
ts renamegroup "$dir/$shname.ts" $newname
exec /mod/bin/hmt "+setfilename=$newname" "$dir/$newname.hmt"
set striptime [expr [expr [clock milliseconds] - $stripstart] / 1000.0]
puts "Time taken: $striptime"

View File

@ -0,0 +1,27 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
require ts.class
puts "Content-Type: text/html\r\n\r\n"
cgi_input
#cgi_dump
set tsfile [file normalize [cgi_get file]]
set ntsfile "[file rootname $tsfile].nts"
set origfile "[file dirname $tsfile]/_original/[file tail $ntsfile]"
if {![file exists $ntsfile]} {
puts "0"
} else {
set sz [file size $origfile]
set nsz [file size $ntsfile]
set perc [expr $nsz * 100 / $sz]
if {$perc > 100} { set perc 100 }
puts $perc
}

View File

@ -0,0 +1,62 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
require ts.class pretty_size
puts "Content-Type: text/html\r\n\r\n"
cgi_input
#cgi_dump
set rfile [cgi_get file]
set ts [ts fetch $rfile]
set dir [file dirname $rfile]
set len [$ts duration 1]
set esttime $([$ts size] / 5700000)
header
puts "
<link href=/css/jquery.progressbar.css rel=stylesheet type=text/css />
<script type=text/javascript src=/js/jquery.progressbar.js></script>
<script type=text/javascript src=strip.js></script>
<fieldset class=cleft>
<legend>Strip unecessary frames from recording</legend>
<p><i>This process will remove freeview EIT packets from the recording.<br>
These packets are not required but typically increase the size of the
recording file by as much as 20%.<br>
Your original recording files will be retained in a folder called _original.
</i>
<table class=keyval cellpadding=5>
<tr><th>File:</th><td>$rfile</td></tr>
<tr><th>Length:</th><td>[clock format $len -format %T]</td></tr>
<tr><th>Size:</th><td>[pretty_size [$ts size]] ([$ts get definition])</td></tr>
<tr><th>Time:</th>
<td>Stripping will take around [clock format $esttime -format "%T"]</td></tr>
</table>
<span class=hidden id=params
file=\"[cgi_quote_url $rfile]\"
dir=\"[cgi_quote_url $dir]\"
></span>
<div id=stripdiv style=\"padding: 1em\">
<button id=stripit>Perform strip operation</button>
</div>
<div id=progressdiv class=hidden>
Stripping: <div id=progressbar></div>
</div>
<button id=back class=hidden>Back to media list</button>
<div id=output class=pre style=\"margin-top: 10px\"></div>
</fieldset>
"

View File

@ -0,0 +1,37 @@
var handle = 0;
function update()
{
var file = $('#params').attr('file');
$.get('progress.jim' + '?file=' + file,
function(data) {
if (handle)
$('#progressbar').reportprogress(data);
});
}
$(document).ready(function() {
$('#progressbar').reportprogress(0);
$('#back').button().click(function() {
window.location = '/cgi-bin/browse.jim?dir=' + $('#params').attr('dir');
});
$('#stripit').button().click(function() {
$('#stripdiv').hide('slow');
$('#progressdiv').show('slow');
handle = setInterval("update()", 1000);
$('#output').text('Please do not interrupt...')
.load('execute.jim?file=' + $('#params').attr('file'),
function() {
clearInterval(handle);
handle = 0;
$('#back').show();
$('#progressbar').reportprogress(100);
});
});
});