git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@534 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2011-11-27 23:29:14 +00:00
parent d04d3bdb15
commit 99dde5a4a5
6 changed files with 139 additions and 10 deletions

View File

@ -53,11 +53,6 @@ proc entry {file} {{i 0}} {
set img Video_Other
}
puts "
<div class=\"va bf\" id=[incr i]>
<a class=bf file=\"$file\" type=$type href=#>
"
set new 0
if {$type eq "ts"} {
if {[$ts flag "New"] > 0} { set new 1 }
@ -67,11 +62,18 @@ proc entry {file} {{i 0}} {
if {$new} { append img _New }
puts "<img class=va border=0 src=/img/$img.png>"
set fscl "fs"
if {$type eq "ts"} {
set fscl "fs fsts"
}
puts "
$bfile
</a>
<div class=\"va bf\" id=[incr i]>
<img class=va border=0 src=/img/$img.png>
<input class=\"$fscl\" type=checkbox>
<a class=bf file=\"$file\" type=$type href=#>
$bfile
</a>
"
# Size
@ -277,6 +279,11 @@ puts {
<small><button id=dedup>De-duplicate/tidy this folder</button></small>
}
# Join
if {[file exists /mod/bin/nicesplice]} {
puts { <button id=join>Join</button> }
}
# Streamer file
if {[file exists /mnt/hd3/Streamer_down_file]} {

View File

@ -342,5 +342,31 @@ var menuclick = function(action, el, pos)
'/cgi-bin/browse/ffmpeg.jim?file=' +
encodeURIComponent($('#save_stream').attr('file')));
});
$('#join').button()
.prop('disabled', true)
.addClass('ui-state-disabled')
.click(function() {
var files = new Array();
var els = $('input.fsts:checked + a').each(function() {
files.push(encodeURIComponent($(this).attr('file')));
});
//console.log("%o", files);
window.location.href = '/cgi-bin/browse/join.jim?files=' +
files.join();
});
$('input.fs').change(function() {
var num = $('input.fsts:checked').size();
if (num > 1)
$('#join')
.removeProp('disabled')
.removeClass('ui-state-disabled');
else
$('#join')
.prop('disabled', true)
.addClass('ui-state-disabled');
});
});

View File

@ -0,0 +1,64 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
require ts.class pretty_size
puts "Content-Type: text/html\r\n\r\n"
header
cgi_input
#cgi_dump
puts {
<style>
#filelist { list-style-type: none; margin: 0; padding: 0; }
#filelist li { margin: 0 3px 3px 3px; padding: 0.4em; padding-left: 1.5em;
height: 35px; }
#filelist li span { position: absolute; margin-left: -1.3em; }
span.pl { padding-left: 2em; }
</style>
<p><b>
Drag the files below into order, enter a name for the resulting file and then
click the <i>Join</i> button.</b>
}
puts "<ul id=filelist>"
foreach file [split [cgi_get files] ","] {
set ts [ts fetch $file]
puts "<li class=\"va ui-state-default\" id=\"$file\"><span
class=\"va ui-icon ui-icon-arrowthick-2-n-s\"></span>
<img class=va src=/img/Video_TS.png>
<span class=pl>
$file ([clock format [$ts duration 1] -format "%T"])
<br><i style=\"font-size: 0.8em\">[$ts get title]</i>
</span>
</li>"
}
puts "</ul>"
puts {
<br><br>
Name for joined file:
<input id=dest name=dfile class="text ui-widget-content ui-corner-all"
length=20 maxlength=50>
<button id=dojoin>Join</button>
<div id=results class=pre></div>
<script type=text/javascript>
$('#filelist').sortable().disableSelection();
$('#dojoin').button().click(function() {
var files = $('#filelist').sortable('toArray');
var sfiles = new Array();
for (x in files)
sfiles.push(encodeURIComponent(files[x]));
$('#results').load('/cgi-bin/browse/join_backend.jim?files=' +
sfiles.join() + '&dest=' + $('#dest').val());
});
</script>
}
footer

View File

@ -0,0 +1,27 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
require ts.class pretty_size
puts "Content-Type: text/html\r\n\r\n"
cgi_input
#cgi_dump
set joinstart [clock milliseconds]
set cmd {/mod/bin/nicesplice}
foreach file [split [cgi_get files] ","] {
lappend cmd "-in" [file rootname $file]
set dir [file dirname $file]
}
lappend cmd "-out" "$dir/[cgi_get dest]"
puts "($cmd)"
puts [exec {*}$cmd]
set jointime [expr [expr [clock milliseconds] - $joinstart] / 1000.0]
puts "Time taken: $jointime"

View File

@ -3,7 +3,10 @@
source /mod/var/mongoose/lib/setup
require pretty_size
foreach file [glob -nocomplain /tmp/*.log] {
foreach file [concat \
[glob -nocomplain /tmp/*.log] \
[glob -nocomplain /mod/tmp/*.log] \
] {
puts "<a href=# class=log file=\"$file\">
<img border=0 height=14 src=/images/421_1_00_CH_Title_2R_Arrow.png>
[file tail $file]</a> ([pretty_size [file size $file]]) <br>"

View File

@ -70,7 +70,9 @@ proc {system diskspace} {} {
proc {system busy} {} {
# Is humaxtv doing anything important?
set pid [exec /mod/bin/busybox/pgrep humaxtv]
if {[catch {set pid [exec /mod/bin/busybox/pgrep humaxtv]}]} {
return 0
}
set c 0
foreach line [split [exec /mod/bin/lsof -p $pid] "\n"] {
if {[string match {*Video*.ts} $line]} { incr c }