From 99dde5a4a5dafe92dcfe8e7bf9fc033afe949d04 Mon Sep 17 00:00:00 2001 From: hummypkg Date: Sun, 27 Nov 2011 23:29:14 +0000 Subject: [PATCH] update git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@534 2a923420-c742-0410-a762-8d5b09965624 --- var/mongoose/cgi-bin/browse.jim | 23 ++++--- var/mongoose/cgi-bin/browse/browse.js | 26 ++++++++ var/mongoose/cgi-bin/browse/join.jim | 64 ++++++++++++++++++++ var/mongoose/cgi-bin/browse/join_backend.jim | 27 +++++++++ var/mongoose/include/logfiles.jim | 5 +- var/mongoose/lib/system.class | 4 +- 6 files changed, 139 insertions(+), 10 deletions(-) create mode 100755 var/mongoose/cgi-bin/browse/join.jim create mode 100755 var/mongoose/cgi-bin/browse/join_backend.jim diff --git a/var/mongoose/cgi-bin/browse.jim b/var/mongoose/cgi-bin/browse.jim index d2c8009..698317e 100755 --- a/var/mongoose/cgi-bin/browse.jim +++ b/var/mongoose/cgi-bin/browse.jim @@ -53,11 +53,6 @@ proc entry {file} {{i 0}} { set img Video_Other } - puts " -
- - " - 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 "" + set fscl "fs" + if {$type eq "ts"} { + set fscl "fs fsts" + } puts " - $bfile - +
+ + + + $bfile + " # Size @@ -277,6 +279,11 @@ puts { } +# Join +if {[file exists /mod/bin/nicesplice]} { + puts { } +} + # Streamer file if {[file exists /mnt/hd3/Streamer_down_file]} { diff --git a/var/mongoose/cgi-bin/browse/browse.js b/var/mongoose/cgi-bin/browse/browse.js index f794f1b..16294a3 100755 --- a/var/mongoose/cgi-bin/browse/browse.js +++ b/var/mongoose/cgi-bin/browse/browse.js @@ -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'); + + }); }); diff --git a/var/mongoose/cgi-bin/browse/join.jim b/var/mongoose/cgi-bin/browse/join.jim new file mode 100755 index 0000000..61dfd12 --- /dev/null +++ b/var/mongoose/cgi-bin/browse/join.jim @@ -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 { + + +

+Drag the files below into order, enter a name for the resulting file and then +click the Join button. +} + +puts "

    " +foreach file [split [cgi_get files] ","] { + set ts [ts fetch $file] + puts "
  • + + + $file ([clock format [$ts duration 1] -format "%T"]) +
    [$ts get title] +
    +
  • " +} +puts "
" + +puts { +

+Name for joined file: + + + +
+ + +} + +footer + diff --git a/var/mongoose/cgi-bin/browse/join_backend.jim b/var/mongoose/cgi-bin/browse/join_backend.jim new file mode 100755 index 0000000..f026cd0 --- /dev/null +++ b/var/mongoose/cgi-bin/browse/join_backend.jim @@ -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" + diff --git a/var/mongoose/include/logfiles.jim b/var/mongoose/include/logfiles.jim index 31aa397..720cba2 100755 --- a/var/mongoose/include/logfiles.jim +++ b/var/mongoose/include/logfiles.jim @@ -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 " [file tail $file] ([pretty_size [file size $file]])
" diff --git a/var/mongoose/lib/system.class b/var/mongoose/lib/system.class index f89b1f7..1449260 100644 --- a/var/mongoose/lib/system.class +++ b/var/mongoose/lib/system.class @@ -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 }