forked from hummypkg/webif
add decryption
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@502 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
Package: webif
|
||||
Priority: optional
|
||||
Section: web
|
||||
Version: 0.7.8
|
||||
Version: 0.8.0
|
||||
Architecture: mipsel
|
||||
Maintainer: af123@hummypkg.org.uk
|
||||
Depends: mongoose(>=3.0-2),jim(>=0.71-1),jim-sqlite3(>=0.71-1),jim-cgi(>=0.4),jim-oo,jim-pack,service-control,busybox(>=1.18.3-1),lsof,epg(>=1.0.7),hmt(>=1.0.8),ssmtp
|
||||
Depends: mongoose(>=3.0-2),jim(>=0.71-1),jim-sqlite3(>=0.71-1),jim-cgi(>=0.4),jim-oo,jim-pack,service-control,busybox(>=1.18.3-1),lsof,epg(>=1.0.7),hmt(>=1.1.0),ssmtp
|
||||
Replaces: af123-webif
|
||||
Conflicts: af123-webif
|
||||
Suggests: ffmpeg,webif-iphone
|
||||
Suggests: ffmpeg,webif-iphone,nicesplice
|
||||
Description: An evolving web interface for the Humax.
|
||||
|
||||
@@ -81,6 +81,7 @@ proc entry {file} {{i 0}} {
|
||||
|
||||
set locked 0
|
||||
set encd 0
|
||||
set odencd 0
|
||||
set def unknown
|
||||
set bx 0
|
||||
if {$type eq "ts"} {
|
||||
@@ -108,6 +109,9 @@ proc entry {file} {{i 0}} {
|
||||
src=/images/749_1_26_Video_Encryption.png
|
||||
height=21>"
|
||||
}
|
||||
if {[$ts flag "ODEncrypted"] > 0} {
|
||||
set odencd 1
|
||||
}
|
||||
|
||||
# Guidance
|
||||
if {[$ts flag "Guidance"] > 0} {
|
||||
@@ -125,6 +129,7 @@ proc entry {file} {{i 0}} {
|
||||
<a href=#>
|
||||
<img class=\"opt va\" border=0 width=45 type=$type did=$i
|
||||
locked=$locked encd=$encd def=$def new=$new bx=$bx
|
||||
odencd=$odencd
|
||||
src=/images/181_1_00_Help5_OPT_Plus.png>
|
||||
</a>
|
||||
<div class=\"results blood\" style=\"margin: 0 0 0 5em\"></div>
|
||||
@@ -151,6 +156,9 @@ puts {
|
||||
<li><a href=#rename>Rename</a></li>
|
||||
<li><a href=#download>Download</a></li>
|
||||
}
|
||||
if {[system model] eq "HDR"} {
|
||||
puts { <li class="separator"><a href=#decrypt>Decrypt</a></li> }
|
||||
}
|
||||
if {[file exists /mod/bin/nicesplice]} {
|
||||
puts { <li class="cut separator"><a href=#crop>Crop</a></li> }
|
||||
}
|
||||
|
||||
@@ -156,6 +156,12 @@ function preparemenu(el, menu)
|
||||
$(menu).changeContextMenuItem('#lock', 'Lock');
|
||||
$('#optmenu').enableContextMenuItems('#delete');
|
||||
}
|
||||
|
||||
if (el.attr('odencd') == 1)
|
||||
$('#optmenu').enableContextMenuItems('#decrypt');
|
||||
else
|
||||
$('#optmenu').disableContextMenuItems('#decrypt');
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -163,6 +169,7 @@ function preparemenu(el, menu)
|
||||
$('#optmenu').disableContextMenuItems('#lock');
|
||||
$('#optmenu').disableContextMenuItems('#enc');
|
||||
$('#optmenu').disableContextMenuItems('#new');
|
||||
$('#optmenu').disableContextMenuItems('#decrypt');
|
||||
$('#optmenu').disableContextMenuItems('#crop');
|
||||
}
|
||||
|
||||
@@ -228,6 +235,11 @@ var menuclick = function(action, el, pos)
|
||||
encodeURIComponent(file);
|
||||
break;
|
||||
|
||||
case 'decrypt':
|
||||
window.location.href = '/cgi-bin/browse/decrypt.jim?file=' +
|
||||
encodeURIComponent(file);
|
||||
break;
|
||||
|
||||
default:
|
||||
alert('Unhandled action: ' + action);
|
||||
break;
|
||||
|
||||
128
var/mongoose/cgi-bin/browse/decrypt.jim
Executable file
128
var/mongoose/cgi-bin/browse/decrypt.jim
Executable file
@@ -0,0 +1,128 @@
|
||||
#!/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 tsfile [cgi_get file]
|
||||
set rfile [file normalize $tsfile]
|
||||
set ts [ts fetch $rfile]
|
||||
set dir [file dirname $rfile]
|
||||
set len [$ts duration 1]
|
||||
lassign [$ts dlnaloc] url
|
||||
|
||||
if {[cgi_get do] eq "it"} {
|
||||
set base [file rootname $rfile]
|
||||
set origdir "$dir/_original"
|
||||
if {![file exists $origdir]} { file mkdir $origdir }
|
||||
|
||||
set shname [file tail $base]
|
||||
puts "Processing $shname"
|
||||
|
||||
exec wget -O "$rfile.decrypting" $url
|
||||
|
||||
puts "Moving recording to $origdir"
|
||||
|
||||
foreach f [glob -nocomplain "${base}.*"] {
|
||||
if {[file extension $f] eq ".decrypting"} { continue }
|
||||
set tail [file tail $f]
|
||||
puts " $tail"
|
||||
file rename $f "${origdir}/$tail"
|
||||
}
|
||||
|
||||
file rename "$rfile.decrypting" $rfile
|
||||
|
||||
foreach ext {nts hmt thm} {
|
||||
set sidecar "$shname.$ext"
|
||||
if {[file exists "$origdir/$sidecar"]} {
|
||||
puts "Copying back sidecar $ext"
|
||||
file copy "$origdir/$sidecar" "$dir/$sidecar"
|
||||
}
|
||||
}
|
||||
|
||||
if {[file exists "$dir/$shname.hmt"]} {
|
||||
exec /mod/bin/hmt -encrypted "$dir/$shname.hmt"
|
||||
}
|
||||
|
||||
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>
|
||||
<tr><th>DLNA URL</th><td>$url</td></tr>
|
||||
</table>
|
||||
"
|
||||
|
||||
if {$url eq ""} {
|
||||
puts "This file has not been indexed by the media server.
|
||||
Cannot decrypt."
|
||||
exit
|
||||
}
|
||||
|
||||
puts {
|
||||
|
||||
<div style="margin-top: 10px"></div>
|
||||
<div id=decryptdiv><button id=decryptit>Perform decryption</button></div>
|
||||
<div id=progressdiv style="display: none">
|
||||
Decrypting: <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/decrypt_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');
|
||||
});
|
||||
|
||||
$('#decryptit').button().click(function() {
|
||||
$('#decryptdiv').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>
|
||||
|
||||
}
|
||||
|
||||
23
var/mongoose/cgi-bin/browse/decrypt_progress.jim
Executable file
23
var/mongoose/cgi-bin/browse/decrypt_progress.jim
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/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]
|
||||
|
||||
if {![file exists "$rfile.decrypting"]} {
|
||||
puts "0"
|
||||
} else {
|
||||
set sz [file size $rfile]
|
||||
set nsz [file size "$rfile.decrypting"]
|
||||
|
||||
puts [expr $nsz * 100 / $sz]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user