forked from hummypkg/webif
add audio extraction
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@554 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
parent
b6ce0e3b16
commit
25344c5ff4
@ -1,7 +1,7 @@
|
|||||||
Package: webif
|
Package: webif
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: web
|
Section: web
|
||||||
Version: 0.8.4-1
|
Version: 0.8.5
|
||||||
Architecture: mipsel
|
Architecture: mipsel
|
||||||
Maintainer: af123@hummypkg.org.uk
|
Maintainer: af123@hummypkg.org.uk
|
||||||
Depends: mongoose(>=3.0-2),jim(>=0.71-1),jim-sqlite3(>=0.71-1),jim-cgi(>=0.4-1),jim-oo,jim-pack,service-control,busybox(>=1.19.3-1),lsof,epg(>=1.0.8),hmt(>=1.1.1),ssmtp,anacron
|
Depends: mongoose(>=3.0-2),jim(>=0.71-1),jim-sqlite3(>=0.71-1),jim-cgi(>=0.4-1),jim-oo,jim-pack,service-control,busybox(>=1.19.3-1),lsof,epg(>=1.0.8),hmt(>=1.1.1),ssmtp,anacron
|
||||||
|
@ -184,6 +184,9 @@ puts {
|
|||||||
if {[system model] eq "HDR"} {
|
if {[system model] eq "HDR"} {
|
||||||
puts { <li class="separator"><a href=#decrypt>Decrypt</a></li> }
|
puts { <li class="separator"><a href=#decrypt>Decrypt</a></li> }
|
||||||
}
|
}
|
||||||
|
if {[system pkginst ffmpeg]} {
|
||||||
|
puts { <li><a href=#audio>Extract Audio</a></li> }
|
||||||
|
}
|
||||||
if $nicesplice {
|
if $nicesplice {
|
||||||
puts { <li class="cut separator"><a href=#crop>Crop</a></li> }
|
puts { <li class="cut separator"><a href=#crop>Crop</a></li> }
|
||||||
}
|
}
|
||||||
|
100
var/mongoose/cgi-bin/browse/audio.jim
Executable file
100
var/mongoose/cgi-bin/browse/audio.jim
Executable file
@ -0,0 +1,100 @@
|
|||||||
|
#!/mod/bin/jimsh
|
||||||
|
|
||||||
|
package require sqlite3
|
||||||
|
package require cgi
|
||||||
|
source /mod/var/mongoose/lib/setup
|
||||||
|
require ts.class
|
||||||
|
|
||||||
|
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]
|
||||||
|
|
||||||
|
if {[cgi_get do] eq "it"} {
|
||||||
|
set xstart [clock milliseconds]
|
||||||
|
|
||||||
|
set base [file rootname $rfile]
|
||||||
|
set shname [file tail $base]
|
||||||
|
puts "Processing $shname"
|
||||||
|
|
||||||
|
puts [exec /mod/bin/ffmpeg -y -benchmark -v 0 \
|
||||||
|
-i $rfile -f mp2 \
|
||||||
|
-vn -acodec copy "${base}.mp3"]
|
||||||
|
|
||||||
|
set xtime [expr [expr [clock milliseconds] - $xstart] / 1000.0]
|
||||||
|
puts "Time taken: $xtime"
|
||||||
|
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
header
|
||||||
|
|
||||||
|
puts "
|
||||||
|
<link href=/css/jquery.progressbar.css rel=stylesheet type=text/css />
|
||||||
|
<script type=\"text/javascript\" src=\"/js/jquery.progressbar.js\"></script>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
</table>
|
||||||
|
"
|
||||||
|
|
||||||
|
puts {
|
||||||
|
|
||||||
|
<div style="margin-top: 10px"></div>
|
||||||
|
<div id=audiodiv><button id=audioit>Perform audio extraction</button></div>
|
||||||
|
<div id=progressdiv style="display: none">
|
||||||
|
Extracting audio: <div id=progressbar></div>
|
||||||
|
}
|
||||||
|
puts "<button id=back
|
||||||
|
dir=\"[cgi_quote_url $dir]\"
|
||||||
|
rfile=\"[cgi_quote_url $rfile]\"
|
||||||
|
style=\"display: none\">Back to media list</button>"
|
||||||
|
puts {
|
||||||
|
<div id=output class=pre style="margin-top: 10px"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script type=text/javascript>
|
||||||
|
|
||||||
|
var handle = 0;
|
||||||
|
|
||||||
|
function update()
|
||||||
|
{
|
||||||
|
$.get('/cgi-bin/browse/audio_progress.jim?file='
|
||||||
|
+ $('#back').attr('rfile'), function(data) {
|
||||||
|
if (handle)
|
||||||
|
$('#progressbar').reportprogress(data);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
$('#progressbar').reportprogress(0);
|
||||||
|
|
||||||
|
$('#back').button().click(function() {
|
||||||
|
window.location = '/cgi-bin/browse.jim?dir=' + $(this).attr('dir');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#audioit').button().click(function() {
|
||||||
|
$('#audiodiv').hide('slow');
|
||||||
|
$('#progressdiv').show('slow');
|
||||||
|
handle = setInterval("update()", 1000);
|
||||||
|
$('#output').load(document.URL + '&do=it', function() {
|
||||||
|
clearInterval(handle);
|
||||||
|
handle = 0;
|
||||||
|
$('#back').show();
|
||||||
|
$('#progressbar').reportprogress(100);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
}
|
||||||
|
|
26
var/mongoose/cgi-bin/browse/audio_progress.jim
Executable file
26
var/mongoose/cgi-bin/browse/audio_progress.jim
Executable file
@ -0,0 +1,26 @@
|
|||||||
|
#!/mod/bin/jimsh
|
||||||
|
|
||||||
|
package require cgi
|
||||||
|
source /mod/var/mongoose/lib/setup
|
||||||
|
require ts.class
|
||||||
|
|
||||||
|
puts "Content-Type: text/html\r\n\r\n"
|
||||||
|
|
||||||
|
cgi_input
|
||||||
|
#cgi_dump
|
||||||
|
|
||||||
|
set tsfile [cgi_get file]
|
||||||
|
set rfile [file normalize $tsfile]
|
||||||
|
set bfile [file rootname $rfile]
|
||||||
|
|
||||||
|
if {![file exists "${bfile}.mp3"]} {
|
||||||
|
puts "0"
|
||||||
|
} else {
|
||||||
|
set sz [file size $rfile]
|
||||||
|
set nsz [expr [file size "${bfile}.mp3"] / 0.3]
|
||||||
|
|
||||||
|
set perc [expr $nsz * 100 / $sz]
|
||||||
|
if {$perc > 100} { set perc 100 }
|
||||||
|
puts $perc
|
||||||
|
}
|
||||||
|
|
@ -193,9 +193,15 @@ function preparemenu(el, menu)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (el.attr('odencd') == 1)
|
if (el.attr('odencd') == 1)
|
||||||
|
{
|
||||||
$('#optmenu').enableContextMenuItems('#decrypt');
|
$('#optmenu').enableContextMenuItems('#decrypt');
|
||||||
|
$('#optmenu').disableContextMenuItems('#audio');
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
$('#optmenu').disableContextMenuItems('#decrypt');
|
$('#optmenu').disableContextMenuItems('#decrypt');
|
||||||
|
$('#optmenu').enableContextMenuItems('#audio');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -205,6 +211,7 @@ function preparemenu(el, menu)
|
|||||||
$('#optmenu').disableContextMenuItems('#enc');
|
$('#optmenu').disableContextMenuItems('#enc');
|
||||||
$('#optmenu').disableContextMenuItems('#new');
|
$('#optmenu').disableContextMenuItems('#new');
|
||||||
$('#optmenu').disableContextMenuItems('#decrypt');
|
$('#optmenu').disableContextMenuItems('#decrypt');
|
||||||
|
$('#optmenu').disableContextMenuItems('#audio');
|
||||||
$('#optmenu').disableContextMenuItems('#crop');
|
$('#optmenu').disableContextMenuItems('#crop');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -275,6 +282,11 @@ var menuclick = function(action, el, pos)
|
|||||||
encodeURIComponent(file);
|
encodeURIComponent(file);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'audio':
|
||||||
|
window.location.href = '/cgi-bin/browse/audio.jim?file=' +
|
||||||
|
encodeURIComponent(file);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
alert('Unhandled action: ' + action);
|
alert('Unhandled action: ' + action);
|
||||||
break;
|
break;
|
||||||
|
@ -9,8 +9,7 @@ puts "Content-Type: text/html\r\n\r\n"
|
|||||||
cgi_input
|
cgi_input
|
||||||
#cgi_dump
|
#cgi_dump
|
||||||
|
|
||||||
set tsfile [cgi_get file]
|
set rfile [cgi_get file]
|
||||||
set rfile [file normalize $tsfile]
|
|
||||||
set ts [ts fetch $rfile]
|
set ts [ts fetch $rfile]
|
||||||
set dir [file dirname $rfile]
|
set dir [file dirname $rfile]
|
||||||
|
|
||||||
|
@ -10,14 +10,14 @@ puts "Content-Type: text/html\r\n\r\n"
|
|||||||
cgi_input
|
cgi_input
|
||||||
#cgi_dump
|
#cgi_dump
|
||||||
|
|
||||||
set tsfile [cgi_get file]
|
set rfile [cgi_get file]
|
||||||
set rfile [file normalize $tsfile]
|
|
||||||
set ts [ts fetch $rfile]
|
set ts [ts fetch $rfile]
|
||||||
set dir [file dirname $rfile]
|
set dir [file dirname $rfile]
|
||||||
set len [$ts duration 1]
|
set len [$ts duration 1]
|
||||||
lassign [$ts dlnaloc] url
|
lassign [$ts dlnaloc] url
|
||||||
|
|
||||||
if {[cgi_get do] eq "it"} {
|
if {[cgi_get do] eq "it"} {
|
||||||
|
set xstart [clock milliseconds]
|
||||||
|
|
||||||
set base [file rootname $rfile]
|
set base [file rootname $rfile]
|
||||||
set origdir "$dir/_original"
|
set origdir "$dir/_original"
|
||||||
@ -51,6 +51,9 @@ if {[cgi_get do] eq "it"} {
|
|||||||
exec /mod/bin/hmt -encrypted "$dir/$shname.hmt"
|
exec /mod/bin/hmt -encrypted "$dir/$shname.hmt"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set xtime [expr [expr [clock milliseconds] - $xstart] / 1000.0]
|
||||||
|
puts "Time taken: $xtime"
|
||||||
|
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,20 +11,23 @@ cgi_input
|
|||||||
#cgi_dump
|
#cgi_dump
|
||||||
|
|
||||||
set file [cgi_get file]
|
set file [cgi_get file]
|
||||||
set rfile [file normalize $file]
|
|
||||||
set ts [ts fetch $file]
|
|
||||||
|
|
||||||
# Default to just downloading the raw file.
|
# Default to just downloading the raw file.
|
||||||
set url $file
|
set url $file
|
||||||
set mime "video/ts"
|
set mime "video/ts"
|
||||||
|
|
||||||
# If it's encrypted on disk and the DLNA option is available, then use
|
if {[string match {*.ts} $file]} {
|
||||||
# the server to perform decryption on the fly.
|
if {![catch {set ts [ts fetch $file]}]} {
|
||||||
if {[$ts flag "ODEncrypted"] > 0} {
|
|
||||||
|
# If it's encrypted on disk and the DLNA option is available,
|
||||||
|
# then use the server to perform decryption on the fly.
|
||||||
|
if {[$ts flag "ODEncrypted"] > 0} {
|
||||||
set dlna [$ts dlnaloc]
|
set dlna [$ts dlnaloc]
|
||||||
if {[llength $dlna]} { lassign $dlna url mime }
|
if {[llength $dlna]} { lassign $dlna url mime }
|
||||||
|
|
||||||
#puts "DLNA: $dlna"
|
#puts "DLNA: $dlna"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
puts "Content-Type: text/plain"
|
puts "Content-Type: text/plain"
|
||||||
|
Loading…
Reference in New Issue
Block a user